@mui/x-charts
Version:
The community edition of MUI X Charts components.
47 lines • 2.07 kB
TypeScript
import { type AxisId, type AxisScaleConfig, type D3Scale, type ScaleName } from "../models/axis.js";
/**
* For a given scale return a function that map value to their position.
* Useful when dealing with specific scale such as band.
* @param {D3Scale} scale The scale to use
* @returns {(value: any) => number} A function that map value to their position
*/
export declare function getValueToPositionMapper<Domain extends {
toString(): string;
} = {
toString(): string;
}, Range = number>(scale: D3Scale<Domain, Range>): (value: any) => number;
/**
* Get the X scale.
*
* @param axisId - The axis identifier. Can be:
* - A string or number matching the axis ID defined in the chart's `xAxis` prop
* - Undefined to get the default (first) X axis
* @returns The X axis scale
*/
export declare function useXScale<S extends ScaleName>(axisId?: AxisId): AxisScaleConfig[S]['scale'];
/**
* Get the Y scale.
*
* @param axisId - The axis identifier. Can be:
* - A string or number matching the axis ID defined in the chart's `yAxis` prop
* - Undefined to get the default (first) Y axis
* @returns The Y axis scale
*/
export declare function useYScale<S extends ScaleName>(axisId?: AxisId): AxisScaleConfig[S]['scale'];
/**
* Get the rotation scale.
*
* @param axisId - The axis identifier. Can be:
* - A string or number matching the axis ID defined in the chart's `rotationAxis` prop
* - Undefined to get the default rotation axis
* @returns The rotation axis scale, or undefined if not found
*/
export declare function useRotationScale<S extends ScaleName>(axisId?: number | string): AxisScaleConfig[S]['scale'] | undefined;
/**
* Get the radius scale.
* @param axisId - The axis identifier. Can be:
* - A string or number matching the axis ID defined in the chart's `radiusAxis` prop
* - Undefined to get the default radius axis
* @returns The radius axis scale, or undefined if not found
*/
export declare function useRadiusScale<S extends ScaleName>(axisId?: number | string): AxisScaleConfig[S]['scale'] | undefined;