Chartjs-Chart.js – Define custom y-axis scale

0👍

Try to use the callback property:

options = {
    scales: {
        yAxes: [{
            ticks: {
                beginAtZero: true,
                responsive: true,
                mainAspectRatio: false,
                callback: (v) => !!~[0, 0.005, 100000, 200000, 300000].indexOf(v) ? v : '',
                min: 0,
                max: 300000,
                step: 0.005
            }
        }]
    }
}

Leave a comment