import type { IsChart } from '@chartisan/chartisan' ; import { init , ECharts as Instance , EChartsOption as Configuration } from 'echarts' ; import type { DeepPartial } from '@chartisan/chartisan' ; export class Echarts implements IsChart < Instance , Configuration > { var public instance ? : Instance ; var protected canvas ? : HTMLDivElement ; param element param configuration returns { void } public create ( element , configuration ) { if ( this . instance !== undefined ) return ; this . canvas = document . createElement ( 'div' ) ; this . canvas . style . height = '100%' ; this . canvas . style . width = '100%' ; element . append ( this . canvas ) ; this . instance = init ( this . canvas , undefined ) ; this . instance . setOption ( configuration ) ; } param configuration returns { void } public update ( configuration ) { if ( this . instance === undefined ) return ; this . instance ?. setOption ( configuration ) ; } returns { void } public delete ( ) { if ( this . instance === undefined ) return ; this . instance . dispose ( ) ; this . canvas ?. remove ( ) ; this . instance = undefined ; this . canvas = undefined ; } returns public isInitiated ( ) { return this . instance !== undefined ; } }