[Chartjs]-Moving the zerolines in ChartJS scatter chart

1๐Ÿ‘

โœ…

As suggested to me by Z. Bagley in the comments, I solved the problem simply by drawing 2 lines on the chart. This was acheived very easily with the Annotations Plugin.

After adding the plugin, I simply added the following code to my options object:

annotation: {
    annotations: [
        {
            drawTime: 'afterDraw',
            type: 'line',
            mode: 'horizontal',
            scaleID: 'y-axis-1',
            value: 50,
            borderColor: '#005a99',
            borderWidth: 4,
            label: {
                enabled: false,
            }
        },
        {
            drawTime: 'afterDraw',
            type: 'line',
            mode: 'vertical',
            scaleID: 'x-axis-1',
            value: 50,
            borderColor: '#005a99',
            borderWidth: 4,
            label: {
                enabled: false,
            }
        }
    ]
},

That created the wanted result:

enter image description here

Leave a comment