Error
We would like the ability to display additional information in the tooltips on chart data, specifically line charts, so you can have notes for particular ups or downs. Chart.JS supports an additional callback method "afterTitle" that would work perfect for this. We decided to implement an additional "tooltips" property on the dataset (or tooltip on individual data items) that works similarly to labels and data.
This is a preview of the desired result:
Here are the changes we made to accomplish this capability (original on left, changes on right):
tooltips: [{{ dataitems | Map:'tooltip' | Join:'", "' | Prepend:'"' | Append:'"' }}]
tooltips: [{{ dataset.tooltips }}]
afterTitle: function(tooltipItems, data) { var tooltip = ''; if (tooltipItems.length > 0) { var item = tooltipItems[0]; var dataset = data.datasets[item.datasetIndex]; if (dataset) { var data = dataset.tooltips[item.index] if (data) { tooltip = data; } } } return tooltip; }
Cultivate your ideas for maximum impact with these helpful submission tips that will increase the chances of your brilliant concepts becoming reality.