@mui/x-charts
Version:
The community edition of MUI X Charts components.
55 lines • 2.51 kB
TypeScript
import type { ScatterItemIdentifier } from "../../../../models/seriesType/index.js";
import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
import { type UseChartSeriesSignature } from "../../corePlugins/useChartSeries/index.js";
import { type ChartPluginSignature } from "../../models/index.js";
import { type UseChartCartesianAxisSignature } from "../useChartCartesianAxis/index.js";
import { type UseChartHighlightSignature } from "../useChartHighlight/index.js";
import { type UseChartInteractionSignature } from "../useChartInteraction/index.js";
import { type UseChartTooltipSignature } from "../useChartTooltip/index.js";
export interface UseChartVoronoiInstance {
/**
* Enable the voronoi computation.
*/
enableVoronoi: () => void;
/**
* Disable the voronoi computation.
*/
disableVoronoi: () => void;
}
export interface UseChartVoronoiState {
voronoi: {
/**
* Set to `true` when `VoronoiHandler` is active.
* Used to prevent collision with mouseEnter events.
*/
isVoronoiEnabled?: boolean;
};
}
export interface UseChartVoronoiParameters {
/**
* If true, the hit area interaction is disabled and falls back to hover events.
*/
disableHitArea?: boolean;
/**
* Defines the maximum distance between a scatter point and the pointer that triggers the interaction.
* If set to `'item'`, the radius is the `markerSize`.
* If `undefined`, the radius is assumed to be infinite.
*/
hitAreaRadius?: 'item' | number | undefined;
/**
* Callback fired when clicking close to an item.
* This is only available for scatter plot for now.
* @param {MouseEvent} event Mouse event caught at the svg level
* @param {ScatterItemIdentifier} scatterItemIdentifier Identify which item got clicked
*/
onItemClick?: (event: MouseEvent, scatterItemIdentifier: ScatterItemIdentifier) => void;
}
export type UseChartVoronoiDefaultizedParameters = Pick<UseChartVoronoiParameters, 'hitAreaRadius' | 'disableHitArea' | 'onItemClick'>;
export type UseChartClosestPointSignature<SeriesType extends ChartSeriesType = ChartSeriesType> = ChartPluginSignature<{
instance: UseChartVoronoiInstance;
state: UseChartVoronoiState;
params: UseChartVoronoiParameters;
defaultizedParams: UseChartVoronoiDefaultizedParameters;
dependencies: [UseChartSeriesSignature, UseChartCartesianAxisSignature];
optionalDependencies: [UseChartInteractionSignature, UseChartHighlightSignature<SeriesType>, UseChartTooltipSignature];
}>;