I have been looking at this thread with the following JSFiddle, which does exactly what I need. Seems like the answer is outdated, but I am not able to get it working.
What I am trying to create a plugin to that will allow the user to click on a datapoint on the chart, and the tooltip will stay open. Then click on another datapoint, and that tooltip will stay open aswell. This will allow the user to more easily compare data in two different tooltips. The "click" event would be useful if it allowed for multiple tooltips at the same time. Any ideas, or pointers to the right direction would be greatly apprieciated!
The following is the plugin from the other thread (creds to Marine Giraud)
var keepTooltipOpenPlugin = {
beforeRender: function(chart) {
// We are looking for bubble which owns "keepTooltipOpen" parameter.
var datasets = chart.data.datasets;
chart.pluginTooltips = [];
for (i = 0; i < datasets.length; i++) {
for (j = 0; j < datasets[i].data.length; j++) {
if (datasets[i].data[j].keepTooltipOpen && !chart.getDatasetMeta(i).hidden) {
//When we find one, we are pushing all informations to create the tooltip.
chart.pluginTooltips.push(new Chart.Tooltip({
_chart: chart.chart,
_chartInstance: chart,
_data: chart.data,
_options: chart.options.tooltips,
_active: [chart.getDatasetMeta(i).data[j]]
}, chart));
}
}
}
}, // end beforeRender
afterDatasetsDraw: function(chart, easing) {
// Draw tooltips
Chart.helpers.each(chart.pluginTooltips, function(tooltip) {
tooltip.initialize();
tooltip.update();
tooltip.pivot();
tooltip.transition(easing).draw();
});
} // end afterDatasetsDraw
}