[Chartjs]-Chart js x-axis values getting repeated twice

10๐Ÿ‘

โœ…

So chartjs is creating the x-axis labels dynamically and decided it can show two labels per day, which when formatted end up showing two dates that are the same.

Pass a new field unit to the time object and set it to day. this will cause the chart to only show one tick per day in the time frame. (example fiddle)

options: {
        scales: {
            xAxes: [{
                type: 'time',
                time: {
                     unit: 'day',
                }                 
            }],
        },
    }

Leave a comment