Behavior of log axis

46 views Asked by At

I heard Log values should always be a power of log base. I was playing with the log axis demo in highcharts http://jsfiddle.net/jjg4z79x/

I set min value of yaxis to 9. This shows unexpected values in labels of log axis 4, 10, 20, 40, 100, 200, 400, 1K

Expected labels: 10, 100, ...

Explanation: Minimum value of yaxis scale is 9. But label and ticks should be shown at the next integer power of logarithmic base. That is, 10. Similarly, all the other labels should be an integer power of logarithmic base. That is 10 power 1, 10 power 2, etc..,

Is this the correct behavior of logarithmic axis ?

1

There are 1 answers

0
morganfree On

You might confuse axis scale with labels displaying.

In fact, you can set the labels to be displayed in whatever value you want ( but greater than 0) with tickPositions/tickPositioner. Logarithmic axis means that the scale in a chart is logarithmic but it does not determine how labels are displayed.

 yAxis: {
  type: 'logarithmic',
  min: 9,
  startOnTick: false,
  endOnTick: false,
  tickPositions: [Math.log10(10), Math.log10(20), Math.log10(32), Math.log10(40)]
},

example: http://jsfiddle.net/gu3ogj13/