Chartjs-How can I build a vertical line without going through my dots on my line graph? (charts.js)

0👍

how should the vertical line look like?

do you mean the median line?

enter image description here

it would be helpful, if you can show us what kind of vertical line you mean, or at least tell us a function, so we know how the line should look like


EDIT:

You can add a 2nd yAxis to the right side.
Replace this for yAxes:

       yAxes: [{
                id: 'a',
                type: 'linear',
                position: 'left',
                gridLines: {
                    drawOnChartArea:false
                },
                scaleLabel: {
                    display: true,
                    labelString: 'Salary',
                    fontSize: 20
                },
                ticks: {
                    beginAtZero: true,
                    stepSize: 20,
                    callback: function(value, index, values) {
                        return '$' + value.toFixed(decimals)
                    }
                }
            }, {
                id: 'b',
                type: 'linear',
                position: 'right',
                gridLines: {
                    drawOnChartArea:false
                },
                scaleLabel: {
                    display: false
                },
                ticks: {
                    display: false,
                    beginAtZero: true,
                    stepSize: 1
                }
            }]

Leave a comment