src/getNiceTickValues.js
function getFormatStep(roughStep, allowDecimals, correctionFactor) {
  if (roughStep.lte(0)) { return new Decimal(0); }

  const digitCount = Arithmetic.getDigitCount(roughStep.toNumber());
  // The ratio between the rough step and the smallest number which has a bigger
  // order of magnitudes than the rough step
  const digitCountValue = new Decimal(10).pow(digitCount);
  const stepRatio = roughStep.div(digitCountValue);
  // When an integer and a float multiplied, the accuracy of result may be wrong
  const stepRatioScale = digitCount !== 1 ? 0.05 : 0.1;
  const amendStepRatio = new Decimal(
    Math.ceil(stepRatio.div(stepRatioScale).toNumber()),
  ).add(correctionFactor).mul(stepRatioScale);

  const formatStep = amendStepRatio.mul(digitCountValue);

  return allowDecimals ? formatStep : new Decimal(Math.ceil(formatStep));
}
function getFormatStep(roughStep, allowDecimals, correctionFactor) {
  if (roughStep.lte(0)) { return new Decimal(0); }

  const digitCount = Arithmetic.getDigitCount(roughStep.toNumber());
  // The ratio between the rough step and the smallest number which has a bigger
  // order of magnitudes than the rough step
  const digitCountValue = new Decimal(10).pow(digitCount);
  const stepRatio = roughStep.div(digitCountValue);
  // When an integer and a float multiplied, the accuracy of result may be wrong
  const stepRatioScale = digitCount !== 1 ? 0.05 : 0.1;
  const amendStepRatio = new Decimal(
    Math.ceil(stepRatio.div(stepRatioScale).toNumber()),
  ).add(correctionFactor).mul(stepRatioScale);

  const formatStep = amendStepRatio.mul(digitCountValue);

  return allowDecimals ? formatStep : new Decimal(Math.ceil(formatStep));
}
function getFormatStep ( roughStep , allowDecimals , correctionFactor ) { if ( roughStep . lte ( 0 ) ) { return new Decimal ( 0 ) ; } const digitCount = Arithmetic . getDigitCount ( roughStep . toNumber ( ) ) ; // The ratio between the rough step and the smallest number which has a bigger // order of magnitudes than the rough step const digitCountValue = new Decimal ( 10 ) . pow ( digitCount ) ; const stepRatio = roughStep . div ( digitCountValue ) ; // When an integer and a float multiplied, the accuracy of result may be wrong const stepRatioScale = digitCount !== 1 ? 0.05 : 0.1 ; const amendStepRatio = new Decimal ( Math . ceil ( stepRatio . div ( stepRatioScale ) . toNumber ( ) ) , ) . add ( correctionFactor ) . mul ( stepRatioScale ) ; const formatStep = amendStepRatio . mul ( digitCountValue ) ; return allowDecimals ? formatStep : new Decimal ( Math . ceil ( formatStep ) ) ; }
Calculate the step which is easy to understand between ticks, like 10, 20, 25

@param  {Decimal} roughStep        The rough step calculated by deviding the
difference by the tickCount
@param  {Boolean} allowDecimals    Allow the ticks to be decimals or not
@param  {Integer} correctionFactor A correction factor
@return {Decimal} The step which is easy to understand between two ticks
Calculate the step which is easy to understand between ticks like 10 20 25