Chartjs-Chart.js: Create custom major ticks on log x-Axis?

0👍

I have found my solution. In addition to defining my ticks (as in the code example above [inside the “callback” function]) I had to alter my ticks afterwards like this:

   [...]
   if(value==0.63) {
        return "0.630";
        }
      } //closing bracket from "callback: function"  
    }, //closing bracket from "ticks" section

    //new code that did the trick
    afterBuildTicks: function(pckBarChart) {    
            pckBarChart.ticks = [];
            pckBarChart.ticks.push(0.1);
            pckBarChart.ticks.push(0.2);
            pckBarChart.ticks.push(0.315);
            pckBarChart.ticks.push(0.4);                        
            pckBarChart.ticks.push(0.63);
    }

I found this here:
StackOverflow: chart.js not allowing y axis steps with logarithmic scale

Leave a comment