简体   繁体   English

ChartJS 注释显示自定义标签

[英]ChartJS Annotations display custom label

is there any way to display a custom label on mouse hover chartJS annotations like it displayed on ChartJS?有没有办法像在 ChartJS 上显示的那样在鼠标悬停 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.我想要类似的东西,但在注释上。

onHover API悬停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 https://www.chartjs.org/docs/latest/configuration/legend.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM