import { CommonProps, type Styleable } from "@trackunit/react-components"; import type { ECElementEvent, ECharts, EChartsOption } from "echarts"; import { ReactElement } from "react"; /** * https://echarts.apache.org/en/api.html#events */ export interface BrushArea { brushType: "rect" | "polygon" | "lineX" | "lineY"; range?: Array | Array>; coordRange?: Array | Array>; coordRanges?: Array | Array>>; panelId?: string; } export type BrushEvent = { areas: Array; }; export type EventName = "click" | "dblclick" | "mousewheel" | "mouseout" | "mouseover" | "mouseup" | "mousedown" | "mousemove" | "contextmenu" | "drag" | "dragstart" | "dragend" | "dragenter" | "dragleave" | "dragover" | "drop" | "brush" | "brushselected" | "brushend" | "globalout" | "datarangeselected" | "legendselectchanged" | "datazoom"; export interface EChartProps extends CommonProps, Styleable { /** * Option values for EChart. */ option: EChartsOption; /** * Called when the chart instance is ready. */ onChartReady?: (chart: ECharts) => void; /** * onClick event handler. */ onClick?: (event: ECElementEvent) => void; /** * Event handlers for the chart. */ onEvents?: Partial void>, "brush" | "brushselected"> & { brush: (event: BrushEvent) => void; brushselected: (event: BrushEvent) => void; }>; /** * Whether to merge with previous option. */ notMerge?: boolean; /** * Type of renderer used. Either "svg" or "canvas". * Default is "canvas" for better performance. * Some components (like UtilizationMultiDayChart) require "svg" for specific rendering needs. */ renderer?: "svg" | "canvas"; } /** * A React wrapper for ECharts that handles initialization, events, and cleanup. */ export declare const EChart: ({ option, style, className, onChartReady, onClick, onEvents, notMerge, renderer, "data-testid": dataTestId, }: EChartProps) => ReactElement;