[Chartjs]-Add horizontal Line to my chart.js Barchart

5👍

Yes, use the Annotations plugin:Chart.Annotation.js

annotation: {
    annotations: [{
        type: 'line',
        mode: 'horizontal',
        scaleID: 'y-axis-0',
        value: '26',
        borderColor: 'tomato',
        borderWidth: 1
    }],
    drawTime: "afterDraw" // (default)
}

Result:

enter image description here

Codepen: Chart.js Annotations BarChart

Note: I am using V 2.2.1, your syntax is I believe from a previous version, so I am only using your Data and some options.

Leave a comment