Chartjs-Chart.Js – Specify x labels to be displayed that is not possible with stepSize option

0👍

I was able to resolve this problem including a callback function.

ticks: {
                    beginAtZero: true,
                    autoSkip: false,
                    min: 0,
                    max: 0.5,
                    stepSize: 0.1,
                    callback: function(label, index, labels) {
                        if(label == 0 || label == 0.1 || label == 0.3 || label == 0.5){
                            return label;
                        }else{
                            return '';
                        }
                    }
                }

Leave a comment