0👍
Worked for me after I changed the import statement to:
var ChartAnnotation=require('chartjs-plugin-annotation');
and changed scaleID from x-axis-0 to x-axis-1:
annotation: {
annotations: [
{
type: 'line',
mode: 'vertical',
scaleID: 'x-axis-1',
value: avgXValue,
borderColor: 'red',
borderWidth: 2,
},
{
type: 'line',
mode: 'horizontal',
scaleID: 'y-axis-1',
value: avgYValue,
borderColor: 'red',
borderWidth: 2,
}
]
}
Source:stackexchange.com