UNPKG

thsc-datav-standard-chart

Version:

标准范式组件

58 lines (57 loc) 1.96 kB
/// <reference types="node" /> import { type EChartsTheme, type EChartsInitOpts } from 'echarts'; import { init as echartsInit } from 'echarts/core'; import EventHandler from './EventHandler'; import Model, { type ThemeConfig } from './Model'; import type { Option } from './option'; type ECharts = ReturnType<typeof echartsInit>; type EnhancedECharts = ECharts & { $dvGetOwner: () => StandardChart; }; export declare function getStandardChart(echartsIns: ECharts): StandardChart; export declare function setStandardChartIns(chart: StandardChart): void; export declare function getStandardChartInsById(id: string): StandardChart; export default class StandardChart extends EventHandler { /** 埋点统计的ID */ protected readonly __statisticId = "thsc-datav-standard-chart"; /** * @readonly */ id: string; protected _$dom: HTMLElement; private __ecTheme; private __initOption; private __echarts; /** 配置项管理 */ protected _model: Model; protected _initialized: boolean; private __pendingCallback; private __playOption; private __timersMap; /** * 构造函数 * * 该阶段只完成所有变量初始化和组件的实例化,不执行任何繁重的计算逻辑 */ constructor(dom: HTMLElement, theme?: ThemeConfig, ecTheme?: EChartsTheme | EChartsInitOpts, initOption?: EChartsInitOpts); getDom(): HTMLElement; getECharts(): EnhancedECharts; getModel(): Model; clearTimers(key?: string): void; cacheTimers(key: string, timers: ReturnType<typeof setTimeout>[]): void; getTimers(key: string): NodeJS.Timeout[]; protected _initialize(): void; /** * 销毁实例 * * 释放资源引用,避免内存泄露 */ destroy(): void; play(arg: { option: Option; } & this['__playOption']): this; private __update; /** * 发送埋点 */ private static __statistic; } export {};