in src/axisHelper.ts [815:845]
export function getBestNumberOfTicks(
min: number,
max: number,
valuesMetadata: DataViewMetadataColumn[],
maxTickCount: number,
isDateTime?: boolean): number {
if (isNaN(min) || isNaN(max)) {
return DefaultBestTickCount;
}
if (maxTickCount <= 1 || (max <= 1 && min >= -1)) {
return maxTickCount;
}
if (min === max) {
// datetime needs to only show one tick value in this case so formatting works correctly
if (!!isDateTime) {
return 1;
}
return DefaultBestTickCount;
}
if (hasNonIntegerData(valuesMetadata)) {
return maxTickCount;
}
// e.g. 5 - 2 + 1 = 4, => [2,3,4,5]
return Math.min(max - min + 1, maxTickCount);
}