react-use-echarts 0.0.10 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +548 -26
- package/dist/__tests__/hooks/theme-change.test.d.ts +1 -0
- package/dist/__tests__/hooks/use-echarts.test.d.ts +1 -0
- package/dist/__tests__/hooks/use-lazy-init.test.d.ts +1 -0
- package/dist/__tests__/themes/index.test.d.ts +1 -0
- package/dist/__tests__/utils/connect.test.d.ts +1 -0
- package/dist/__tests__/utils/instance-cache.test.d.ts +1 -0
- package/dist/hooks/use-echarts.d.ts +10 -0
- package/dist/hooks/use-lazy-init.d.ts +8 -0
- package/dist/index.d.ts +32 -131
- package/dist/index.es.js +1096 -80
- package/dist/index.umd.js +5 -1
- package/dist/themes/index.d.ts +42 -0
- package/dist/themes/presets/dark.json.d.ts +398 -0
- package/dist/themes/presets/light.json.d.ts +398 -0
- package/dist/themes/presets/macarons.json.d.ts +419 -0
- package/dist/types/index.d.ts +118 -0
- package/dist/utils/connect.d.ts +49 -0
- package/dist/utils/index.d.ts +10 -0
- package/dist/utils/instance-cache.d.ts +42 -0
- package/package.json +29 -24
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
"color": [
|
|
3
|
+
"#2ec7c9",
|
|
4
|
+
"#b6a2de",
|
|
5
|
+
"#5ab1ef",
|
|
6
|
+
"#ffb980",
|
|
7
|
+
"#d87a80",
|
|
8
|
+
"#8d98b3",
|
|
9
|
+
"#e5cf0d",
|
|
10
|
+
"#97b552",
|
|
11
|
+
"#95706d",
|
|
12
|
+
"#dc69aa",
|
|
13
|
+
"#07a2a4",
|
|
14
|
+
"#9a7fd1",
|
|
15
|
+
"#588dd5",
|
|
16
|
+
"#f5994e",
|
|
17
|
+
"#c05050",
|
|
18
|
+
"#59678c",
|
|
19
|
+
"#c9ab00",
|
|
20
|
+
"#7eb00a",
|
|
21
|
+
"#6f5553",
|
|
22
|
+
"#c14089"
|
|
23
|
+
],
|
|
24
|
+
"backgroundColor": "rgba(0,0,0,0)",
|
|
25
|
+
"textStyle": {},
|
|
26
|
+
"title": {
|
|
27
|
+
"textStyle": {
|
|
28
|
+
"color": "#008acd"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"line": {
|
|
32
|
+
"itemStyle": {
|
|
33
|
+
"borderWidth": 1
|
|
34
|
+
},
|
|
35
|
+
"lineStyle": {
|
|
36
|
+
"width": 2
|
|
37
|
+
},
|
|
38
|
+
"symbolSize": 3,
|
|
39
|
+
"symbol": "emptyCircle",
|
|
40
|
+
"smooth": true
|
|
41
|
+
},
|
|
42
|
+
"radar": {
|
|
43
|
+
"itemStyle": {
|
|
44
|
+
"borderWidth": 1
|
|
45
|
+
},
|
|
46
|
+
"lineStyle": {
|
|
47
|
+
"width": 2
|
|
48
|
+
},
|
|
49
|
+
"symbolSize": 3,
|
|
50
|
+
"symbol": "emptyCircle",
|
|
51
|
+
"smooth": true
|
|
52
|
+
},
|
|
53
|
+
"bar": {
|
|
54
|
+
"itemStyle": {
|
|
55
|
+
"barBorderWidth": 0,
|
|
56
|
+
"barBorderColor": "#ccc"
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
"pie": {
|
|
60
|
+
"itemStyle": {
|
|
61
|
+
"borderWidth": 0,
|
|
62
|
+
"borderColor": "#ccc"
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
"scatter": {
|
|
66
|
+
"itemStyle": {
|
|
67
|
+
"borderWidth": 0,
|
|
68
|
+
"borderColor": "#ccc"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"boxplot": {
|
|
72
|
+
"itemStyle": {
|
|
73
|
+
"borderWidth": 0,
|
|
74
|
+
"borderColor": "#ccc"
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"parallel": {
|
|
78
|
+
"itemStyle": {
|
|
79
|
+
"borderWidth": 0,
|
|
80
|
+
"borderColor": "#ccc"
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"sankey": {
|
|
84
|
+
"itemStyle": {
|
|
85
|
+
"borderWidth": 0,
|
|
86
|
+
"borderColor": "#ccc"
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"funnel": {
|
|
90
|
+
"itemStyle": {
|
|
91
|
+
"borderWidth": 0,
|
|
92
|
+
"borderColor": "#ccc"
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"gauge": {
|
|
96
|
+
"itemStyle": {
|
|
97
|
+
"borderWidth": 0,
|
|
98
|
+
"borderColor": "#ccc"
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"candlestick": {
|
|
102
|
+
"itemStyle": {
|
|
103
|
+
"color": "#d87a80",
|
|
104
|
+
"color0": "#2ec7c9",
|
|
105
|
+
"borderColor": "#d87a80",
|
|
106
|
+
"borderColor0": "#2ec7c9",
|
|
107
|
+
"borderWidth": 1
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
"graph": {
|
|
111
|
+
"itemStyle": {
|
|
112
|
+
"borderWidth": 0,
|
|
113
|
+
"borderColor": "#ccc"
|
|
114
|
+
},
|
|
115
|
+
"lineStyle": {
|
|
116
|
+
"width": 1,
|
|
117
|
+
"color": "#aaa"
|
|
118
|
+
},
|
|
119
|
+
"symbolSize": 3,
|
|
120
|
+
"symbol": "emptyCircle",
|
|
121
|
+
"smooth": true,
|
|
122
|
+
"color": [
|
|
123
|
+
"#2ec7c9",
|
|
124
|
+
"#b6a2de",
|
|
125
|
+
"#5ab1ef",
|
|
126
|
+
"#ffb980",
|
|
127
|
+
"#d87a80",
|
|
128
|
+
"#8d98b3",
|
|
129
|
+
"#e5cf0d",
|
|
130
|
+
"#97b552",
|
|
131
|
+
"#95706d",
|
|
132
|
+
"#dc69aa",
|
|
133
|
+
"#07a2a4",
|
|
134
|
+
"#9a7fd1",
|
|
135
|
+
"#588dd5",
|
|
136
|
+
"#f5994e",
|
|
137
|
+
"#c05050",
|
|
138
|
+
"#59678c",
|
|
139
|
+
"#c9ab00",
|
|
140
|
+
"#7eb00a",
|
|
141
|
+
"#6f5553",
|
|
142
|
+
"#c14089"
|
|
143
|
+
],
|
|
144
|
+
"label": {
|
|
145
|
+
"color": "#eee"
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"map": {
|
|
149
|
+
"itemStyle": {
|
|
150
|
+
"areaColor": "#dddddd",
|
|
151
|
+
"borderColor": "#eeeeee",
|
|
152
|
+
"borderWidth": 0.5
|
|
153
|
+
},
|
|
154
|
+
"label": {
|
|
155
|
+
"color": "#d87a80"
|
|
156
|
+
},
|
|
157
|
+
"emphasis": {
|
|
158
|
+
"itemStyle": {
|
|
159
|
+
"areaColor": "rgba(254,153,78,1)",
|
|
160
|
+
"borderColor": "#444",
|
|
161
|
+
"borderWidth": 1
|
|
162
|
+
},
|
|
163
|
+
"label": {
|
|
164
|
+
"color": "rgb(100,0,0)"
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
},
|
|
168
|
+
"geo": {
|
|
169
|
+
"itemStyle": {
|
|
170
|
+
"areaColor": "#dddddd",
|
|
171
|
+
"borderColor": "#eeeeee",
|
|
172
|
+
"borderWidth": 0.5
|
|
173
|
+
},
|
|
174
|
+
"label": {
|
|
175
|
+
"color": "#d87a80"
|
|
176
|
+
},
|
|
177
|
+
"emphasis": {
|
|
178
|
+
"itemStyle": {
|
|
179
|
+
"areaColor": "rgba(254,153,78,1)",
|
|
180
|
+
"borderColor": "#444",
|
|
181
|
+
"borderWidth": 1
|
|
182
|
+
},
|
|
183
|
+
"label": {
|
|
184
|
+
"color": "rgb(100,0,0)"
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
"categoryAxis": {
|
|
189
|
+
"axisLine": {
|
|
190
|
+
"show": true,
|
|
191
|
+
"lineStyle": {
|
|
192
|
+
"color": "#008acd"
|
|
193
|
+
}
|
|
194
|
+
},
|
|
195
|
+
"axisTick": {
|
|
196
|
+
"show": true,
|
|
197
|
+
"lineStyle": {
|
|
198
|
+
"color": "#333"
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"axisLabel": {
|
|
202
|
+
"show": true,
|
|
203
|
+
"color": "#333"
|
|
204
|
+
},
|
|
205
|
+
"splitLine": {
|
|
206
|
+
"show": false,
|
|
207
|
+
"lineStyle": {
|
|
208
|
+
"color": [
|
|
209
|
+
"#eee"
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"splitArea": {
|
|
214
|
+
"show": false,
|
|
215
|
+
"areaStyle": {
|
|
216
|
+
"color": [
|
|
217
|
+
"rgba(250,250,250,0.3)",
|
|
218
|
+
"rgba(200,200,200,0.3)"
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"valueAxis": {
|
|
224
|
+
"axisLine": {
|
|
225
|
+
"show": true,
|
|
226
|
+
"lineStyle": {
|
|
227
|
+
"color": "#008acd"
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
"axisTick": {
|
|
231
|
+
"show": true,
|
|
232
|
+
"lineStyle": {
|
|
233
|
+
"color": "#333"
|
|
234
|
+
}
|
|
235
|
+
},
|
|
236
|
+
"axisLabel": {
|
|
237
|
+
"show": true,
|
|
238
|
+
"color": "#333"
|
|
239
|
+
},
|
|
240
|
+
"splitLine": {
|
|
241
|
+
"show": true,
|
|
242
|
+
"lineStyle": {
|
|
243
|
+
"color": [
|
|
244
|
+
"#eee"
|
|
245
|
+
]
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
"splitArea": {
|
|
249
|
+
"show": false,
|
|
250
|
+
"areaStyle": {
|
|
251
|
+
"color": [
|
|
252
|
+
"rgba(250,250,250,0.3)",
|
|
253
|
+
"rgba(200,200,200,0.3)"
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
"logAxis": {
|
|
259
|
+
"axisLine": {
|
|
260
|
+
"show": true,
|
|
261
|
+
"lineStyle": {
|
|
262
|
+
"color": "#008acd"
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
"axisTick": {
|
|
266
|
+
"show": true,
|
|
267
|
+
"lineStyle": {
|
|
268
|
+
"color": "#333"
|
|
269
|
+
}
|
|
270
|
+
},
|
|
271
|
+
"axisLabel": {
|
|
272
|
+
"show": true,
|
|
273
|
+
"color": "#333"
|
|
274
|
+
},
|
|
275
|
+
"splitLine": {
|
|
276
|
+
"show": true,
|
|
277
|
+
"lineStyle": {
|
|
278
|
+
"color": [
|
|
279
|
+
"#eee"
|
|
280
|
+
]
|
|
281
|
+
}
|
|
282
|
+
},
|
|
283
|
+
"splitArea": {
|
|
284
|
+
"show": false,
|
|
285
|
+
"areaStyle": {
|
|
286
|
+
"color": [
|
|
287
|
+
"rgba(250,250,250,0.3)",
|
|
288
|
+
"rgba(200,200,200,0.3)"
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
"timeAxis": {
|
|
294
|
+
"axisLine": {
|
|
295
|
+
"show": true,
|
|
296
|
+
"lineStyle": {
|
|
297
|
+
"color": "#008acd"
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
"axisTick": {
|
|
301
|
+
"show": true,
|
|
302
|
+
"lineStyle": {
|
|
303
|
+
"color": "#333"
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
"axisLabel": {
|
|
307
|
+
"show": true,
|
|
308
|
+
"color": "#333"
|
|
309
|
+
},
|
|
310
|
+
"splitLine": {
|
|
311
|
+
"show": true,
|
|
312
|
+
"lineStyle": {
|
|
313
|
+
"color": [
|
|
314
|
+
"#eee"
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
"splitArea": {
|
|
319
|
+
"show": false,
|
|
320
|
+
"areaStyle": {
|
|
321
|
+
"color": [
|
|
322
|
+
"rgba(250,250,250,0.3)",
|
|
323
|
+
"rgba(200,200,200,0.3)"
|
|
324
|
+
]
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
},
|
|
328
|
+
"toolbox": {
|
|
329
|
+
"iconStyle": {
|
|
330
|
+
"borderColor": "#2ec7c9"
|
|
331
|
+
},
|
|
332
|
+
"emphasis": {
|
|
333
|
+
"iconStyle": {
|
|
334
|
+
"borderColor": "#18a4a6"
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
},
|
|
338
|
+
"legend": {
|
|
339
|
+
"textStyle": {
|
|
340
|
+
"color": "#333333"
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
"tooltip": {
|
|
344
|
+
"axisPointer": {
|
|
345
|
+
"lineStyle": {
|
|
346
|
+
"color": "#008acd",
|
|
347
|
+
"width": "1"
|
|
348
|
+
},
|
|
349
|
+
"crossStyle": {
|
|
350
|
+
"color": "#008acd",
|
|
351
|
+
"width": "1"
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
},
|
|
355
|
+
"timeline": {
|
|
356
|
+
"lineStyle": {
|
|
357
|
+
"color": "#008acd",
|
|
358
|
+
"width": 1
|
|
359
|
+
},
|
|
360
|
+
"itemStyle": {
|
|
361
|
+
"color": "#008acd",
|
|
362
|
+
"borderWidth": 1
|
|
363
|
+
},
|
|
364
|
+
"controlStyle": {
|
|
365
|
+
"color": "#008acd",
|
|
366
|
+
"borderColor": "#008acd",
|
|
367
|
+
"borderWidth": 0.5
|
|
368
|
+
},
|
|
369
|
+
"checkpointStyle": {
|
|
370
|
+
"color": "#2ec7c9",
|
|
371
|
+
"borderColor": "#2ec7c9"
|
|
372
|
+
},
|
|
373
|
+
"label": {
|
|
374
|
+
"color": "#008acd"
|
|
375
|
+
},
|
|
376
|
+
"emphasis": {
|
|
377
|
+
"itemStyle": {
|
|
378
|
+
"color": "#a9334c"
|
|
379
|
+
},
|
|
380
|
+
"controlStyle": {
|
|
381
|
+
"color": "#008acd",
|
|
382
|
+
"borderColor": "#008acd",
|
|
383
|
+
"borderWidth": 0.5
|
|
384
|
+
},
|
|
385
|
+
"label": {
|
|
386
|
+
"color": "#008acd"
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
},
|
|
390
|
+
"visualMap": {
|
|
391
|
+
"color": [
|
|
392
|
+
"#5ab1ef",
|
|
393
|
+
"#e0ffff"
|
|
394
|
+
]
|
|
395
|
+
},
|
|
396
|
+
"dataZoom": {
|
|
397
|
+
"backgroundColor": "rgba(47,69,84,0)",
|
|
398
|
+
"dataBackgroundColor": "rgba(239,239,255,0.3)",
|
|
399
|
+
"fillerColor": "rgba(182,162,222,0.2)",
|
|
400
|
+
"handleColor": "#008acd",
|
|
401
|
+
"handleSize": "100%",
|
|
402
|
+
"textStyle": {
|
|
403
|
+
"color": "#333333"
|
|
404
|
+
}
|
|
405
|
+
},
|
|
406
|
+
"markPoint": {
|
|
407
|
+
"label": {
|
|
408
|
+
"color": "#eeeeee"
|
|
409
|
+
},
|
|
410
|
+
"emphasis": {
|
|
411
|
+
"label": {
|
|
412
|
+
"color": "#eeeeee"
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
;
|
|
418
|
+
|
|
419
|
+
export default _default;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { EChartsOption, ECharts, SetOptionOpts } from 'echarts';
|
|
2
|
+
/**
|
|
3
|
+
* Built-in theme names
|
|
4
|
+
* 内置主题名称
|
|
5
|
+
*/
|
|
6
|
+
export type BuiltinTheme = 'light' | 'dark' | 'macarons';
|
|
7
|
+
/**
|
|
8
|
+
* Event configuration interface for ECharts
|
|
9
|
+
* ECharts 事件配置接口
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* const events: EChartsEvents = {
|
|
13
|
+
* 'click': {
|
|
14
|
+
* handler: (params) => console.log('clicked', params),
|
|
15
|
+
* query: '.series-name',
|
|
16
|
+
* context: this
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export interface EChartsEvents {
|
|
22
|
+
/**
|
|
23
|
+
* Event name as key
|
|
24
|
+
* 事件名称作为键
|
|
25
|
+
*/
|
|
26
|
+
[eventName: string]: {
|
|
27
|
+
/**
|
|
28
|
+
* Event handler function
|
|
29
|
+
* 事件处理函数
|
|
30
|
+
*/
|
|
31
|
+
handler: (params: unknown) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Query condition for the event
|
|
34
|
+
* 事件的查询条件
|
|
35
|
+
*/
|
|
36
|
+
query?: string | object;
|
|
37
|
+
/**
|
|
38
|
+
* Context for the event handler
|
|
39
|
+
* 事件处理函数的上下文
|
|
40
|
+
*/
|
|
41
|
+
context?: object;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Configuration options for useEcharts hook
|
|
46
|
+
* useEcharts hook 的配置选项
|
|
47
|
+
*/
|
|
48
|
+
export interface UseEchartsOptions {
|
|
49
|
+
/**
|
|
50
|
+
* ECharts configuration options
|
|
51
|
+
* ECharts 配置项
|
|
52
|
+
*/
|
|
53
|
+
option: EChartsOption;
|
|
54
|
+
/**
|
|
55
|
+
* Theme: built-in preset name | custom object | null
|
|
56
|
+
* 主题:内置预设名 | 自定义对象 | null
|
|
57
|
+
*/
|
|
58
|
+
theme?: BuiltinTheme | object | null;
|
|
59
|
+
/**
|
|
60
|
+
* Renderer type
|
|
61
|
+
* 渲染器类型
|
|
62
|
+
* @default 'canvas'
|
|
63
|
+
*/
|
|
64
|
+
renderer?: 'canvas' | 'svg';
|
|
65
|
+
/**
|
|
66
|
+
* Lazy initialization: only init when container enters viewport
|
|
67
|
+
* 懒加载:仅当容器进入视口时初始化
|
|
68
|
+
*/
|
|
69
|
+
lazyInit?: boolean | IntersectionObserverInit;
|
|
70
|
+
/**
|
|
71
|
+
* Chart group ID for linkage
|
|
72
|
+
* 图表组 ID,用于联动
|
|
73
|
+
*/
|
|
74
|
+
group?: string;
|
|
75
|
+
/**
|
|
76
|
+
* Default setOption options
|
|
77
|
+
* setOption 默认选项(替代原 notMerge / lazyUpdate)
|
|
78
|
+
*/
|
|
79
|
+
setOptionOpts?: SetOptionOpts;
|
|
80
|
+
/**
|
|
81
|
+
* Whether to show loading state
|
|
82
|
+
* 是否显示加载状态
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
showLoading?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Loading options
|
|
88
|
+
* 加载配置项
|
|
89
|
+
*/
|
|
90
|
+
loadingOption?: object;
|
|
91
|
+
/**
|
|
92
|
+
* Event configurations
|
|
93
|
+
* 事件配置
|
|
94
|
+
*/
|
|
95
|
+
onEvents?: EChartsEvents;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Return type for useEcharts hook
|
|
99
|
+
* useEcharts hook 的返回类型
|
|
100
|
+
*/
|
|
101
|
+
export interface UseEchartsReturn {
|
|
102
|
+
/**
|
|
103
|
+
* Function to update chart options
|
|
104
|
+
* 动态更新配置
|
|
105
|
+
*/
|
|
106
|
+
setOption: (option: EChartsOption, opts?: SetOptionOpts) => void;
|
|
107
|
+
/**
|
|
108
|
+
* Function to get the ECharts instance
|
|
109
|
+
* 获取实例
|
|
110
|
+
* @returns Returns the current ECharts instance, or undefined if not initialized
|
|
111
|
+
*/
|
|
112
|
+
getInstance: () => ECharts | undefined;
|
|
113
|
+
/**
|
|
114
|
+
* Manually trigger resize
|
|
115
|
+
* 手动触发 resize
|
|
116
|
+
*/
|
|
117
|
+
resize: () => void;
|
|
118
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ECharts } from 'echarts';
|
|
2
|
+
/**
|
|
3
|
+
* Add chart instance to group
|
|
4
|
+
* 将图表实例添加到组
|
|
5
|
+
* @param instance ECharts instance
|
|
6
|
+
* @param groupId Group ID
|
|
7
|
+
*/
|
|
8
|
+
export declare function addToGroup(instance: ECharts, groupId: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Remove chart instance from group
|
|
11
|
+
* 从组中移除图表实例
|
|
12
|
+
* @param instance ECharts instance
|
|
13
|
+
* @param groupId Group ID
|
|
14
|
+
*/
|
|
15
|
+
export declare function removeFromGroup(instance: ECharts, groupId: string): void;
|
|
16
|
+
/**
|
|
17
|
+
* Update group for chart instance
|
|
18
|
+
* 更新图表实例的组
|
|
19
|
+
* @param instance ECharts instance
|
|
20
|
+
* @param oldGroupId Previous group ID (if any)
|
|
21
|
+
* @param newGroupId New group ID (if any)
|
|
22
|
+
*/
|
|
23
|
+
export declare function updateGroup(instance: ECharts, oldGroupId?: string, newGroupId?: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Get all instances in a group
|
|
26
|
+
* 获取组中的所有实例
|
|
27
|
+
* @param groupId Group ID
|
|
28
|
+
* @returns Array of chart instances
|
|
29
|
+
*/
|
|
30
|
+
export declare function getGroupInstances(groupId: string): ECharts[];
|
|
31
|
+
/**
|
|
32
|
+
* Get group ID for an instance
|
|
33
|
+
* 获取实例所属的组 ID
|
|
34
|
+
* @param instance ECharts instance
|
|
35
|
+
* @returns Group ID or undefined
|
|
36
|
+
*/
|
|
37
|
+
export declare function getInstanceGroup(instance: ECharts): string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Check if instance is in any group
|
|
40
|
+
* 检查实例是否在任何组中
|
|
41
|
+
* @param instance ECharts instance
|
|
42
|
+
* @returns True if in a group
|
|
43
|
+
*/
|
|
44
|
+
export declare function isInGroup(instance: ECharts): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Clear all groups (for testing/cleanup)
|
|
47
|
+
* 清除所有组(用于测试/清理)
|
|
48
|
+
*/
|
|
49
|
+
export declare function clearGroups(): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Instance cache utilities
|
|
3
|
+
* 实例缓存工具函数
|
|
4
|
+
*/
|
|
5
|
+
export { getCachedInstance, setCachedInstance, replaceCachedInstance, releaseCachedInstance, getReferenceCount, clearInstanceCache, } from './instance-cache';
|
|
6
|
+
/**
|
|
7
|
+
* Chart connection utilities
|
|
8
|
+
* 图表连接工具函数
|
|
9
|
+
*/
|
|
10
|
+
export { addToGroup, removeFromGroup, updateGroup, getGroupInstances, getInstanceGroup, isInGroup, clearGroups, } from './connect';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ECharts } from 'echarts';
|
|
2
|
+
/**
|
|
3
|
+
* Get cached instance for element
|
|
4
|
+
* 获取元素的缓存实例
|
|
5
|
+
* @param element DOM element
|
|
6
|
+
* @returns Cached instance or undefined
|
|
7
|
+
*/
|
|
8
|
+
export declare function getCachedInstance(element: HTMLElement): ECharts | undefined;
|
|
9
|
+
/**
|
|
10
|
+
* Set or increment reference count for instance
|
|
11
|
+
* 设置实例或增加引用计数
|
|
12
|
+
* @param element DOM element
|
|
13
|
+
* @param instance ECharts instance
|
|
14
|
+
* @returns The instance (cached or new)
|
|
15
|
+
*/
|
|
16
|
+
export declare function setCachedInstance(element: HTMLElement, instance: ECharts): ECharts;
|
|
17
|
+
/**
|
|
18
|
+
* Replace cached instance (for theme changes)
|
|
19
|
+
* 替换缓存实例(用于主题切换)
|
|
20
|
+
* @param element DOM element
|
|
21
|
+
* @param instance New ECharts instance
|
|
22
|
+
* @returns The new instance
|
|
23
|
+
*/
|
|
24
|
+
export declare function replaceCachedInstance(element: HTMLElement, instance: ECharts): ECharts;
|
|
25
|
+
/**
|
|
26
|
+
* Decrement reference count and dispose if zero
|
|
27
|
+
* 减少引用计数,如果为零则销毁实例
|
|
28
|
+
* @param element DOM element
|
|
29
|
+
*/
|
|
30
|
+
export declare function releaseCachedInstance(element: HTMLElement): void;
|
|
31
|
+
/**
|
|
32
|
+
* Get reference count for element
|
|
33
|
+
* 获取元素的引用计数
|
|
34
|
+
* @param element DOM element
|
|
35
|
+
* @returns Reference count or 0 if not cached
|
|
36
|
+
*/
|
|
37
|
+
export declare function getReferenceCount(element: HTMLElement): number;
|
|
38
|
+
/**
|
|
39
|
+
* Clear all cached instances (for testing/cleanup)
|
|
40
|
+
* 清除所有缓存实例(用于测试/清理)
|
|
41
|
+
*/
|
|
42
|
+
export declare function clearInstanceCache(): void;
|