@mui/x-charts
Version:
The community edition of MUI X Charts components.
43 lines • 2.03 kB
text/typescript
import { type SeriesId } from "../models/seriesType/common.mjs";
import { type CartesianChartSeriesType, type ChartsSeriesConfig, type PolarChartSeriesType } from "../models/seriesType/config.mjs";
import { type ComputedAxis, type PolarAxisDefaultized, type AxisId } from "../models/axis.mjs";
import { type ChartsLabelMarkProps } from "../ChartsLabel/index.mjs";
export interface UseAxesTooltipReturnValue<SeriesType extends CartesianChartSeriesType | PolarChartSeriesType = Exclude<CartesianChartSeriesType, 'ohlc'> | PolarChartSeriesType, AxisValueT extends string | number | Date = string | number | Date> {
axisDirection: SeriesType extends CartesianChartSeriesType ? 'x' | 'y' : 'rotation' | 'radius';
mainAxis: SeriesType extends CartesianChartSeriesType ? ComputedAxis : PolarAxisDefaultized;
axisId: AxisId;
axisValue: AxisValueT;
axisFormattedValue: string;
dataIndex: number;
seriesItems: SeriesItem<SeriesType>[];
}
export interface UseAxesTooltipParams {
/**
* The axis directions to consider.
* If not defined, all directions are considered
*/
directions?: ('x' | 'y' | 'rotation')[];
}
export interface SeriesItem<T extends CartesianChartSeriesType | PolarChartSeriesType> {
seriesId: SeriesId;
color: string;
value: T extends 'ohlc' ? {
open: number;
high: number;
low: number;
close: number;
} | null : ChartsSeriesConfig[T]['valueType'];
formattedValue: T extends 'ohlc' ? {
open: string | null;
high: string | null;
low: string | null;
close: string | null;
} : string;
formattedLabel: string | null;
markType: ChartsLabelMarkProps['type'];
markShape: ChartsLabelMarkProps['markShape'];
}
/**
* Returns the axes to display in the tooltip and the series item related to them.
*/
export declare function useAxesTooltip<SeriesType extends CartesianChartSeriesType | PolarChartSeriesType = Exclude<CartesianChartSeriesType, 'ohlc'> | PolarChartSeriesType>(params?: UseAxesTooltipParams): UseAxesTooltipReturnValue<SeriesType>[] | null;