Chartjs-Chart.js โ€“ Scale of secondary Y axis

1๐Ÿ‘

I think you just can set a range for the second y-axis, like this:
Maybe set a value with relation to your first y-axis
โ€“> suggestedMin โ€“ suggestedMax

options: {
    scales: {
        yAxes: [{
            ticks: {
                suggestedMin: 50,
                suggestedMax: 100
            }
        }]
    }
}

In the first y-axis you can access the values of y-axis by the callback-function see below:

yAxes : [{
            ticks : {
                       beginAtZero : true,
                       **callback** : function(value,index,values){
                                  yAxesticks = values;
                                  return value;
                            }
                    }
          }] 

The first value in the array should be the highest one.

Leave a comment