Chartjs-Limit numbers of labels on Chart.js in "smaller display only"

1👍

Here is one solution where we check if the the window size is less than 600px and return 12 else the tick limit is 24

    xAxes: [{
            type: 'time',
            ticks: {
                autoSkip: true,
                maxTicksLimit: getTickLimit()
            }
    }]
        
    function getTickLimit(){
        return window.innerWidth<600? 12:24
    }

Leave a comment