Chart.js
Chart.js copied to clipboard
fix: same-looking tooltips on multiseries charts
https://github.com/chartjs/Chart.js/issues/9771
- Now, if tooltip callback returns
undefined
, then will be used default callback. - PolarArea and Doughnut charts with multiple series shows tooltips same as other charts.
@kurkle Hi. Scatter and Bubble charts don't use data.labels
, so should their tooltips also look like on rest multiseries charts?
I think its better to always show the title with the label of the dataset, not only if there is more than 1 dataset, will give a more consistent and clear look. Same goes for scatter you could use the dataset label in that case
Changes also need to be reflected in the migration guide: https://github.com/chartjs/Chart.js/blob/master/docs/migration/v4-migration.md
On an addition on the reaction I left on @kurkle comment, maby you can delete the labels array from the bubble and scatter samples so they dont show a wrong tooltip title.
@LeeLenaleee done
@kurkle @LeeLenaleee @etimberg Hi guys. Review please 🙏
LGTM
I believe @kurkle is on vacation so his reviews might be delayed
That was true, but I'm back!
What if we want to customize the tooltip on the doughnut charts (for example) adding a % calculation but not on every other chart type? How can we achieve that now? @dangreen
You can still override the callbacks by configuring it in the options
for those charts or in the defaults for that controller
Thanks @LeeLenaleee , maybe we should add this info to the migration guide from 3.x
But this did not change between v3 and v4
@LeeLenaleee It's related to this line in the migration guide... right?
https://www.chartjs.org/docs/latest/migration/v4-migration.html
Charts don't override the default tooltip callbacks, so all chart types have the same-looking tooltips.
No, that line is about the overrides we did in the code, not about what the user specified.
So in our controllers we overrode those functions but as user you could always override them again and you still can
Could this be related? I'm having issues with labels on bubble charts https://github.com/chartjs/Chart.js/issues/11023