Chartjs-React-chartjs – line chart displaying all datapoints, not just on hover

0👍

In Chart.js’s terminology, there are maybe three different concepts that are getting involved here:

  • Tooltips, which by default display a box with a label when you hover over or near a point
  • Hover (e.g., line hover), which are commonly used with tooltips to change the styling of a point when it’s hovered
  • The datalabels plugin, which by default labels every single point (whether or not it’s hovered)

If you don’t specifically need datalabels, it’s simplest to not globally register it. You can still pass it as a plugin to specific charts that need it.

If you want to use datalabels only for some points or some datasets, then you’ll have to check the datalabels documentation – it has quite a few options, including (for full flexibility) scriptable options that can apply whatever logic you want via JavaScript callbacks.

Leave a comment