ag-charts-community
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
54 lines (53 loc) • 1.75 kB
TypeScript
import type { AgChartLegendListeners } from 'ag-charts-types';
import type { Scene } from '../../scene/scene';
import type { LegendSymbolOptions } from './legendSymbol';
export interface ChartLegend {
attachLegend(scene: Scene): void;
destroy(): void;
data: any;
listeners?: AgChartLegendListeners;
pagination?: {
currentPage: number;
setPage: (pageNumber: number) => void;
};
}
export type ChartLegendType = 'category' | 'gradient';
export type ChartLegendDatum<T extends ChartLegendType> = T extends 'category' ? CategoryLegendDatum : T extends 'gradient' ? GradientLegendDatum : never;
export interface BaseChartLegendDatum {
legendType: ChartLegendType;
seriesId: string;
enabled: boolean;
hideInLegend?: boolean;
}
export interface CategoryLegendDatum extends BaseChartLegendDatum {
legendType: 'category';
id: string;
itemId: any;
datum?: any;
symbol: LegendSymbolOptions;
/** Optional deduplication id - used to coordinate synced toggling of multiple items. */
legendItemName?: string;
label: {
text: string;
};
skipAnimations?: boolean;
isFixed?: boolean;
hideToggleOtherSeries?: true;
}
interface FormatterBoundSeries {
/** ID of the series for values on the related axis. */
seriesId: string;
/** Key used by the series for values on the related axis. */
key: string;
/** Optional name used by the series for values on the related axis. */
name?: string;
}
export interface GradientLegendDatum extends BaseChartLegendDatum {
legendType: 'gradient';
enabled: boolean;
seriesId: string;
series: FormatterBoundSeries[];
colorDomain: number[];
colorRange: string[];
}
export {};