Logarithmic ticks callback breaks autoSkip

I use a callback to localize the number format of the y-axis ticks on a line chart. For a logarithmic scale, it appears using a callback overrides the built-in autoSkip feature, and the ticks end up overlapping each other.

Logarithmic chart with default options:
http://codepen.io/MusikAnimal/pen/LZRoMN
This shows fine, except the numbers are in exponential format, when I need the full numbers with delimiters.

The same logarithmic chart with a callback:
http://codepen.io/MusikAnimal/pen/MejdXL
The labels overlap. autoSkip seems to have no effect, nor does maxTicksLimit.

Author: Fantashit

1 thought on “Logarithmic ticks callback breaks autoSkip

  1. No problem, thank you for the assistance nonetheless!

    For anyone else reading this, I ended up making my own callback which seems to work well:

    callback: (value, index, arr) => {
      const remain = value / (Math.pow(10, Math.floor(Chart.helpers.log10(value))));
    
      if (remain === 1 || remain === 2 || remain === 5 || index === 0 || index === arr.length - 1) {
        return (new Number(value)).toLocaleString();
      } else {
        return '';
      }
    }
    

Comments are closed.