import { Container } from 'pixi.js'; import { LayerDict } from '../layers'; import { ChartProps, ChartTheme, CreateLayerProps, D3Selection, LayerInstance, LayerType, Layout, RebuildScaleProps } from '../types'; import { EventManager } from '../utils'; import { Tooltip } from './tooltip'; export declare class Chart { private _layout; private _layers; /** * The paddings of the main drawing area. * The four values represent top right bottom left. * @remarks * The padding cannot be updated dynamically, * it can only be specified through the constructor. */ private padding; /** * Global define target that all presets gradients are in here. */ private defs; /** * Log for internal messages. */ private readonly log; /** * Manage lifecycle or error events. */ readonly event: EventManager<"draw" | "destroy" | "rebuildScale" | "globalEvent" | "initialized" | "error", import("../types").EventCallback>; /** * Decide how the graph will be drawn. * In any case, svg should be preferred. * @defaultValue svg */ readonly engine: Engine; /** * The tooltip instance of the chart. * All layers share the same tooltip, * which means no two tooltip popups will appear at the same time. */ readonly tooltip: Tooltip; /** * Once you specify the engine, * the corresponding graph root element will be created. */ readonly root: D3Selection | Container; /** * The theme of the chart. * @remarks * The theme cannot be updated dynamically, * it can only be specified through the constructor. */ readonly theme: ChartTheme; /** * The container for the outer layer of the chart. */ readonly container: HTMLElement; /** * Real width of the chart root. * @see root */ readonly containerWidth: number; /** * Real height of the chart root. * @see root */ readonly containerHeight: number; /** * The layout is divided into several layer areas, * and each layer is drawn in a specific area. */ get layout(): Layout; /** * Get all layers of the current chart except sublayers, * because sublayers should be completely managed by the parent layer. */ get layers(): LayerInstance[]; constructor({ width, height, container, engine, padding, theme, layoutCreator, tooltipOptions, }: ChartProps); private initializeLifeCycles; getLayerById(id: string): LayerInstance | undefined; getLayerByType(type: T): LayerDict[T] | undefined; getLayersByType(type: T): LayerDict[T][]; private get independentLayers(); private get nonUniqueLayers(); /** * Create a layer by options. * @remarks * - The layer ID is unique, if not specified, create random one. * - Each chart can only have one axis and legend layer. * - The layer type must be built-in or registered via `registerCustomLayer`. * @returns * Returns the layer instance if successful. */ createLayer(options: CreateLayerProps): LayerDict[T] | undefined; /** * This function is responsible for integrating the scales of all layers. * Any operation that affects layout should call this method. */ rebuildScale({ trigger, redraw }: RebuildScaleProps): void; /** * Since layers of different types may depend on each other, * you should use the chart drawing method. */ draw(): void; /** * Release the space occupied by all layers and tooltip of the chart, * but will not destroy the root element. */ destroy(): void; }