-
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
ToolTip error on Bar Chart #426
Comments
I think you must provide all values, including 0's. |
The issue I see with that is two fold. First, the bars are still visible in your example (although valued at 0). For example if a chart used 2 series, one to represent my weight, the other to represent my target weight. I don't weight 0lbs next month, although I would have a value for my target. It wouldn't make sense to have values for something that hasn't happened yet or doesn't exist. Further, there's a variety of instances, like in a chemical plant, where you might have a chart with multiple series each representing a value over time. If the sampling rate is not the same for each series having a value of 0 would be incorrect. For example, say I have the temperature of boilers A, B, and C with respect to time. If A has a sample rate of every 1 min, B every 5 min, and C every 15 min and the temperatures are between 85 - 100C it would be misleading to have a value of 0 for B and C for each minute. I understand in this scenario it would be possible to use interpolation or break out the series to multiple graphs. However, I feel that the lack of a value should be an acceptable value, and it should not cause an error and not be visible on the chart or tooltip. |
That's correct. I work with both null values and 0 values too and have the same problems :) |
Thanks for reporting in such detail - that's certainly a bug. Will try and get that sorted tomorrow evening and push a fix. From very quickly glancing at the issue, it looks like it just requires some defensive coding around whether a bar is actually there when getting the bars at that index from an event. |
I've had a little bit more of a look into this and it's not quite as simple as I had originally thought - there were quite a few problems with using sparse datasets in Line, Bar and Radar charts. I've set up a PR for some changes that fix your issues here if you want to take a look : #435 It's mostly done, just need to resolve an issue with the bezier curve spline points for line charts before it can get merged into master. |
Sorry this took so long to resolve - just gone into master and tagged in the latest release now. Now you can have sparse datasets and skip over some points by passing in a falsy value instead of a number. |
I'm still seeing this issue using 1.0.1-beta.4. Should it be fixed in that version? Here's my stack track if that's helpful:
|
Same here, is there a workaround except providing 0's? |
I have a bar chart that uses the following setup below:
example jsfiddle
In short, when there is a barchart that has multiple series where those series do not have the same length, the tooltip does not appear for those 'unmatched' columns. In the example below this would be for the columns at February - July.
Looking at the labels below, a tooltip should be displayed for each of the months below. However, because of the error at Chart.js line 1969 throws an error "Uncaught TypeError: Cannot read property 'highlightFill' of undefined "
I was curious if I would be able to fix this?
However I'm not sure if it would be better to build the undefined tolerance into the helpers foreach function or fix within the anonymous function to solve this issue.
The text was updated successfully, but these errors were encountered: