import type { IAnimation } from "./util/Animation"; import type { Entity } from "./util/Entity"; import type { Sprite } from "./render/Sprite"; import type { Theme } from "./Theme"; import type { IPoint } from "./util/IPoint"; import type { IRenderer, IRendererClass } from "./render/backend/Renderer"; import type { Timezone } from "./util/Timezone"; import { Container } from "./render/Container"; import { Text } from "./render/Text"; import { HorizontalLayout } from "./render/HorizontalLayout"; import { VerticalLayout } from "./render/VerticalLayout"; import { GridLayout } from "./render/GridLayout"; import { IDisposer } from "./util/Disposer"; import { InterfaceColors } from "./util/InterfaceColors"; import { Tooltip } from "./render/Tooltip"; import { NumberFormatter } from "./util/NumberFormatter"; import { DateFormatter } from "./util/DateFormatter"; import { DurationFormatter } from "./util/DurationFormatter"; import { ILocale, Language } from "./util/Language"; import { Events, EventDispatcher } from "./util/EventDispatcher"; /** * @ignore */ interface IParent extends Entity { _prepareChildren(): void; _updateChildren(): void; _childrenUpdt: boolean; _childrenPrep: boolean; } interface IBounds extends Entity { depth(): number; _updateBounds(): void; } export interface ISize { width: number; height: number; } export interface IRootEvents { /** * A frame started rendering. `timestamp` is the frame's time in milliseconds. */ framestarted: { timestamp: number; }; /** * A frame finished rendering. `timestamp` is the frame's time in milliseconds. */ frameended: { timestamp: number; }; } export interface IRootSettings { /** * Draws the chart at a resolution of `1` on iOS and iPadOS devices instead * of the screen's pixel ratio, to stay within their memory limits. Set to * `false` for sharper charts there. * * @default true */ useSafeResolution?: boolean; /** * Extra space in pixels on each side of the chart where tooltips can still * be drawn, letting them go outside the chart's container. * * @since 5.2.24 */ tooltipContainerBounds?: { top: number; left: number; right: number; bottom: number; }; /** * Set to `false` to disable all accessibility features. * * NOTE: once disabled, accessibility cannot be re-enabled on a live `Root` object. * * @default true * @since 5.3.0 */ accessible?: boolean; /** * If set to `true`, the parent inner `
` element will become a focusable * element. * * @since 5.3.17 * @default false * @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/#Accessibility_of_Root_element} for more info */ focusable?: boolean; /** * Distance between focused element and its highlight square in pixels. * * @since 5.6.0 * @default 2 */ focusPadding?: number; /** * If set to some string, it will be used as inner `
` ARIA-LABEL. * * Should be used in conjunction with `focusable`. * * @since 5.3.17 * @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/#Accessibility_of_Root_element} for more info */ ariaLabel?: string; /** * Allows setting a "role" for the inner `
`. * * @since 5.3.17 * @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/#Accessibility_of_Root_element} for more info */ role?: string; /** * A function that returns the width and height in pixels to draw the chart * at, given the container's measured box. It runs when the chart is created * and on every resize. */ calculateSize?: (dimensions: DOMRect) => ISize; /** * Cleans potentially malicious code out of HTML content (`html` and * `labelHTML` settings, HTML tooltips, modals, export menu labels) before * it goes on the page. * * Turn it off only if you trust all HTML content: unsanitized HTML from * untrusted data can lead to XSS attacks. * * @default true * @since 5.19.0 */ sanitizeHTML?: boolean; /** * Font family for all labels. It overrides the theme's, but not a * `fontFamily` set on a label itself. * * @since 5.20.2 */ fontFamily?: string; /** * Font size for all labels: a number in pixels, or a CSS size such as * `"1.2em"`. It overrides the theme's, but not a `fontSize` set on a label * itself. * * @since 5.20.2 */ fontSize?: number | string; /** * Font weight for all labels. It overrides the theme's, but not a * `fontWeight` set on a label itself. * * @since 5.20.2 */ fontWeight?: "normal" | "bold" | "bolder" | "lighter" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"; /** * The renderer that draws the chart. Defaults to `Root.defaultRenderer`, * which is `CanvasRenderer` unless changed. * * To draw with SVG, use `am5.SVGRenderer`: * * ```TypeScript * const root = am5.Root.new("chartdiv", { * renderer: am5.SVGRenderer * }); * ``` * ```JavaScript * var root = am5.Root.new("chartdiv", { * renderer: am5.SVGRenderer * }); * ``` * * Can only be set when the Root is created. * * @since 5.21.0 */ renderer?: IRendererClass; /** * Makes the chart's interface colors (labels, grid, axes, buttons) follow * the system colors when the page is in a forced colors mode, such as * Windows High Contrast, so they stay visible. Series colors are kept. * * @default true * @since 5.21.0 */ forcedColors?: boolean; } /** * The root of a chart: it ties the chart to an HTML element and holds its * global settings, formatters, locale and themes. * * @see {@link https://www.amcharts.com/docs/v5/getting-started/#Root_element} for more info */ export declare class Root implements IDisposer { /** * The HTML element the chart is in. */ dom: HTMLElement; _inner: HTMLElement; protected _settings: IRootSettings; /** * Settings the Root filled in for itself, so that serializing can leave them * out - a `Root` is not an `Entity`, so it has no `_computedProperties`. * * @ignore */ _computedSettings: { [K in keyof IRootSettings]?: boolean; }; protected _isDirty: boolean; protected _isDirtyParents: boolean; protected _isDirtyAnimation: boolean; protected _dirty: { [id: number]: Entity; }; protected _dirtyParents: { [id: number]: IParent; }; protected _dirtyBounds: { [id: number]: IBounds; }; protected _dirtyPositions: { [id: number]: Sprite; }; protected _ticker: ((currentTime: number) => void) | null; protected _tickers: Array<(currentTime: number) => void>; protected _updateTick: boolean; skipRenderFrame: boolean; /** * Root's event dispatcher. * * @see {@link https://www.amcharts.com/docs/v5/concepts/events/} for more info */ events: EventDispatcher>; /** * Time in milliseconds of the frame being rendered, or `null` while no * frames run. * * @ignore */ animationTime: number | null; private _animations; _renderer: IRenderer; _rootContainer: Container; /** * The main container: charts and other elements go into its `children`. */ container: Container; /** * The [[Container]] tooltips are drawn in, above the chart. */ tooltipContainer: Container; protected _tooltipContainerSettings: { top: number; left: number; right: number; bottom: number; }; _tooltip: Tooltip; /** * @ignore */ language: Language; /** * Locale for the chart's texts and formatting. English by default. * * @see {@link https://www.amcharts.com/docs/v5/concepts/locales/} */ locale: ILocale; /** * Treats dates as UTC instead of the user's local time, when formatting * and parsing them and when placing date axis grid. It takes precedence * over `timezone`. * * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/formatting-dates/#utc-and-time-zones} for more info */ utc: boolean; /** * Time zone to show dates in, instead of the user's local one. Set it to a * [[Timezone]] with an IANA name, e.g. * `am5.Timezone.new("America/Vancouver")`. For UTC, `utc` is faster. * * Every date is converted, which can slow down charts with large data sets. * * @see {@link https://www.amcharts.com/docs/v5/getting-started/root-element/#time-zone} for more info * @since 5.1.0 */ timezone?: Timezone; /** * Maximum frames per second. When not set, the chart renders on every * animation frame of the browser. * * Each frame waits `1000 / fps` milliseconds after the previous one is * drawn, then for the screen's next refresh, so the rate achieved is lower: * `fps: 30` gives about 20 on a 60 Hz screen. * * @see {@link https://www.amcharts.com/docs/v5/getting-started/root-element/#Performance} for more info */ fps: number | undefined; /** * Number formatter. * * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/formatting-numbers/} for more info */ numberFormatter: NumberFormatter; /** * Date/time formatter. * * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/formatting-dates/} for more info */ dateFormatter: DateFormatter; /** * Duration formatter. * * @see {@link https://www.amcharts.com/docs/v5/concepts/formatters/formatting-dates/} for more info */ durationFormatter: DurationFormatter; /** * Tab index for the whole chart. * * @see {@link https://www.amcharts.com/docs/v5/concepts/accessibility/} for more info */ tabindex: number; protected _tabindexes: Sprite[]; protected _a11yD: boolean; protected _focusElementDirty: boolean; protected _focusElementContainer: HTMLDivElement | undefined; protected _focusedSprite: Sprite | undefined; protected _isShift: boolean | undefined; protected _keyboardDragPoint: IPoint | undefined; protected _tooltipElementContainer: HTMLDivElement | undefined; protected _readerAlertElement: HTMLDivElement | undefined; protected _groupStops: { [group: string]: Sprite; }; protected _dirtyGroups: { [group: string]: string | number; }; _logo?: Container; _tooltipDiv: HTMLDivElement | undefined; /** * Nonce for the `