-
Notifications
You must be signed in to change notification settings - Fork 11.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with x axis stacking for a stacked bar chart #5072
Comments
@cmodiano I'm not sure what are your expectations in this case, maybe #4994 (fiddle) fixed it. But your issue might also be the way you setup your data, I'm not sure it works well to define data like data: {
labels: ['2017-12-22 08:59', '2017-12-22 09:00'],
datasets: [{
data: [2, 18]
}, {
data: [0, 2]
}, {
data: [0, 4]
},
//...
} |
@simonbrunel You add a 0 value for the y when the timestamp data does not exist, is it mandatory? If yes this will mean I have to alter the data retrieved from the database before generating the chart. Is it possible to make Chartjs auto add the 0 values for missing timestamps? Thanks |
I guess it should work the way you set your data, but I'm not sure the actual code can handle it, that's why I suggest the other format. I think it would help if you provide a picture of the result you are expecting. |
I tried and whatever format is used it is necessary that each serie has a value for each timestamp. |
Came across this issue today. Here is what I get: https://jsfiddle.net/kbn1L9w1/ The only difference with the two scripts is that I manually fill in data so that both data sets match the same length, though I was expecting the script to do that work for me. Indeed, the green bar should not be extending into a category that it is not part of. |
It looks like this PR might be for the same issue: #5298 |
Hi,
I'm trying to build a stacked bar chart based on a time series x axis.
The chart doesn't seem to stack correctly on the x axis, I don't know if I missed something or it's a bug.
Any help will be much appreciate, here is a Fiddle to illustrate the problem.
https://jsfiddle.net/1kLyyjfp/
Thanks
The text was updated successfully, but these errors were encountered: