import type { AgActiveState } from '../api/activeState'; import type { AgAnnotation } from './annotationsOptions'; import type { Listener, SelectionState } from './callbackOptions'; import type { ContextDefault, DatumDefault, DatumKey, Ratio } from './types'; import type { AgAutoScaledAxes } from './zoomOptions'; interface AgChartEvent { type: T; event: Event; /** Callback context for this event. */ context?: TContext; } export interface AgPreventableEvent { /** Prevent the AG Charts built-in default event handlers from running. */ preventDefault(): void; } export interface AgNodeClickEvent extends AgChartEvent { /** Event type. */ type: TEvent; /** Series ID, as specified in `series.id` (or generated if not specified) */ seriesId: string; /** The unique identifier of the picked datum. */ itemId: string | number; /** The data ID key, if set on chart options. When present, `itemId` is a stable identifier. */ dataIdKey?: DatumKey; /** Datum from the chart or series data array. */ datum: TDatum; /** The current selection state of this datum. Set to `undefined` if the selection module is not enabled. */ selectionState?: SelectionState; /** xKey as specified on series options */ xKey?: DatumKey; /** yKey as specified on series options */ yKey?: DatumKey; /** sizeKey as specified on series options */ sizeKey?: DatumKey; /** labelKey as specified on series options */ labelKey?: DatumKey; /** colorKey as specified on series options */ colorKey?: DatumKey; /** angleKey as specified on series options */ angleKey?: DatumKey; /** calloutLabelKey as specified on series options */ calloutLabelKey?: DatumKey; /** sectorLabelKey as specified on series options */ sectorLabelKey?: DatumKey; /** radiusKey as specified on series options */ radiusKey?: DatumKey; } export interface AgSeriesVisibilityChange { /** Event type. */ type: 'seriesVisibilityChange'; /** Callback context for this event. */ context?: TContext; /** Series id */ seriesId: string; /** Legend item id - usually yKey value for cartesian series. */ itemId?: string | number; /** Human-readable description of the y-values. If supplied, matching items with the same value will be toggled together. */ legendItemName?: string; /** The new visibility status that the series is changing to. */ visible: boolean; } export type AgActiveChangeEventSource = 'state-change' | 'user-interaction'; export interface AgActiveChangeEvent extends AgActiveState, AgPreventableEvent { /** Event type. */ type: 'activeChange'; /** An indication of what triggered this event. */ source: AgActiveChangeEventSource; /** Callback context for this event. */ context?: TContext; /** Datum from the chart or series data array. */ datum?: TDatum; /** The data ID key, if set on chart options. When present, `activeItem.itemId` is a stable identifier. */ dataIdKey?: DatumKey; } export interface AgSelectionItemIds { /** Series ID, as specified in `series.id` (or generated if not specified). */ seriesId: string; /** The unique identifier of the datum as specified in `dataIdKey` if set (or generated if not specified). */ itemId: string | number; } export interface AgSelectionItem extends AgSelectionItemIds { /** Datum from the chart or series data array. */ datum: TDatum; } export type AgSelectionChangeEventSource = 'user-interaction' | 'api-call'; export interface AgSelectionChangeEvent extends AgPreventableEvent { /** Event type. */ type: 'selectionChange'; /** An indication of what triggered this event. */ source: AgSelectionChangeEventSource; /** Callback context for this event. */ context?: TContext; /** Items added to the selection in this change. */ added: AgSelectionItem[]; /** Items removed from the selection in this change. */ removed: AgSelectionItem[]; } export interface AgAnnotationsEvent { type: 'annotations'; annotations?: AgAnnotation[]; context?: TContext; } export type AgZoomEventSource = 'chart-update' | 'data-update' | 'range-check' | 'state-change' | 'sync' | 'user-interaction'; export interface AgZoomEvent { type: 'zoom'; source: AgZoomEventSource; rangeX?: AgZoomEventRange; rangeY?: AgZoomEventRange; ratioX: AgZoomEventRatio; ratioY: AgZoomEventRatio; autoScaledAxes?: AgAutoScaledAxes; context?: TContext; } export interface AgZoomEventRange { start?: Date | string | number; end?: Date | string | number; } export interface AgZoomEventRatio { start: Ratio; end: Ratio; } export type AgChartClickEvent = AgChartEvent<'click', TContext>; export type AgChartDoubleClickEvent = AgChartEvent<'doubleClick', TContext>; export type AgChartContextMenuEvent = AgChartEvent<'contextMenuEvent', TContext>; export type AgSeriesAreaContextMenuActionEvent = AgChartEvent<'seriesContextMenuAction', TContext>; export type AgNodeContextMenuActionEvent = AgNodeClickEvent<'nodeContextMenuAction', TDatum, TContext>; export interface AgBaseChartListeners { /** The listener to call when a node (marker, column, bar, tile or a pie sector) in any series is clicked. * Useful for a chart containing multiple series. */ seriesNodeClick?: Listener>; /** The listener to call when a node (marker, column, bar, tile or a pie sector) in any series is double-clicked. * Useful for a chart containing multiple series.*/ seriesNodeDoubleClick?: Listener>; /** The listener to call when a series visibility is changed. */ seriesVisibilityChange?: Listener>; /** The listener to call when the active state (highlight/tooltip) is changed. */ activeChange?: Listener>; /** The listener to call when data selection is changed */ selectionChange?: Listener>; /** The listener to call when the chart is clicked. */ click?: Listener>; /** The listener to call when the chart is double-clicked. */ doubleClick?: Listener>; /** The listener to call when the annotations are changed. */ annotations?: Listener>; /** The listener to call when the zoom is changed. */ zoom?: Listener>; } export interface AgSeriesListeners { /** The listener to call when a node (marker, column, bar, tile or a pie sector) in the series is clicked. */ seriesNodeClick?: Listener>; /** The listener to call when a node (marker, column, bar, tile or a pie sector) in the series is double-clicked. */ seriesNodeDoubleClick?: Listener>; } export {};