import type { Entity } from "../core/util/Entity"; import type { Theme } from "../core/Theme"; import { Root } from "../core/Root"; declare const BaseElement: typeof HTMLElement; /** * A theme class, or anything else with a `new(root, settings)` that makes a * theme, such as `am5themes_Adaptive`. * * @since 5.21.4 */ export interface IChartElementThemeClass { new: (root: Root, settings?: any) => Theme; } /** * A theme for ``: a theme class, e.g. `am5themes_Animated`, or a * theme class with its settings, e.g. * `[am5themes_Adaptive, { baseColor: "#4150a0" }]`. * * @since 5.21.4 */ export declare type ChartElementTheme = IChartElementThemeClass | [IChartElementThemeClass, object]; /** * Details of the element's `ready` event. * * @since 5.21.0 */ export interface IChartElementReadyEvent { /** * The chart's root element. */ root: Root; /** * What the config built: usually the chart. */ chart: Entity; } /** * The events of ``. * * @since 5.21.0 */ export interface IChartElementEventMap { /** * The chart is built. */ ready: CustomEvent; /** * The chart could not be built; `detail` has the error. */ error: CustomEvent; } /** * A chart as an HTML element: ``, built from a JSON config. * * ```html * * ``` * * The config is given with the `config` attribute or property (an object or * a JSON string), or loaded from a URL with `src`. Themes are not part of a * config: set them with the `themes` property (theme classes, or a class with * its settings: `[am5themes_Adaptive, { baseColor: "#4150a0" }]`), or with * the `themes` attribute (names, for the script version, where each theme is * a global: `themes="Animated"`, or as JSON with settings: * `themes='["Animated", ["Adaptive", { "baseColor": "#4150a0" }]]'`). * `renderer="svg"` draws the chart as SVG. * * A config names geodata and locales instead of carrying them * (`"geoJSON": "am5geodata_worldLow"`). The script version defines them as * globals; with npm imports, give them in the `resources` property: * `element.resources = { am5geodata_worldLow }`. * * With script tags, load `index.js`, `plugins/json.js` and `element.js`, and * then the chart types the config uses, e.g. `percent.js`. * * The element dispatches `ready` when the chart is built, with `root` and * `chart` in its `detail`, and `error` when it could not be. A config given * in the page can be built before a script adds its listener: `whenReady()` * works whenever it is called. * * Without a height of its own, from CSS or its parent, the element is 400 * pixels high. * * @see {@link https://docs.amcharts.com/v5/getting-started/integrations/am5-chart-element/} for more information * @see {@link https://docs.amcharts.com/v5/concepts/serializing/} for the config format * @since 5.21.0 */ export declare class ChartElement extends BaseElement { /** * @ignore */ static get observedAttributes(): Array; /** * The chart's root element, once it is built. */ root: Root | undefined; /** * What the config built, usually the chart, once it is built. */ chart: Entity | undefined; protected _config: object | string | undefined; protected _themes: Array | undefined; protected _resources: { [name: string]: unknown; } | undefined; protected _container: HTMLDivElement | undefined; protected _build: number; protected _scheduled: boolean; protected _pending: boolean; protected _abort: AbortController | undefined; protected _sizer: ResizeObserver | undefined; protected _ready: Promise | undefined; protected _settle: { resolve: (value: IChartElementReadyEvent) => void; reject: (error: unknown) => void; } | undefined; /** * Returns a promise of the built chart. It resolves at once if the chart * is already built, or once it is, and rejects if the build fails or the * element is removed first. A new config makes a new chart and a new * promise. * * @return Promise of the root and the chart */ whenReady(): Promise; protected _resolve(detail: IChartElementReadyEvent): void; protected _reject(error: unknown): void; /** * The chart's JSON config: an object, or a JSON string. Setting it builds * the chart again. */ get config(): object | string | undefined; set config(value: object | string | undefined); /** * Themes for the chart: theme classes, e.g. `[am5themes_Animated]`, or a * class with its settings, e.g. * `[am5themes_Animated, [am5themes_Adaptive, { baseColor: "#4150a0" }]]`. * Setting them builds the chart again. */ get themes(): Array | undefined; set themes(value: Array | undefined); /** * Objects the config names instead of carrying them: geodata packs and * locales, by the names the config uses, e.g. * `{ am5geodata_worldLow, am5locales_de_DE }`. Needed with npm imports; * the script version defines them as globals. Setting them builds the * chart again. * * @since 5.21.4 */ get resources(): { [name: string]: unknown; } | undefined; set resources(value: { [name: string]: unknown; } | undefined); addEventListener(type: K, listener: (this: ChartElement, event: IChartElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: K, listener: (this: ChartElement, event: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: ChartElement, event: IChartElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; removeEventListener(type: K, listener: (this: ChartElement, event: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; /** * @ignore */ connectedCallback(): void; /** * @ignore */ disconnectedCallback(): void; /** * @ignore */ attributeChangedCallback(name: string, previous: string | null, value: string | null): void; protected _size(): void; protected _stopSizer(): void; protected _dispose(): void; protected _rebuild(): void; protected _make(): void; protected _load(): Promise; protected _themeEntries(): Array<[IChartElementThemeClass, object | undefined]>; } /** * Registers ``, or the element under another name. Loading the * module does this already; call it for a different name. * * @param name Element name, with a hyphen in it * @since 5.21.0 */ export declare function defineChartElement(name?: string): void; export {}; //# sourceMappingURL=ChartElement.d.ts.map