I'm using angular, Chartjs and ng2-charts to create charts on my project. I'm trying to make middle line following the instructions provided on the GitHub repository. The problem is that when I add this code, it "undisplays" (I'm not sure this is an english word) the chart.Here's what I want to reproduce :
Here's my code:
public lineVistaChartOptions:any = {
responsive: true,
annotation:{
drawTime: 'afterDatasetsDraw', // (default)
events: ['click'],
dblClickSpeed: 350, // ms (default)
annotations: {
type: 'line',
drawTime: 'afterDatasetsDraw',
id: 'a-line-1',
mode: 'horizontal',
// ID of the scale to bind onto
scaleID: 'y-axis-0',
value: 50,
endValue: 100,
borderColor: 'red',
borderWidth: 2,
borderDash: [2, 2],
borderDashOffset: 1,
label: {
backgroundColor: 'rgba(0,0,0,0.8)',
fontFamily: "sans-serif",
fontSize: 12,
fontStyle: "bold",
fontColor: "#fff",
xPadding: 0,
yPadding: 0,
cornerRadius: 6,
position: "center",
xAdjust: 0,
yAdjust: 0,
enabled: true,
content: "Test label"
}
}
}
};
Which is the exact same as the documentation.