For the same reasons it’s needed in bar and line/scatter. Maybe there’s a way to do that already? Tried a ticks callback from line, bar but couldn’t make it work. Option for scale type with defaults as for line, bar would be easier.
1 thought on “Radar charts need a logarithmic scale type option”
Comments are closed.
I was able to cheat a logarithmic scale doing the following:
So on the data, before I gave it to the chart, I used
Math.log(data) / Math.log(2)
Then in the chart options (edited for brevity), I did….
options: {
scale: {
ticks: {
userCallback: function (value, index, values) {
Math.round(Math.pow(2,value)); //SO this will make the scale a logrithmic
},
}
},
tooltips: {
callbacks: {
label: function(tooltipItems, data) {
return fullLabelArray[tooltipItems.index] +’: ‘ + Math.pow(2,tooltipItems.yLabel).toFixed(2); //This will make the tooltip data back to the original value
}
}
}
Just posting this in case it will help someone in the future.