我正在使用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)
它适用于我找到的所有手册,但不适用于我的项目