MCPcopy
hub / github.com/apache/echarts / createChart

Function createChart

test/ut/core/utHelper.ts:33–61  ·  view source on GitHub ↗
(params?: {
    width?: number,
    height?: number,
    theme?: Parameters<typeof init>[1],
    opts?: Parameters<typeof init>[2]
})

Source from the content-addressed store, hash-verified

31
32
33export function createChart(params?: {
34 width?: number,
35 height?: number,
36 theme?: Parameters<typeof init>[1],
37 opts?: Parameters<typeof init>[2]
38}): EChartsType {
39 params = params || {};
40 const el = document.createElement('div');
41 el.style.cssText = [
42 'visibility:hidden',
43 'width:' + (params.width || '500') + 'px',
44 'height:' + (params.height || '400') + 'px',
45 'position:absolute',
46 'bottom:0',
47 'right:0'
48 ].join(';');
49 Object.defineProperty(el, 'clientWidth', {
50 get() {
51 return params.width || 500;
52 }
53 });
54 Object.defineProperty(el, 'clientHeight', {
55 get() {
56 return params.height || 400;
57 }
58 });
59 const chart = init(el, params.theme, params.opts);
60 return chart;
61};
62
63export function removeChart(chart: EChartsType): void {
64 chart.dispose();

Callers 13

interval.test.tsFile · 0.90
setOption.test.tsFile · 0.90
setOption.test.tsFile · 0.90
event.test.tsFile · 0.90
helper.test.tsFile · 0.90
custom.test.tsFile · 0.90
Global.test.tsFile · 0.90
converter.test.tsFile · 0.90

Calls 1

initFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…