import React, { Component, type ReactElement, type RefObject } from 'react'; import { type ChartModel, type ChartModelSettings, type FilterMap } from '@deephaven/chart'; import type PlotlyType from 'plotly.js'; import type { PlotMouseEvent, PlotSelectionEvent, ClickAnnotationEvent, LegendClickEvent } from 'plotly.js'; import { type DashboardPanelProps, type PanelComponent, type PanelMetadata } from '@deephaven/dashboard'; import { type InputFilter, type ColumnName, type TableSettings } from '@deephaven/iris-grid'; import type { dh } from '@deephaven/jsapi-types'; import { type WorkspaceSettings } from '@deephaven/redux'; import { Pending } from '@deephaven/utils'; import { type ColumnMap } from './ChartFilterOverlay'; import { type SelectorColumn } from './ChartColumnSelectorOverlay'; import './ChartPanel.scss'; import { type Link, type LinkFilterMap } from '../linker/LinkerUtils'; import { type ColumnSelectionValidator } from '../linker/ColumnSelectionValidator'; import { type WidgetPanelDescriptor } from './WidgetPanelTypes'; export type InputFilterMap = Map; export type LinkedColumnMap = Map; /** @deprecated Use `PanelMetadata` instead, providing a `name` instead of `figure` */ export interface ChartPanelFigureMetadata extends PanelMetadata { /** * @deprecated use `name` instead */ figure?: string; } export interface ChartPanelTableMetadata extends PanelMetadata { table: string; sourcePanelId: string; settings: { isLinked: boolean; title: string; xAxis: string; series: string[]; type: keyof typeof dh.plot.SeriesPlotStyle; }; tableSettings: TableSettings; } export type ChartPanelMetadata = PanelMetadata | ChartPanelFigureMetadata | ChartPanelTableMetadata; type Settings = Record; export interface GLChartPanelState { filterValueMap?: [string, unknown][]; settings: Partial; tableSettings?: TableSettings; irisGridState?: { advancedFilters: unknown; quickFilters: unknown; sorts: unknown; }; irisGridPanelState?: { partitionColumns: string[]; partitions: unknown[]; }; table?: string; figure?: string; } interface OwnProps extends DashboardPanelProps { metadata: ChartPanelMetadata; /** Function to build the ChartModel used by this ChartPanel. Can return a promise. */ makeModel: () => Promise; localDashboardId: string; Plotly?: typeof PlotlyType; /** * The plot container div. * The ref will be undefined on initial render if the chart needs to be loaded. */ containerRef?: React.Ref; panelState?: GLChartPanelState; /** * Optional Plotly event handlers forwarded to the underlying Chart/Plotly * component. Used by plugins (e.g. plotly-express) to receive chart events. */ onPlotlyRelayout?: (changes: Record) => void; onPlotlyClick?: (data: Readonly) => void; onPlotlyDoubleClick?: () => void; onPlotlySelected?: (data: Readonly | undefined) => void; onPlotlyDeselect?: () => void; onPlotlyClickAnnotation?: (data: Readonly) => void; onPlotlyLegendClick?: (data: Readonly) => boolean; onPlotlyLegendDoubleClick?: (data: Readonly) => boolean; onPlotlyWebGlContextLost?: () => void; onPlotElementChange?: (element: HTMLElement | null) => void; } interface StateProps { inputFilters: InputFilter[]; links: Link[]; isLinkerActive: boolean; source?: dh.Table; sourcePanel?: PanelComponent; columnSelectionValidator?: ColumnSelectionValidator; settings: Partial; } interface DispatchProps { setActiveTool: (tool: string) => void; setDashboardIsolatedLinkerPanelId: (id: string, secondParam: undefined) => void; } interface ChartPanelState { settings: Partial; error?: unknown; isActive: boolean; isDisconnected: boolean; isLoading: boolean; isLoaded: boolean; isLinked: boolean; /** * Map of all non-empty filters applied to the chart. * Initialize the filter map to the previously stored values; input filters will be applied after load. */ filterMap: FilterMap; /** * Map of filter values set from links, stored in panelState. * Combined with inputFilters to get applied filters (filterMap). */ filterValueMap: FilterMap; model?: ChartModel; columnMap: ColumnMap; panelState?: GLChartPanelState; } interface LoadState { isLoading: boolean; } export type ChartPanelProps = OwnProps & StateProps & DispatchProps & React.RefAttributes; export declare class ChartPanel extends Component { static defaultProps: { columnSelectionValidator: null; isLinkerActive: boolean; source: null; sourcePanel: null; panelState: null; settings: {}; containerRef: null; }; static displayName: string; static COMPONENT: string; constructor(props: ChartPanelProps); componentDidMount(): void; componentDidUpdate(prevProps: ChartPanelProps, prevState: ChartPanelState): void; componentWillUnmount(): void; panelContainer: RefObject; pending: Pending; initModel(): void; getWaitingInputMap: (isFilterRequired: boolean, columnMap: ColumnMap, filterMap: FilterMap) => Map; getWaitingFilterMap: (isFilterRequired: boolean, columnMap: ColumnMap, filterMap: FilterMap, linkedColumnMap: LinkedColumnMap, inputFilterMap: InputFilterMap) => Map; getInputFilterColumnMap: (columnMap: ColumnMap, inputFilters: InputFilter[]) => Map; getLinkedColumnMap: (columnMap: ColumnMap, links: Link[]) => Map; getSelectorColumns: (columnMap: ColumnMap, linkedColumnMap: LinkedColumnMap, columnSelectionValidator?: ColumnSelectionValidator) => { name: string; type: string; isValid: boolean; isActive: boolean; }[]; getWidgetPanelDescriptor: (metadata: ChartPanelProps["metadata"]) => WidgetPanelDescriptor; startListeningToSource(table: dh.Table): void; stopListeningToSource(table: dh.Table): void; loadModelIfNecessary(): void; isHidden(): boolean; handleColumnSelected(columnName: string): void; handleColumnMouseEnter({ type, name }: SelectorColumn): void; handleColumnMouseLeave(): void; handleDisconnect(): void; handleFilterAdd(columns: InputFilter[]): void; handleOpenLinker(): void; handleReconnect(): void; handleLoadSuccess(model: ChartModel): void; handleLoadError(error: unknown): void; handleSourceColumnChange(): void; handleSourceFilterChange(): void; handleSourceSortChange(): void; updateModelFromSource(): void; updatePanelState(): void; handleError(): void; handleSettingsChanged(update: Partial): void; handleHide(): void; handleShow(): void; handleTabBlur(): void; handleTabFocus(): void; handleUpdate({ isLoading }: LoadState): void; handleClearAllFilters(): void; /** * Create an input filter panel for the provided column * @param column The column to create the input filter for */ openInputFilter(column: InputFilter): void; setActive(isActive: boolean): void; sendColumnChange(): void; getCoordinateForColumn(columnName: ColumnName): [number, number] | null; /** * Set chart filters based on the filter map * @param filterMapParam Filter map */ setFilterMap(filterMapParam: LinkFilterMap): void; unsetFilterValue(columnName: ColumnName): void; updateChangedInputFilters(inputFilters: InputFilter[], prevInputFilters: InputFilter[]): void; updateInputFilters(inputFilters: InputFilter[], forceUpdate?: boolean): void; deleteInputFilters(inputFilters: InputFilter[], forceUpdate?: boolean): void; updateColumnFilters(): void; updateFilters(): void; /** * Removes any set filter values that are no longer part of the model */ pruneFilterMaps(): void; render(): ReactElement; } declare const ConnectedChartPanel: import("react-redux").ConnectedComponent, "glEventHub" | "glContainer" | "metadata" | "makeModel" | "localDashboardId" | "Plotly" | "onPlotlyRelayout" | "onPlotlyClick" | "onPlotlyDoubleClick" | "onPlotlySelected" | "onPlotlyDeselect" | "onPlotlyClickAnnotation" | "onPlotlyLegendClick" | "onPlotlyLegendDoubleClick" | "onPlotlyWebGlContextLost" | "onPlotElementChange" | "inputFilters" | "links" | keyof DispatchProps | keyof React.RefAttributes> & { source?: dh.Table | undefined; settings?: Partial | undefined; containerRef?: React.Ref | undefined; panelState?: GLChartPanelState | undefined; isLinkerActive?: boolean | undefined; sourcePanel?: PanelComponent | undefined; columnSelectionValidator?: ColumnSelectionValidator | undefined; } & {}, "source" | "settings" | "inputFilters" | "links" | "isLinkerActive" | "sourcePanel" | "columnSelectionValidator" | "setActiveTool" | "setDashboardIsolatedLinkerPanelId"> & OwnProps>; export default ConnectedChartPanel; //# sourceMappingURL=ChartPanel.d.ts.map