UNPKG

@mui/x-charts

Version:

The community edition of MUI X Charts components.

55 lines 2.52 kB
import type { ScatterItemIdentifier } from "../../../../models/seriesType/index.mjs"; import type { ChartSeriesType } from "../../../../models/seriesType/config.mjs"; import { type UseChartSeriesSignature } from "../../corePlugins/useChartSeries/index.mjs"; import { type ChartPluginSignature } from "../../models/index.mjs"; import { type UseChartCartesianAxisSignature } from "../useChartCartesianAxis/index.mjs"; import { type UseChartHighlightSignature } from "../useChartHighlight/index.mjs"; import { type UseChartInteractionSignature } from "../useChartInteraction/index.mjs"; import { type UseChartTooltipSignature } from "../useChartTooltip/index.mjs"; 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]; }>;