File size: 394 Bytes
1e92f2d | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | import { ScaleBandSpec, ScaleBand, computeScale } from '@nivo/scales'
/**
* Generates indexed scale.
*/
export const getIndexScale = (
groups: string[],
padding: number,
indexScale: ScaleBandSpec,
size: number,
axis: 'x' | 'y'
) => {
return (
computeScale(indexScale, { all: groups, min: 0, max: 0 }, size, axis) as ScaleBand<string>
).padding(padding)
}
|