Skip to content Skip to sidebar Skip to footer

Chart.js Timescale: Set Min And Max On Xaxes

How can I set a min and max on the xAxes? It works fine on the yAxes but on the xAxes it shows no behavior. My xAxes is using the type: 'time'. My labels for the xAxis are using th

Solution 1:

The properties you are looking for actually are in the time attribute :

options: {
    scales: {
        xAxes: [{
            type: "time",
            time: {
                min: 1471174953000,
                max: 1473853353000
            }
        }]
    }
}

Solution 2:

This was changed in 3.0

https://www.chartjs.org/docs/next/getting-started/v3-migration#options

scales.[x/y]Axes.time.max was renamed to scales[id].max
scales.[x/y]Axes.time.min was renamed to scales[id].min

Post a Comment for "Chart.js Timescale: Set Min And Max On Xaxes"