UNPKG

@mui/x-charts

Version:

The community edition of the charts components (MUI X).

47 lines (46 loc) 1.63 kB
import { D3Scale } from '../models/axis'; export interface TickParams { /** * Maximal step between two ticks. * When using time data, the value is assumed to be in ms. * Not supported by categorical axis (band, points). */ tickMaxStep?: number; /** * Maximal step between two ticks. * When using time data, the value is assumed to be in ms. * Not supported by categorical axis (band, points). */ tickMinStep?: number; /** * The number of ticks. This number is not guaranted. * Not supported by categorical axis (band, points). */ tickNumber?: number; /** * Defines which ticks are displayed. Its value can be: * - 'auto' In such case the ticks are computed based on axis scale and other parameters. * - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property. * - an array containing the values where ticks should be displayed. * @default 'auto' */ tickInterval?: 'auto' | ((value: any, index: number) => boolean) | any[]; } export declare function getTickNumber(params: TickParams & { range: any[]; domain: any[]; }): number; export type TickItemType = { /** * This property is undefined only if it's the tick closing the last band */ value?: any; formattedValue?: string; offset: number; labelOffset: number; }; declare function useTicks(options: { scale: D3Scale; valueFormatter?: (value: any) => string; } & Pick<TickParams, 'tickNumber' | 'tickInterval'>): TickItemType[]; export default useTicks;