I have an application using Chart JS and the great extension chartjs-plugin-crosshair to provide zoom and a vertical line on hover. It's ability to 'link' charts is critical as it highlights values on separate charts across the same x-axis.
The issue is the linked charts also have linked legends. I've created a simple example: https://codepen.io/sheixt/pen/JjGvbVJ
Here is an extract of the Chart option config (see the link for the full script):
const options = {
plugins: {
crosshair: {
sync: {
enabled: true
}
}
},
tooltips: {
mode: "interpolate",
intersect: false,
callbacks: {
title: function (a, d) {
return a[0].xLabel.toFixed(2);
},
label: function (i, d) {
return d.datasets[i.datasetIndex].label + ": " + i.yLabel.toFixed(2);
}
}
}
};
As you can see, if you "turn off" a dataset (e.g. Dataset 1, A in chart 1, D in chart 2, and G in chart 3), the dataset is removed from all of the linked charts.
I have a series of charts that are based on the same x-axis data so the crosshair line & the tooltip appearing on all of the linked charts is ideal. But as each dataset that is plotted is not the same across the various charts, I do not want it to disappear on click.
So in my example deselecting Dataset 1 on chart 1 A would be removed but D in chart 2, and G in chart 3 should remain.
Is this feasible?
