1
votes

I'm using ChartJS to visualize a database data by week. I currently have data for the 1st week of this year and the beginning of the chart is on the axis.

My question is, how can I change the starting position on the X axis by 20 pixels, but keep the line from the axis? Thanks

enter image description here

UPDATE

I added this code and the starting position moved off the axis.

options: {
    scales: {
        xAxes: [{
            offset: true
        }]
    }
}

enter image description here

I still have to add 2 lines from the axis to the point

1

1 Answers

0
votes

add an empty string to your labels object and duplicate the first value so it looks like it will start a bit later since it has an empty label.

old: labels: ['1', '2' ...], data: [0, 4]

new: labels: ['', '1', '2'], data: [0,0,4]