[Chartjs]-Chart.js hours scale show day switch

9👍

This can be done using the major ticks option in chartjs.

scales: {
  xAxes: [{
    type: 'time',
    time: {
        unit: 'hour',
        stepSize: 3, // I'm using 3 hour intervals here
        tooltipFormat: 'HH:mm',
    },
    ticks: {
        major: {
           enabled: true, // <-- This is the key line
           fontStyle: 'bold', //You can also style these values differently
           fontSize: 14 //You can also style these values differently
        },
    },
  }]
}

This produces an x axis like the follwong
This produces an x axis like this

Leave a comment