ag-charts-community
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
42 lines (41 loc) • 1.84 kB
TypeScript
import type { MementoOriginator, ReactiveState } from 'ag-charts-core';
import { type AreExact } from 'ag-charts-core';
import type { AgInitialStateLegendOptions as DefectAgInitialStateLegendOptions } from 'ag-charts-types';
import type { ChartState } from '../chartState';
import type { CategoryLegendDatum } from './legendDatum';
type AgInitialStateLegendOptions = AreExact<DefectAgInitialStateLegendOptions['itemId'], string | undefined> extends false ? never : Omit<DefectAgInitialStateLegendOptions, 'itemId'> & {
itemId?: string | number;
};
type LegendDataMemento = AgInitialStateLegendOptions[];
export declare class LegendManager implements MementoOriginator<LegendDataMemento> {
mementoOriginatorKey: "legend";
private readonly chartState;
constructor(ctx: {
chartState: ReactiveState<ChartState>;
});
createMemento(): {
visible: boolean;
seriesId: string;
itemId: string | number;
legendItemName: string | undefined;
}[];
guardMemento(blob: unknown): blob is LegendDataMemento | undefined;
restoreMemento(_version: string, _mementoVersion: string, memento: LegendDataMemento | undefined): void;
private getRestoredData;
private warnFixed;
private get legendDataRecord();
updateData(seriesId: string, data?: CategoryLegendDatum[]): void;
clearData(): void;
toggleItem(enabled: boolean, seriesId: string, itemId?: any, legendItemName?: string): void;
getData(seriesId?: string): CategoryLegendDatum[];
getDatum({ seriesId, itemId }?: {
seriesId?: string;
itemId?: any;
}): CategoryLegendDatum | undefined;
getSeriesEnabled(seriesId: string): boolean | undefined;
getItemEnabled({ seriesId, itemId }?: {
seriesId?: string;
itemId?: string | number;
}): boolean;
}
export {};