ag-charts-community
Version:
Advanced Charting / Charts supporting Javascript / Typescript / React / Angular / Vue
66 lines (65 loc) • 2.57 kB
TypeScript
import type { DynamicContext, NormalisedChartCaptionOptions, NormalisedTextOrSegments } from 'ag-charts-core';
import type { ChartRegistry } from '../module/moduleContext';
import { RotatableText } from '../scene/shape/text';
import type { CaptionLike } from './captionLike';
type CaptionNodeDatum = {
visible: boolean;
text: NormalisedTextOrSegments | undefined;
textBaseline: string;
x: number;
y: number;
rotationCenterX: number;
rotationCenterY: number;
rotation: number;
};
export type ChartCaptionKey = 'title' | 'subtitle' | 'footnote';
/** Build the font spec (FontOptions shape) consumed by text measurers from a caption's options. */
export declare function captionFont(opts: NormalisedChartCaptionOptions): {
fontSize: number;
fontStyle: import("ag-charts-types").FontStyle | undefined;
fontWeight: import("ag-charts-types").FontWeight | undefined;
fontFamily: string;
};
/**
* Chart-level caption (title/subtitle/footnote). Reads its option subtree from
* `ctx.chartState.getValue('options', key)` and applies values to its scene node
* during layout. Mirrors the Legend/Zoom pattern.
*
* For axis/series titles (which use `Caption`), the BaseProperties-based
* `Caption` class continues to be used.
*/
export declare class ChartCaption implements CaptionLike {
private readonly ctx;
private readonly key;
static readonly className = "ChartCaption";
readonly id: string;
readonly node: RotatableText<CaptionNodeDatum>;
get opts(): NormalisedChartCaptionOptions;
get enabled(): boolean;
get text(): NormalisedTextOrSegments | undefined;
get padding(): number;
private truncated;
private proxyText?;
private proxyTextListeners?;
private lastProxyTextContent?;
private lastProxyBBox?;
constructor(ctx: DynamicContext<ChartRegistry>, key: ChartCaptionKey);
/**
* Apply the current options subtree to the scene node. Called from
* `ChartCaptions.positionCaptions` before each layout so visible/text/font
* properties land before render.
*/
applyToNode(): void;
registerInteraction(moduleCtx: DynamicContext<ChartRegistry>, where: 'beforebegin' | 'afterend'): () => void;
computeTextWrap(containerWidth: number, containerHeight: number): void;
private updateA11yText;
private getEffectiveTooltipVisible;
private getTooltipContent;
private showTooltip;
private handleMouseMove;
private handleFocus;
private handleTooltipHide;
destroy(): void;
private destroyProxyText;
}
export {};