ag-charts-community
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
96 lines (95 loc) • 3.79 kB
TypeScript
import type { DynamicContext } from 'ag-charts-core';
import type { ChartRegistry } from '../../module/moduleContext';
import type { Scene } from '../../scene/scene';
import type { SwitchWidget } from '../../widget/switchWidget';
import type { MouseWidgetEvent } from '../../widget/widgetEvents';
import type { CategoryLegendDatum } from './legendDatum';
import { LegendMarkerLabel } from './legendMarkerLabel';
export declare class Legend {
private readonly ctx;
static readonly className = "Legend";
readonly id: string;
private readonly group;
private readonly itemSelection;
private readonly containerNode;
private readonly oldSize;
private pages;
private paginationItemsOffsetX;
private maxPageSize;
/** Item index to track on re-pagination, so current page updates appropriately. */
private paginationTrackingIndex;
private readonly truncatedItems;
private _data;
set data(value: CategoryLegendDatum[]);
get data(): CategoryLegendDatum[];
private syncProxyButtonStates;
private readonly contextMenuDatum?;
readonly size: [number, number];
private _visible;
set visible(value: boolean);
get visible(): boolean;
private readonly pagination;
private readonly cleanup;
private readonly domProxy;
private get opts();
constructor(ctx: DynamicContext<ChartRegistry>);
destroy(): void;
private updateGroupVisibility;
private updateItemSelection;
private isInteractive;
private checkInteractionState;
attachLegend(scene: Scene): void;
getItemLabel(datum: CategoryLegendDatum): string | number | Date | import("ag-charts-types").TextSegment[] | undefined;
/**
* The method is given the desired size of the legend, which only serves as a hint.
* The vertically oriented legend will take as much horizontal space as needed, but will
* respect the height constraints, and the horizontal legend will take as much vertical
* space as needed in an attempt not to exceed the given width.
* After the layout is done, the {@link size} will contain the actual size of the legend.
* If the actual size is not the same as the previous actual size, the legend will fire
* the 'layoutChange' event to communicate that another layout is needed, and the above
* process should be repeated.
* @param width
* @param height
*/
private calcLayout;
private isCustomMarker;
private calcSymbolsEnabled;
private calcSymbolsLengths;
private calculateMarkerWidth;
private updateMarkerLabel;
private updateContainer;
private truncate;
private updatePagination;
private calculatePagination;
private updatePositions;
private updatePageNumber;
update(): void;
private updateContextMenu;
private getLineStyles;
private getMarkerStyles;
private getContainerStyles;
private computePagedBBox;
private findNode;
private contextToggleVisibility;
private contextToggleOtherSeries;
onContextClick(widgetEvent: MouseWidgetEvent<'contextmenu'>, node: LegendMarkerLabel): void;
onClick(event: Event, datum: CategoryLegendDatum, proxyButton: SwitchWidget): void;
private getVisibleItemCount;
private doClick;
onDoubleClick(event: Event, datum: CategoryLegendDatum): void;
private doDoubleClick;
private toTooltipMeta;
private getTooltipContent;
onHover(event: FocusEvent | MouseEvent, node: LegendMarkerLabel): void;
onLeave(): void;
private clearHighlight;
private updateHighlight;
private onActiveLoadMemento;
private onLocaleChanged;
private positionLegend;
private positionLegendScene;
private positionLegendDOM;
private calculateLegendDimensions;
private cachedCallWithContext;
}