@particle-academy/fancy-echarts 1.2.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 +213 -0
- package/dist/index.cjs +753 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +227 -0
- package/dist/index.d.ts +227 -0
- package/dist/index.js +606 -0
- package/dist/index.js.map +1 -0
- package/docs/EChart.md +207 -0
- package/docs/EChart3D.md +178 -0
- package/docs/EChartGraphic.md +149 -0
- package/docs/registration.md +152 -0
- package/docs/themes.md +152 -0
- package/docs/useECharts.md +129 -0
- package/package.json +66 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,753 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var react = require('react');
|
|
4
|
+
var core = require('echarts/core');
|
|
5
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
var charts = require('echarts/charts');
|
|
7
|
+
var components = require('echarts/components');
|
|
8
|
+
var renderers = require('echarts/renderers');
|
|
9
|
+
|
|
10
|
+
// src/components/EChart.tsx
|
|
11
|
+
function useResizeObserver(ref, callback) {
|
|
12
|
+
const callbackRef = react.useRef(callback);
|
|
13
|
+
callbackRef.current = callback;
|
|
14
|
+
react.useEffect(() => {
|
|
15
|
+
const element = ref.current;
|
|
16
|
+
if (!element) return;
|
|
17
|
+
const observer = new ResizeObserver(() => {
|
|
18
|
+
callbackRef.current();
|
|
19
|
+
});
|
|
20
|
+
observer.observe(element);
|
|
21
|
+
return () => {
|
|
22
|
+
observer.disconnect();
|
|
23
|
+
};
|
|
24
|
+
}, [ref]);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// src/hooks/use-echarts.ts
|
|
28
|
+
function useDarkMode() {
|
|
29
|
+
return react.useSyncExternalStore(
|
|
30
|
+
(callback) => {
|
|
31
|
+
const mq = window.matchMedia("(prefers-color-scheme: dark)");
|
|
32
|
+
mq.addEventListener("change", callback);
|
|
33
|
+
return () => mq.removeEventListener("change", callback);
|
|
34
|
+
},
|
|
35
|
+
() => window.matchMedia("(prefers-color-scheme: dark)").matches,
|
|
36
|
+
() => false
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function useECharts(options) {
|
|
40
|
+
const {
|
|
41
|
+
option,
|
|
42
|
+
theme,
|
|
43
|
+
renderer = "canvas",
|
|
44
|
+
notMerge = false,
|
|
45
|
+
lazyUpdate = false,
|
|
46
|
+
showLoading = false,
|
|
47
|
+
loadingOption,
|
|
48
|
+
onEvents,
|
|
49
|
+
autoResize = true
|
|
50
|
+
} = options;
|
|
51
|
+
const isDark = useDarkMode();
|
|
52
|
+
const autoDark = theme === void 0 && isDark;
|
|
53
|
+
const resolvedTheme = theme !== void 0 ? theme : isDark ? "dark" : void 0;
|
|
54
|
+
const chartRef = react.useRef(null);
|
|
55
|
+
const instanceRef = react.useRef(null);
|
|
56
|
+
const [instance, setInstance] = react.useState(null);
|
|
57
|
+
react.useEffect(() => {
|
|
58
|
+
if (!chartRef.current) return;
|
|
59
|
+
const existing = core.getInstanceByDom(chartRef.current);
|
|
60
|
+
if (existing) {
|
|
61
|
+
existing.dispose();
|
|
62
|
+
}
|
|
63
|
+
const chart = core.init(chartRef.current, resolvedTheme, { renderer });
|
|
64
|
+
instanceRef.current = chart;
|
|
65
|
+
setInstance(chart);
|
|
66
|
+
return () => {
|
|
67
|
+
chart.dispose();
|
|
68
|
+
instanceRef.current = null;
|
|
69
|
+
setInstance(null);
|
|
70
|
+
};
|
|
71
|
+
}, [resolvedTheme, renderer]);
|
|
72
|
+
react.useEffect(() => {
|
|
73
|
+
const chart = instanceRef.current;
|
|
74
|
+
if (!chart || !option) return;
|
|
75
|
+
const finalOption = autoDark ? { backgroundColor: "transparent", ...option } : option;
|
|
76
|
+
chart.setOption(finalOption, { notMerge, lazyUpdate });
|
|
77
|
+
}, [option, notMerge, lazyUpdate, autoDark]);
|
|
78
|
+
react.useEffect(() => {
|
|
79
|
+
const chart = instanceRef.current;
|
|
80
|
+
if (!chart) return;
|
|
81
|
+
if (showLoading) {
|
|
82
|
+
chart.showLoading("default", loadingOption);
|
|
83
|
+
} else {
|
|
84
|
+
chart.hideLoading();
|
|
85
|
+
}
|
|
86
|
+
}, [showLoading, loadingOption]);
|
|
87
|
+
react.useEffect(() => {
|
|
88
|
+
const chart = instanceRef.current;
|
|
89
|
+
if (!chart || !onEvents) return;
|
|
90
|
+
const entries = Object.entries(onEvents);
|
|
91
|
+
for (const [event, handler] of entries) {
|
|
92
|
+
chart.on(event, handler);
|
|
93
|
+
}
|
|
94
|
+
return () => {
|
|
95
|
+
for (const [event, handler] of entries) {
|
|
96
|
+
chart.off(event, handler);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
}, [onEvents]);
|
|
100
|
+
useResizeObserver(chartRef, () => {
|
|
101
|
+
if (autoResize && instanceRef.current) {
|
|
102
|
+
instanceRef.current.resize();
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return { chartRef, instance };
|
|
106
|
+
}
|
|
107
|
+
var DEFAULT_STYLE = { width: "100%", height: 400 };
|
|
108
|
+
var EChartBase = react.forwardRef(
|
|
109
|
+
({
|
|
110
|
+
option,
|
|
111
|
+
theme,
|
|
112
|
+
renderer,
|
|
113
|
+
notMerge,
|
|
114
|
+
lazyUpdate,
|
|
115
|
+
showLoading,
|
|
116
|
+
loadingOption,
|
|
117
|
+
onEvents,
|
|
118
|
+
autoResize = true,
|
|
119
|
+
style,
|
|
120
|
+
className,
|
|
121
|
+
...rest
|
|
122
|
+
}, _ref) => {
|
|
123
|
+
const { chartRef } = useECharts({
|
|
124
|
+
option,
|
|
125
|
+
theme,
|
|
126
|
+
renderer,
|
|
127
|
+
notMerge,
|
|
128
|
+
lazyUpdate,
|
|
129
|
+
showLoading,
|
|
130
|
+
loadingOption,
|
|
131
|
+
onEvents,
|
|
132
|
+
autoResize
|
|
133
|
+
});
|
|
134
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
135
|
+
"div",
|
|
136
|
+
{
|
|
137
|
+
ref: chartRef,
|
|
138
|
+
style: { ...DEFAULT_STYLE, ...style },
|
|
139
|
+
className,
|
|
140
|
+
...rest
|
|
141
|
+
}
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
EChartBase.displayName = "EChart";
|
|
146
|
+
function createSeriesComponent(seriesType, displayName) {
|
|
147
|
+
const Component = ({
|
|
148
|
+
data,
|
|
149
|
+
title,
|
|
150
|
+
xAxis,
|
|
151
|
+
yAxis,
|
|
152
|
+
tooltip = true,
|
|
153
|
+
legend = false,
|
|
154
|
+
grid,
|
|
155
|
+
seriesOptions = {},
|
|
156
|
+
option: extraOption = {},
|
|
157
|
+
style,
|
|
158
|
+
className,
|
|
159
|
+
...rest
|
|
160
|
+
}) => {
|
|
161
|
+
const option = react.useMemo(() => {
|
|
162
|
+
const base = {};
|
|
163
|
+
if (title) {
|
|
164
|
+
base.title = { text: title };
|
|
165
|
+
}
|
|
166
|
+
if (tooltip === true) {
|
|
167
|
+
base.tooltip = { trigger: "axis" };
|
|
168
|
+
} else if (tooltip && typeof tooltip === "object") {
|
|
169
|
+
base.tooltip = tooltip;
|
|
170
|
+
}
|
|
171
|
+
if (legend === true) {
|
|
172
|
+
base.legend = {};
|
|
173
|
+
} else if (legend && typeof legend === "object") {
|
|
174
|
+
base.legend = legend;
|
|
175
|
+
}
|
|
176
|
+
if (grid) {
|
|
177
|
+
base.grid = grid;
|
|
178
|
+
}
|
|
179
|
+
const axisCharts = [
|
|
180
|
+
"line",
|
|
181
|
+
"bar",
|
|
182
|
+
"scatter",
|
|
183
|
+
"candlestick",
|
|
184
|
+
"boxplot",
|
|
185
|
+
"heatmap",
|
|
186
|
+
"effectScatter",
|
|
187
|
+
"pictorialBar"
|
|
188
|
+
];
|
|
189
|
+
if (axisCharts.includes(seriesType)) {
|
|
190
|
+
base.xAxis = xAxis ?? { type: "category" };
|
|
191
|
+
base.yAxis = yAxis ?? { type: "value" };
|
|
192
|
+
}
|
|
193
|
+
if (Array.isArray(data)) {
|
|
194
|
+
base.series = [{ type: seriesType, data, ...seriesOptions }];
|
|
195
|
+
} else if (data && typeof data === "object" && "series" in data) {
|
|
196
|
+
const multiData = data;
|
|
197
|
+
if (multiData.categories && axisCharts.includes(seriesType)) {
|
|
198
|
+
base.xAxis = xAxis ?? {
|
|
199
|
+
type: "category",
|
|
200
|
+
data: multiData.categories
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
base.series = multiData.series.map((s) => ({
|
|
204
|
+
type: seriesType,
|
|
205
|
+
...seriesOptions,
|
|
206
|
+
...s
|
|
207
|
+
}));
|
|
208
|
+
} else {
|
|
209
|
+
base.series = [{ type: seriesType, data, ...seriesOptions }];
|
|
210
|
+
}
|
|
211
|
+
return { ...base, ...extraOption };
|
|
212
|
+
}, [
|
|
213
|
+
data,
|
|
214
|
+
title,
|
|
215
|
+
xAxis,
|
|
216
|
+
yAxis,
|
|
217
|
+
tooltip,
|
|
218
|
+
legend,
|
|
219
|
+
grid,
|
|
220
|
+
seriesOptions,
|
|
221
|
+
extraOption
|
|
222
|
+
]);
|
|
223
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
224
|
+
EChartBase,
|
|
225
|
+
{
|
|
226
|
+
option,
|
|
227
|
+
style,
|
|
228
|
+
className,
|
|
229
|
+
...rest
|
|
230
|
+
}
|
|
231
|
+
);
|
|
232
|
+
};
|
|
233
|
+
Component.displayName = displayName;
|
|
234
|
+
return Component;
|
|
235
|
+
}
|
|
236
|
+
var EChart = Object.assign(EChartBase, {
|
|
237
|
+
Line: createSeriesComponent("line", "EChart.Line"),
|
|
238
|
+
Bar: createSeriesComponent("bar", "EChart.Bar"),
|
|
239
|
+
Pie: createSeriesComponent("pie", "EChart.Pie"),
|
|
240
|
+
Scatter: createSeriesComponent("scatter", "EChart.Scatter"),
|
|
241
|
+
Radar: createSeriesComponent("radar", "EChart.Radar"),
|
|
242
|
+
Heatmap: createSeriesComponent("heatmap", "EChart.Heatmap"),
|
|
243
|
+
Gauge: createSeriesComponent("gauge", "EChart.Gauge"),
|
|
244
|
+
Funnel: createSeriesComponent("funnel", "EChart.Funnel"),
|
|
245
|
+
Treemap: createSeriesComponent("treemap", "EChart.Treemap"),
|
|
246
|
+
Sunburst: createSeriesComponent("sunburst", "EChart.Sunburst"),
|
|
247
|
+
Sankey: createSeriesComponent("sankey", "EChart.Sankey"),
|
|
248
|
+
Graph: createSeriesComponent("graph", "EChart.Graph"),
|
|
249
|
+
Candlestick: createSeriesComponent("candlestick", "EChart.Candlestick"),
|
|
250
|
+
Boxplot: createSeriesComponent("boxplot", "EChart.Boxplot"),
|
|
251
|
+
Parallel: createSeriesComponent("parallel", "EChart.Parallel"),
|
|
252
|
+
ThemeRiver: createSeriesComponent("themeRiver", "EChart.ThemeRiver"),
|
|
253
|
+
Map: createSeriesComponent("map", "EChart.Map"),
|
|
254
|
+
Custom: createSeriesComponent("custom", "EChart.Custom"),
|
|
255
|
+
EffectScatter: createSeriesComponent(
|
|
256
|
+
"effectScatter",
|
|
257
|
+
"EChart.EffectScatter"
|
|
258
|
+
),
|
|
259
|
+
PictorialBar: createSeriesComponent("pictorialBar", "EChart.PictorialBar")
|
|
260
|
+
});
|
|
261
|
+
var DEFAULT_STYLE2 = { width: "100%", height: 500 };
|
|
262
|
+
var glLoaded = false;
|
|
263
|
+
var glPromise = null;
|
|
264
|
+
function loadEChartsGL() {
|
|
265
|
+
if (glLoaded) return Promise.resolve();
|
|
266
|
+
if (!glPromise) {
|
|
267
|
+
glPromise = import('echarts-gl').then(() => {
|
|
268
|
+
glLoaded = true;
|
|
269
|
+
}).catch((err) => {
|
|
270
|
+
console.warn("Failed to load echarts-gl for 3D charts:", err);
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
return glPromise;
|
|
274
|
+
}
|
|
275
|
+
function WithGL({ children, style, className }) {
|
|
276
|
+
const [ready, setReady] = react.useState(glLoaded);
|
|
277
|
+
react.useEffect(() => {
|
|
278
|
+
if (glLoaded) {
|
|
279
|
+
setReady(true);
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
loadEChartsGL().then(() => setReady(true));
|
|
283
|
+
}, []);
|
|
284
|
+
if (!ready) {
|
|
285
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { style: { ...DEFAULT_STYLE2, ...style, display: "flex", alignItems: "center", justifyContent: "center" }, className, children: /* @__PURE__ */ jsxRuntime.jsx("span", { style: { color: "#9ca3af", fontSize: 14 }, children: "Loading 3D engine..." }) });
|
|
286
|
+
}
|
|
287
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
|
|
288
|
+
}
|
|
289
|
+
var EChart3DInner = react.forwardRef(
|
|
290
|
+
({
|
|
291
|
+
option,
|
|
292
|
+
theme,
|
|
293
|
+
renderer,
|
|
294
|
+
notMerge,
|
|
295
|
+
lazyUpdate,
|
|
296
|
+
showLoading,
|
|
297
|
+
loadingOption,
|
|
298
|
+
onEvents,
|
|
299
|
+
autoResize = true,
|
|
300
|
+
style,
|
|
301
|
+
className,
|
|
302
|
+
...rest
|
|
303
|
+
}, _ref) => {
|
|
304
|
+
const { chartRef } = useECharts({
|
|
305
|
+
option,
|
|
306
|
+
theme,
|
|
307
|
+
renderer,
|
|
308
|
+
notMerge,
|
|
309
|
+
lazyUpdate,
|
|
310
|
+
showLoading,
|
|
311
|
+
loadingOption,
|
|
312
|
+
onEvents,
|
|
313
|
+
autoResize
|
|
314
|
+
});
|
|
315
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
316
|
+
"div",
|
|
317
|
+
{
|
|
318
|
+
ref: chartRef,
|
|
319
|
+
style: { ...DEFAULT_STYLE2, ...style },
|
|
320
|
+
className,
|
|
321
|
+
...rest
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
EChart3DInner.displayName = "EChart3DInner";
|
|
327
|
+
var EChart3DBase = react.forwardRef(
|
|
328
|
+
(props, ref) => {
|
|
329
|
+
const { style, className, ...rest } = props;
|
|
330
|
+
return /* @__PURE__ */ jsxRuntime.jsx(WithGL, { style, className, children: /* @__PURE__ */ jsxRuntime.jsx(EChart3DInner, { ref, style, className, ...rest }) });
|
|
331
|
+
}
|
|
332
|
+
);
|
|
333
|
+
EChart3DBase.displayName = "EChart3D";
|
|
334
|
+
function create3DSeriesComponent(seriesType, displayName) {
|
|
335
|
+
const Component = ({
|
|
336
|
+
data,
|
|
337
|
+
title,
|
|
338
|
+
tooltip = true,
|
|
339
|
+
seriesOptions = {},
|
|
340
|
+
option: extraOption = {},
|
|
341
|
+
style,
|
|
342
|
+
className,
|
|
343
|
+
...rest
|
|
344
|
+
}) => {
|
|
345
|
+
const option = react.useMemo(() => {
|
|
346
|
+
const base = {};
|
|
347
|
+
if (title) {
|
|
348
|
+
base.title = { text: title };
|
|
349
|
+
}
|
|
350
|
+
if (tooltip === true) {
|
|
351
|
+
base.tooltip = {};
|
|
352
|
+
} else if (tooltip && typeof tooltip === "object") {
|
|
353
|
+
base.tooltip = tooltip;
|
|
354
|
+
}
|
|
355
|
+
if (["bar3D", "scatter3D", "line3D", "surface"].includes(seriesType)) {
|
|
356
|
+
base.xAxis3D = { type: "value" };
|
|
357
|
+
base.yAxis3D = { type: "value" };
|
|
358
|
+
base.zAxis3D = { type: "value" };
|
|
359
|
+
base.grid3D = {};
|
|
360
|
+
}
|
|
361
|
+
base.series = [{ type: seriesType, data, ...seriesOptions }];
|
|
362
|
+
return { ...base, ...extraOption };
|
|
363
|
+
}, [data, title, tooltip, seriesOptions, extraOption]);
|
|
364
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
365
|
+
EChart3DBase,
|
|
366
|
+
{
|
|
367
|
+
option,
|
|
368
|
+
style,
|
|
369
|
+
className,
|
|
370
|
+
...rest
|
|
371
|
+
}
|
|
372
|
+
);
|
|
373
|
+
};
|
|
374
|
+
Component.displayName = displayName;
|
|
375
|
+
return Component;
|
|
376
|
+
}
|
|
377
|
+
function createGlobeComponent() {
|
|
378
|
+
const Component = ({
|
|
379
|
+
title,
|
|
380
|
+
globe,
|
|
381
|
+
series = [],
|
|
382
|
+
option: extraOption = {},
|
|
383
|
+
style,
|
|
384
|
+
className,
|
|
385
|
+
...rest
|
|
386
|
+
}) => {
|
|
387
|
+
const option = react.useMemo(() => {
|
|
388
|
+
const base = {};
|
|
389
|
+
if (title) {
|
|
390
|
+
base.title = { text: title };
|
|
391
|
+
}
|
|
392
|
+
base.globe = globe ?? {
|
|
393
|
+
baseTexture: "",
|
|
394
|
+
shading: "lambert",
|
|
395
|
+
atmosphere: { show: true }
|
|
396
|
+
};
|
|
397
|
+
if (series.length > 0) {
|
|
398
|
+
base.series = series;
|
|
399
|
+
}
|
|
400
|
+
return { ...base, ...extraOption };
|
|
401
|
+
}, [title, globe, series, extraOption]);
|
|
402
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
403
|
+
EChart3DBase,
|
|
404
|
+
{
|
|
405
|
+
option,
|
|
406
|
+
style,
|
|
407
|
+
className,
|
|
408
|
+
...rest
|
|
409
|
+
}
|
|
410
|
+
);
|
|
411
|
+
};
|
|
412
|
+
Component.displayName = "EChart3D.Globe";
|
|
413
|
+
return Component;
|
|
414
|
+
}
|
|
415
|
+
var EChart3D = Object.assign(EChart3DBase, {
|
|
416
|
+
Bar: create3DSeriesComponent("bar3D", "EChart3D.Bar"),
|
|
417
|
+
Scatter: create3DSeriesComponent("scatter3D", "EChart3D.Scatter"),
|
|
418
|
+
Line: create3DSeriesComponent("line3D", "EChart3D.Line"),
|
|
419
|
+
Surface: create3DSeriesComponent("surface", "EChart3D.Surface"),
|
|
420
|
+
Globe: createGlobeComponent()
|
|
421
|
+
});
|
|
422
|
+
var DEFAULT_STYLE3 = { width: "100%", height: 400 };
|
|
423
|
+
var EChartGraphic = react.forwardRef(
|
|
424
|
+
({
|
|
425
|
+
elements,
|
|
426
|
+
option: extraOption = {},
|
|
427
|
+
theme,
|
|
428
|
+
renderer,
|
|
429
|
+
notMerge,
|
|
430
|
+
lazyUpdate,
|
|
431
|
+
showLoading,
|
|
432
|
+
loadingOption,
|
|
433
|
+
onEvents,
|
|
434
|
+
autoResize = true,
|
|
435
|
+
style,
|
|
436
|
+
className,
|
|
437
|
+
...rest
|
|
438
|
+
}, _ref) => {
|
|
439
|
+
const option = react.useMemo(() => {
|
|
440
|
+
return {
|
|
441
|
+
graphic: {
|
|
442
|
+
elements
|
|
443
|
+
},
|
|
444
|
+
...extraOption
|
|
445
|
+
};
|
|
446
|
+
}, [elements, extraOption]);
|
|
447
|
+
const { chartRef } = useECharts({
|
|
448
|
+
option,
|
|
449
|
+
theme,
|
|
450
|
+
renderer,
|
|
451
|
+
notMerge,
|
|
452
|
+
lazyUpdate,
|
|
453
|
+
showLoading,
|
|
454
|
+
loadingOption,
|
|
455
|
+
onEvents,
|
|
456
|
+
autoResize
|
|
457
|
+
});
|
|
458
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
459
|
+
"div",
|
|
460
|
+
{
|
|
461
|
+
ref: chartRef,
|
|
462
|
+
style: { ...DEFAULT_STYLE3, ...style },
|
|
463
|
+
className,
|
|
464
|
+
...rest
|
|
465
|
+
}
|
|
466
|
+
);
|
|
467
|
+
}
|
|
468
|
+
);
|
|
469
|
+
EChartGraphic.displayName = "EChartGraphic";
|
|
470
|
+
var allCharts = [
|
|
471
|
+
charts.LineChart,
|
|
472
|
+
charts.BarChart,
|
|
473
|
+
charts.PieChart,
|
|
474
|
+
charts.ScatterChart,
|
|
475
|
+
charts.RadarChart,
|
|
476
|
+
charts.HeatmapChart,
|
|
477
|
+
charts.GaugeChart,
|
|
478
|
+
charts.FunnelChart,
|
|
479
|
+
charts.TreemapChart,
|
|
480
|
+
charts.SunburstChart,
|
|
481
|
+
charts.SankeyChart,
|
|
482
|
+
charts.GraphChart,
|
|
483
|
+
charts.CandlestickChart,
|
|
484
|
+
charts.BoxplotChart,
|
|
485
|
+
charts.ParallelChart,
|
|
486
|
+
charts.ThemeRiverChart,
|
|
487
|
+
charts.MapChart,
|
|
488
|
+
charts.CustomChart,
|
|
489
|
+
charts.EffectScatterChart,
|
|
490
|
+
charts.PictorialBarChart
|
|
491
|
+
];
|
|
492
|
+
var allComponents = [
|
|
493
|
+
components.GridComponent,
|
|
494
|
+
components.TooltipComponent,
|
|
495
|
+
components.TitleComponent,
|
|
496
|
+
components.LegendComponent,
|
|
497
|
+
components.DataZoomComponent,
|
|
498
|
+
components.ToolboxComponent,
|
|
499
|
+
components.VisualMapComponent,
|
|
500
|
+
components.GeoComponent,
|
|
501
|
+
components.ParallelComponent,
|
|
502
|
+
components.CalendarComponent,
|
|
503
|
+
components.GraphicComponent,
|
|
504
|
+
components.PolarComponent,
|
|
505
|
+
components.RadarComponent,
|
|
506
|
+
components.DatasetComponent,
|
|
507
|
+
components.MarkLineComponent,
|
|
508
|
+
components.MarkPointComponent,
|
|
509
|
+
components.MarkAreaComponent,
|
|
510
|
+
components.TimelineComponent,
|
|
511
|
+
components.BrushComponent,
|
|
512
|
+
components.SingleAxisComponent
|
|
513
|
+
];
|
|
514
|
+
var allRenderers = [renderers.CanvasRenderer, renderers.SVGRenderer];
|
|
515
|
+
var registered = false;
|
|
516
|
+
function registerAll() {
|
|
517
|
+
if (registered) return;
|
|
518
|
+
core.use([...allCharts, ...allComponents, ...allRenderers]);
|
|
519
|
+
registered = true;
|
|
520
|
+
}
|
|
521
|
+
function registerCharts(...chartTypes) {
|
|
522
|
+
core.use(chartTypes);
|
|
523
|
+
}
|
|
524
|
+
function registerComponents(...components) {
|
|
525
|
+
core.use(components);
|
|
526
|
+
}
|
|
527
|
+
var darkTheme = {
|
|
528
|
+
backgroundColor: "#1a1a2e",
|
|
529
|
+
textStyle: { color: "#e0e0e0" },
|
|
530
|
+
title: { textStyle: { color: "#ffffff" } },
|
|
531
|
+
legend: { textStyle: { color: "#cccccc" } },
|
|
532
|
+
categoryAxis: {
|
|
533
|
+
axisLine: { lineStyle: { color: "#444" } },
|
|
534
|
+
splitLine: { lineStyle: { color: "#333" } },
|
|
535
|
+
axisLabel: { color: "#aaa" }
|
|
536
|
+
},
|
|
537
|
+
valueAxis: {
|
|
538
|
+
axisLine: { lineStyle: { color: "#444" } },
|
|
539
|
+
splitLine: { lineStyle: { color: "#333" } },
|
|
540
|
+
axisLabel: { color: "#aaa" }
|
|
541
|
+
},
|
|
542
|
+
color: [
|
|
543
|
+
"#5470c6",
|
|
544
|
+
"#91cc75",
|
|
545
|
+
"#fac858",
|
|
546
|
+
"#ee6666",
|
|
547
|
+
"#73c0de",
|
|
548
|
+
"#3ba272",
|
|
549
|
+
"#fc8452",
|
|
550
|
+
"#9a60b4",
|
|
551
|
+
"#ea7ccc"
|
|
552
|
+
]
|
|
553
|
+
};
|
|
554
|
+
var vintageTheme = {
|
|
555
|
+
color: [
|
|
556
|
+
"#d87c7c",
|
|
557
|
+
"#919e8b",
|
|
558
|
+
"#d7ab82",
|
|
559
|
+
"#6e7074",
|
|
560
|
+
"#61a0a8",
|
|
561
|
+
"#efa18d",
|
|
562
|
+
"#787464",
|
|
563
|
+
"#cc7e63",
|
|
564
|
+
"#724e58",
|
|
565
|
+
"#4b565b"
|
|
566
|
+
],
|
|
567
|
+
backgroundColor: "#fef8ef",
|
|
568
|
+
textStyle: {},
|
|
569
|
+
title: { textStyle: { color: "#333333" } },
|
|
570
|
+
categoryAxis: {
|
|
571
|
+
axisLine: { lineStyle: { color: "#ccc" } },
|
|
572
|
+
splitLine: { lineStyle: { color: "#eee" } }
|
|
573
|
+
},
|
|
574
|
+
valueAxis: {
|
|
575
|
+
axisLine: { lineStyle: { color: "#ccc" } },
|
|
576
|
+
splitLine: { lineStyle: { color: "#eee" } }
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
var pastelTheme = {
|
|
580
|
+
color: [
|
|
581
|
+
"#c4b5fd",
|
|
582
|
+
"#a5f3fc",
|
|
583
|
+
"#fca5a5",
|
|
584
|
+
"#fde68a",
|
|
585
|
+
"#a7f3d0",
|
|
586
|
+
"#fbcfe8",
|
|
587
|
+
"#c7d2fe",
|
|
588
|
+
"#fed7aa"
|
|
589
|
+
],
|
|
590
|
+
backgroundColor: "#fafafa",
|
|
591
|
+
textStyle: { color: "#555" },
|
|
592
|
+
title: { textStyle: { color: "#333" } }
|
|
593
|
+
};
|
|
594
|
+
function registerTheme(name, theme) {
|
|
595
|
+
core.registerTheme(name, theme);
|
|
596
|
+
}
|
|
597
|
+
function registerBuiltinThemes() {
|
|
598
|
+
registerTheme("dark-preset", darkTheme);
|
|
599
|
+
registerTheme("vintage", vintageTheme);
|
|
600
|
+
registerTheme("pastel", pastelTheme);
|
|
601
|
+
}
|
|
602
|
+
|
|
603
|
+
Object.defineProperty(exports, "BarChart", {
|
|
604
|
+
enumerable: true,
|
|
605
|
+
get: function () { return charts.BarChart; }
|
|
606
|
+
});
|
|
607
|
+
Object.defineProperty(exports, "BoxplotChart", {
|
|
608
|
+
enumerable: true,
|
|
609
|
+
get: function () { return charts.BoxplotChart; }
|
|
610
|
+
});
|
|
611
|
+
Object.defineProperty(exports, "CandlestickChart", {
|
|
612
|
+
enumerable: true,
|
|
613
|
+
get: function () { return charts.CandlestickChart; }
|
|
614
|
+
});
|
|
615
|
+
Object.defineProperty(exports, "CustomChart", {
|
|
616
|
+
enumerable: true,
|
|
617
|
+
get: function () { return charts.CustomChart; }
|
|
618
|
+
});
|
|
619
|
+
Object.defineProperty(exports, "EffectScatterChart", {
|
|
620
|
+
enumerable: true,
|
|
621
|
+
get: function () { return charts.EffectScatterChart; }
|
|
622
|
+
});
|
|
623
|
+
Object.defineProperty(exports, "FunnelChart", {
|
|
624
|
+
enumerable: true,
|
|
625
|
+
get: function () { return charts.FunnelChart; }
|
|
626
|
+
});
|
|
627
|
+
Object.defineProperty(exports, "GaugeChart", {
|
|
628
|
+
enumerable: true,
|
|
629
|
+
get: function () { return charts.GaugeChart; }
|
|
630
|
+
});
|
|
631
|
+
Object.defineProperty(exports, "GraphChart", {
|
|
632
|
+
enumerable: true,
|
|
633
|
+
get: function () { return charts.GraphChart; }
|
|
634
|
+
});
|
|
635
|
+
Object.defineProperty(exports, "HeatmapChart", {
|
|
636
|
+
enumerable: true,
|
|
637
|
+
get: function () { return charts.HeatmapChart; }
|
|
638
|
+
});
|
|
639
|
+
Object.defineProperty(exports, "LineChart", {
|
|
640
|
+
enumerable: true,
|
|
641
|
+
get: function () { return charts.LineChart; }
|
|
642
|
+
});
|
|
643
|
+
Object.defineProperty(exports, "MapChart", {
|
|
644
|
+
enumerable: true,
|
|
645
|
+
get: function () { return charts.MapChart; }
|
|
646
|
+
});
|
|
647
|
+
Object.defineProperty(exports, "ParallelChart", {
|
|
648
|
+
enumerable: true,
|
|
649
|
+
get: function () { return charts.ParallelChart; }
|
|
650
|
+
});
|
|
651
|
+
Object.defineProperty(exports, "PictorialBarChart", {
|
|
652
|
+
enumerable: true,
|
|
653
|
+
get: function () { return charts.PictorialBarChart; }
|
|
654
|
+
});
|
|
655
|
+
Object.defineProperty(exports, "PieChart", {
|
|
656
|
+
enumerable: true,
|
|
657
|
+
get: function () { return charts.PieChart; }
|
|
658
|
+
});
|
|
659
|
+
Object.defineProperty(exports, "RadarChart", {
|
|
660
|
+
enumerable: true,
|
|
661
|
+
get: function () { return charts.RadarChart; }
|
|
662
|
+
});
|
|
663
|
+
Object.defineProperty(exports, "SankeyChart", {
|
|
664
|
+
enumerable: true,
|
|
665
|
+
get: function () { return charts.SankeyChart; }
|
|
666
|
+
});
|
|
667
|
+
Object.defineProperty(exports, "ScatterChart", {
|
|
668
|
+
enumerable: true,
|
|
669
|
+
get: function () { return charts.ScatterChart; }
|
|
670
|
+
});
|
|
671
|
+
Object.defineProperty(exports, "SunburstChart", {
|
|
672
|
+
enumerable: true,
|
|
673
|
+
get: function () { return charts.SunburstChart; }
|
|
674
|
+
});
|
|
675
|
+
Object.defineProperty(exports, "ThemeRiverChart", {
|
|
676
|
+
enumerable: true,
|
|
677
|
+
get: function () { return charts.ThemeRiverChart; }
|
|
678
|
+
});
|
|
679
|
+
Object.defineProperty(exports, "TreemapChart", {
|
|
680
|
+
enumerable: true,
|
|
681
|
+
get: function () { return charts.TreemapChart; }
|
|
682
|
+
});
|
|
683
|
+
Object.defineProperty(exports, "CalendarComponent", {
|
|
684
|
+
enumerable: true,
|
|
685
|
+
get: function () { return components.CalendarComponent; }
|
|
686
|
+
});
|
|
687
|
+
Object.defineProperty(exports, "DataZoomComponent", {
|
|
688
|
+
enumerable: true,
|
|
689
|
+
get: function () { return components.DataZoomComponent; }
|
|
690
|
+
});
|
|
691
|
+
Object.defineProperty(exports, "DatasetComponent", {
|
|
692
|
+
enumerable: true,
|
|
693
|
+
get: function () { return components.DatasetComponent; }
|
|
694
|
+
});
|
|
695
|
+
Object.defineProperty(exports, "GeoComponent", {
|
|
696
|
+
enumerable: true,
|
|
697
|
+
get: function () { return components.GeoComponent; }
|
|
698
|
+
});
|
|
699
|
+
Object.defineProperty(exports, "GraphicComponent", {
|
|
700
|
+
enumerable: true,
|
|
701
|
+
get: function () { return components.GraphicComponent; }
|
|
702
|
+
});
|
|
703
|
+
Object.defineProperty(exports, "GridComponent", {
|
|
704
|
+
enumerable: true,
|
|
705
|
+
get: function () { return components.GridComponent; }
|
|
706
|
+
});
|
|
707
|
+
Object.defineProperty(exports, "LegendComponent", {
|
|
708
|
+
enumerable: true,
|
|
709
|
+
get: function () { return components.LegendComponent; }
|
|
710
|
+
});
|
|
711
|
+
Object.defineProperty(exports, "PolarComponent", {
|
|
712
|
+
enumerable: true,
|
|
713
|
+
get: function () { return components.PolarComponent; }
|
|
714
|
+
});
|
|
715
|
+
Object.defineProperty(exports, "TitleComponent", {
|
|
716
|
+
enumerable: true,
|
|
717
|
+
get: function () { return components.TitleComponent; }
|
|
718
|
+
});
|
|
719
|
+
Object.defineProperty(exports, "ToolboxComponent", {
|
|
720
|
+
enumerable: true,
|
|
721
|
+
get: function () { return components.ToolboxComponent; }
|
|
722
|
+
});
|
|
723
|
+
Object.defineProperty(exports, "TooltipComponent", {
|
|
724
|
+
enumerable: true,
|
|
725
|
+
get: function () { return components.TooltipComponent; }
|
|
726
|
+
});
|
|
727
|
+
Object.defineProperty(exports, "VisualMapComponent", {
|
|
728
|
+
enumerable: true,
|
|
729
|
+
get: function () { return components.VisualMapComponent; }
|
|
730
|
+
});
|
|
731
|
+
Object.defineProperty(exports, "CanvasRenderer", {
|
|
732
|
+
enumerable: true,
|
|
733
|
+
get: function () { return renderers.CanvasRenderer; }
|
|
734
|
+
});
|
|
735
|
+
Object.defineProperty(exports, "SVGRenderer", {
|
|
736
|
+
enumerable: true,
|
|
737
|
+
get: function () { return renderers.SVGRenderer; }
|
|
738
|
+
});
|
|
739
|
+
exports.EChart = EChart;
|
|
740
|
+
exports.EChart3D = EChart3D;
|
|
741
|
+
exports.EChartGraphic = EChartGraphic;
|
|
742
|
+
exports.darkTheme = darkTheme;
|
|
743
|
+
exports.pastelTheme = pastelTheme;
|
|
744
|
+
exports.registerAll = registerAll;
|
|
745
|
+
exports.registerBuiltinThemes = registerBuiltinThemes;
|
|
746
|
+
exports.registerCharts = registerCharts;
|
|
747
|
+
exports.registerComponents = registerComponents;
|
|
748
|
+
exports.registerTheme = registerTheme;
|
|
749
|
+
exports.useECharts = useECharts;
|
|
750
|
+
exports.useResizeObserver = useResizeObserver;
|
|
751
|
+
exports.vintageTheme = vintageTheme;
|
|
752
|
+
//# sourceMappingURL=index.cjs.map
|
|
753
|
+
//# sourceMappingURL=index.cjs.map
|