Tooltips / labels not showing for low-frequent datapoints
See original GitHub issueExpected Behavior
When displaying a mix between very high-frequent and low-frequent categories in a chart, e.g. bar chart, all datapoints / bars together with their tooltips should be displayed.
Current Behavior
The low-frequent labels seem to be invisible, e.g. with a dataset as the following:
data: [999999999999, 5555555555, 3, 5, 2, 3]
In addition, when hovering over the position where the data/bar should be, no tooltip information is displayed whereas, for the frequent ones, the labels are showing up correctly.
Possible Solution
Squeezing the axis somehow to make even very low-frequent categories visible? Or enable hovering even if the bar is not really visible. Set a minimum bar size?
Steps to Reproduce (for bugs)
https://codepen.io/isikleo/pen/rNObmyr
Context
I’m working with mixed datasets where very frequent as well as very low-frequent categories appear. It is a pity that as soon as 1 high-frequent datapoint is present all the others totally lose their weight and visibility. Is there any suggested workaround for this? Unfortunately, I couldn’t find anything in the docs.
Environment
- Chart.js version: 2.9.3
- Browser name and version: Chrome
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
I updated the fiddle using the two suggested options:
intersect: false
andminBarLength: 4
https://codepen.io/isikleo/pen/KKdYGXX
This at least ensures that all labels are hoverable and a small default bar size is set for all categories, making charts with both very small and large values more appealing.
@etimberg is right though, setting a minBarLength can be misleading - using a different scale to squeeze the values might be a better solution for all those use cases where this is possible.
There is an option for minBarSize
Using a logarithmic axis may also help reduce the difference between the smallest and largest values