Igor
Igor

Reputation: 9

ChartJS Annotations display custom label

is there any way to display a custom label on mouse hover chartJS annotations like it displayed on ChartJS? For example, when you create a line chart of points, and you hover one of the points, it displays the label of that point. I want something similar to that but on annotation.

Upvotes: 0

Views: 860

Answers (1)

vueAng
vueAng

Reputation: 453

onHover API

  options: {
    // LOOK AT ME!!! I'M SO IMPORTANT!!!
    onHover: function onHover (evt, activeElements) {
      if (!activeElements || !activeElements.length) return;
      // logic operation
      this.update();
    },


  },

https://www.chartjs.org/docs/latest/configuration/legend.html

Upvotes: 1

Related Questions