One-step ticks only when the axis spans five or less, counted from zero
This commit is contained in:
@@ -440,7 +440,7 @@ export function ageShare(r: Reading, axis: string): Figure {
|
||||
export function valueAxis(values: Iterable<number | null | undefined>) {
|
||||
const found = [...values].filter((v): v is number => v != null && Number.isFinite(v));
|
||||
const counts = found.every(Number.isInteger);
|
||||
const narrow = found.length > 0 && Math.max(...found) - Math.min(...found) <= 5;
|
||||
const narrow = found.length > 0 && Math.max(...found) - Math.min(0, ...found) <= 5;
|
||||
return {
|
||||
type: 'linear' as const,
|
||||
tickformat: counts ? 'd' : SHORT,
|
||||
|
||||
Reference in New Issue
Block a user