小编Emi*_*tew的帖子

注释不显示在 vue-chartjs 中

我正在使用vue-chartjs. 我需要在图表中添加注释。我导入了一个注释插件

import chartjsPluginAnnotation from "chartjs-plugin-annotation"
Run Code Online (Sandbox Code Playgroud)

然后在mounted上添加一个插件

this.addPlugin(chartjsPluginAnnotation)
Run Code Online (Sandbox Code Playgroud)

另外,我在选项中添加了一个注释对象

plugins: {
  annotation: {
          drawTime: 'afterDraw',
            annotations: [
              {
                type: "line",
                id: 'BTV',
                mode: "horizontal",
                display: true,
                scaleID: "y-axis-0",
                borderColor: "red",
                value: 17000,
                borderDash: 4,
                label: {
                  content: 'aa',
                  enabled: true,
                  position: "top",
                  xAdjust: 15,
                  backgroundColor: '#4ecca3',
                  fontSize: 10,
                }
              }
          ]
  },
}
Run Code Online (Sandbox Code Playgroud)

它适用于我找到的所有手册,但不适用于我的项目

javascript chart.js vue-chartjs

0
推荐指数
2
解决办法
676
查看次数

标签 统计

chart.js ×1

javascript ×1

vue-chartjs ×1