win-chart 3.0.0 → 3.0.2
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 +3 -4
- package/dist/cjs/index.cjs +0 -6
- package/dist/cjs/theme/win-dark.cjs +80 -0
- package/dist/cjs/theme/win-light.cjs +80 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/theme/win-dark.js +63 -0
- package/dist/esm/theme/win-light.js +63 -0
- package/dist/types/index.d.ts +4 -2
- package/package.json +8 -8
- package/dist/index.js +0 -1219
- package/dist/types/demos/DualSystemComparisonChart.d.ts +0 -1
- package/dist/types/demos/EastWestResourceComparisonChart.d.ts +0 -1
- package/dist/types/demos/PolicyGrowthChart.d.ts +0 -1
- package/dist/types/demos/PolicyOpennessChart.d.ts +0 -1
- package/dist/types/demos/PracticalUsageTrendChart.d.ts +0 -1
- package/dist/types/demos/index.d.ts +0 -5
package/dist/index.js
DELETED
|
@@ -1,1219 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { styled } from "styled-components";
|
|
3
|
-
import { useEffect, useRef, useState } from "react";
|
|
4
|
-
import { rgba } from "polished";
|
|
5
|
-
import deepmerge from "deepmerge";
|
|
6
|
-
import "echarts-gl";
|
|
7
|
-
import * as __WEBPACK_EXTERNAL_MODULE_echarts__ from "echarts";
|
|
8
|
-
var __webpack_require__ = {};
|
|
9
|
-
(()=>{
|
|
10
|
-
__webpack_require__.d = (exports, definition)=>{
|
|
11
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) Object.defineProperty(exports, key, {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
get: definition[key]
|
|
14
|
-
});
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
(()=>{
|
|
18
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
19
|
-
})();
|
|
20
|
-
(()=>{
|
|
21
|
-
__webpack_require__.r = (exports)=>{
|
|
22
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports, Symbol.toStringTag, {
|
|
23
|
-
value: 'Module'
|
|
24
|
-
});
|
|
25
|
-
Object.defineProperty(exports, '__esModule', {
|
|
26
|
-
value: true
|
|
27
|
-
});
|
|
28
|
-
};
|
|
29
|
-
})();
|
|
30
|
-
var types_namespaceObject = {};
|
|
31
|
-
__webpack_require__.r(types_namespaceObject);
|
|
32
|
-
__webpack_require__.d(types_namespaceObject, {
|
|
33
|
-
f: ()=>types_WinChartType
|
|
34
|
-
});
|
|
35
|
-
const ChartWrapper = styled.div`
|
|
36
|
-
height: 100%;
|
|
37
|
-
`;
|
|
38
|
-
var types_WinChartType = /*#__PURE__*/ function(WinChartType) {
|
|
39
|
-
WinChartType[WinChartType["MINI_AREA"] = 0] = "MINI_AREA";
|
|
40
|
-
WinChartType[WinChartType["AREA"] = 1] = "AREA";
|
|
41
|
-
WinChartType[WinChartType["DUAL_LINE_BAR"] = 2] = "DUAL_LINE_BAR";
|
|
42
|
-
WinChartType[WinChartType["STACK_DUAL_LINE_BAR"] = 3] = "STACK_DUAL_LINE_BAR";
|
|
43
|
-
WinChartType[WinChartType["COLUMN"] = 4] = "COLUMN";
|
|
44
|
-
WinChartType[WinChartType["STACK_COLUMN"] = 5] = "STACK_COLUMN";
|
|
45
|
-
WinChartType[WinChartType["LINE"] = 6] = "LINE";
|
|
46
|
-
WinChartType[WinChartType["BAR"] = 7] = "BAR";
|
|
47
|
-
WinChartType[WinChartType["STACK_BAR"] = 8] = "STACK_BAR";
|
|
48
|
-
WinChartType[WinChartType["FUNNEL"] = 9] = "FUNNEL";
|
|
49
|
-
WinChartType[WinChartType["PIE"] = 10] = "PIE";
|
|
50
|
-
WinChartType[WinChartType["CYCLE"] = 11] = "CYCLE";
|
|
51
|
-
WinChartType[WinChartType["RADAR"] = 12] = "RADAR";
|
|
52
|
-
return WinChartType;
|
|
53
|
-
}({});
|
|
54
|
-
const COLOR_LIST = [
|
|
55
|
-
'#3D84FF',
|
|
56
|
-
'#00DCF0',
|
|
57
|
-
'#FCBC26',
|
|
58
|
-
'#00DB75',
|
|
59
|
-
'#BDB8FF',
|
|
60
|
-
'#40B4FF',
|
|
61
|
-
'#FFA101',
|
|
62
|
-
'#90ABE0',
|
|
63
|
-
'#6EE67A',
|
|
64
|
-
'#6B84FF',
|
|
65
|
-
'#FA6B69'
|
|
66
|
-
];
|
|
67
|
-
const commonOpt = {
|
|
68
|
-
grid: {
|
|
69
|
-
top: 24,
|
|
70
|
-
left: 0,
|
|
71
|
-
right: 12,
|
|
72
|
-
bottom: 32,
|
|
73
|
-
containLabel: true
|
|
74
|
-
},
|
|
75
|
-
color: COLOR_LIST,
|
|
76
|
-
legend: {
|
|
77
|
-
itemWidth: 10,
|
|
78
|
-
itemHeight: 10,
|
|
79
|
-
bottom: 0,
|
|
80
|
-
type: 'scroll',
|
|
81
|
-
icon: 'circle'
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
function isNonEmptyArray(data) {
|
|
85
|
-
return Array.isArray(data) && data.length > 0;
|
|
86
|
-
}
|
|
87
|
-
const handleToPercent = (value, num = 2)=>'number' == typeof value ? `${Number((100 * value).toFixed(num))}%` : '-%';
|
|
88
|
-
function arrDeduplication(data) {
|
|
89
|
-
if (Array.isArray(data)) return [
|
|
90
|
-
...new Set(data)
|
|
91
|
-
];
|
|
92
|
-
return [];
|
|
93
|
-
}
|
|
94
|
-
const arraySum = (list)=>{
|
|
95
|
-
if (Array.isArray(list) && 0 !== list.length) return list.reduce((a, b)=>{
|
|
96
|
-
const temp = Number(b);
|
|
97
|
-
return a + (Object.is(temp, NaN) ? 0 : temp);
|
|
98
|
-
}, 0);
|
|
99
|
-
return 0;
|
|
100
|
-
};
|
|
101
|
-
const checkEntityArr = (data)=>Array.isArray(data) && data.length > 0;
|
|
102
|
-
const dataDescOrder = (data, order = 'desc')=>{
|
|
103
|
-
if (Array.isArray(data) && 'asc' === order) {
|
|
104
|
-
const _data = JSON.parse(JSON.stringify(data));
|
|
105
|
-
return _data.sort((a, b)=>a.value - b.value);
|
|
106
|
-
}
|
|
107
|
-
if (Array.isArray(data) && 'desc' === order) {
|
|
108
|
-
const _data = JSON.parse(JSON.stringify(data));
|
|
109
|
-
return _data.sort((a, b)=>b.value - a.value);
|
|
110
|
-
}
|
|
111
|
-
return data;
|
|
112
|
-
};
|
|
113
|
-
const getAxisOpt = (winChartProps)=>{
|
|
114
|
-
let data = winChartProps.data;
|
|
115
|
-
if (!checkEntityArr(data)) data = winChartProps.extraData;
|
|
116
|
-
return {
|
|
117
|
-
boundaryGap: true,
|
|
118
|
-
axisTick: {
|
|
119
|
-
alignWithLabel: true
|
|
120
|
-
},
|
|
121
|
-
data: arrDeduplication(data?.map((item)=>item.label)),
|
|
122
|
-
axisLabel: {
|
|
123
|
-
rotate: winChartProps.xAxisLabelRotate,
|
|
124
|
-
formatter: (name)=>{
|
|
125
|
-
const configLength = winChartProps.xAxisLabelLength;
|
|
126
|
-
if ('number' == typeof configLength && name.length > configLength) return `${name.slice(0, configLength)}...`;
|
|
127
|
-
return name;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
const sortArray = (arr, order)=>{
|
|
133
|
-
if ('asc' === order) arr.sort((a, b)=>a.value - b.value);
|
|
134
|
-
else if ('desc' === order) arr.sort((a, b)=>b.value - a.value);
|
|
135
|
-
return arr;
|
|
136
|
-
};
|
|
137
|
-
const sortArrayByLabel = (arr, sortedLabels)=>{
|
|
138
|
-
arr.sort((a, b)=>{
|
|
139
|
-
const indexA = sortedLabels.indexOf(a.label);
|
|
140
|
-
const indexB = sortedLabels.indexOf(b.label);
|
|
141
|
-
return indexA - indexB;
|
|
142
|
-
});
|
|
143
|
-
return arr;
|
|
144
|
-
};
|
|
145
|
-
const handleSort = (winChartProps)=>{
|
|
146
|
-
const { data, extraData, sort } = winChartProps;
|
|
147
|
-
if (data && sort) {
|
|
148
|
-
const sortedData = sortArray([
|
|
149
|
-
...data
|
|
150
|
-
], sort);
|
|
151
|
-
const sortedLabels = arrDeduplication(sortedData.map((item)=>item.label));
|
|
152
|
-
const finalSortData = sortArrayByLabel(sortedData, sortedLabels);
|
|
153
|
-
const finalSortedExtraData = sortArrayByLabel([
|
|
154
|
-
...extraData ?? []
|
|
155
|
-
], sortedLabels);
|
|
156
|
-
return {
|
|
157
|
-
...winChartProps,
|
|
158
|
-
data: finalSortData,
|
|
159
|
-
extraData: finalSortedExtraData
|
|
160
|
-
};
|
|
161
|
-
}
|
|
162
|
-
return winChartProps;
|
|
163
|
-
};
|
|
164
|
-
function debounce(func, delay) {
|
|
165
|
-
let timer = null;
|
|
166
|
-
return function(...args) {
|
|
167
|
-
clearTimeout(timer);
|
|
168
|
-
timer = setTimeout(()=>{
|
|
169
|
-
func.apply(globalThis, args);
|
|
170
|
-
}, delay);
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
const mergeSeriesOption = (option, seriesOption)=>{
|
|
174
|
-
if (isNonEmptyArray(option.series) && isNonEmptyArray(seriesOption)) seriesOption.forEach((config)=>{
|
|
175
|
-
option.series = option.series.map((item)=>({
|
|
176
|
-
...item,
|
|
177
|
-
...item.name === config.name && config
|
|
178
|
-
}));
|
|
179
|
-
});
|
|
180
|
-
return option;
|
|
181
|
-
};
|
|
182
|
-
const getLabelColor = (opt)=>'dark' === opt.theme ? 'rgba(255, 255, 255, 0.7)' : 'rgba(0, 0, 0, 0.7)';
|
|
183
|
-
function aggregateStackData(data) {
|
|
184
|
-
const result = data.reduce((acc, item)=>{
|
|
185
|
-
const { label, value } = item;
|
|
186
|
-
if (!acc[label]) acc[label] = 0;
|
|
187
|
-
if (value) acc[label] += Number(value);
|
|
188
|
-
return acc;
|
|
189
|
-
}, {});
|
|
190
|
-
const totals = Object.values(result).map((totalValue)=>parseFloat(totalValue.toFixed(2)));
|
|
191
|
-
return totals;
|
|
192
|
-
}
|
|
193
|
-
const getMiniAreaOpt = (winChartProps)=>{
|
|
194
|
-
const barTypeList = arrDeduplication(winChartProps.data?.map((item)=>item.type));
|
|
195
|
-
const color = winChartProps.color;
|
|
196
|
-
return {
|
|
197
|
-
color,
|
|
198
|
-
grid: {
|
|
199
|
-
top: 4,
|
|
200
|
-
left: 0,
|
|
201
|
-
right: 0,
|
|
202
|
-
bottom: 0,
|
|
203
|
-
containLabel: true
|
|
204
|
-
},
|
|
205
|
-
tooltip: {
|
|
206
|
-
trigger: 'axis',
|
|
207
|
-
axisPointer: {
|
|
208
|
-
type: 'cross',
|
|
209
|
-
label: {
|
|
210
|
-
backgroundColor: '#999'
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
legend: {
|
|
215
|
-
show: false
|
|
216
|
-
},
|
|
217
|
-
xAxis: {
|
|
218
|
-
show: false,
|
|
219
|
-
boundaryGap: false,
|
|
220
|
-
data: arrDeduplication(winChartProps.data?.map((item)=>item.label))
|
|
221
|
-
},
|
|
222
|
-
yAxis: {
|
|
223
|
-
show: false,
|
|
224
|
-
min: winChartProps.yStart?.[0]
|
|
225
|
-
},
|
|
226
|
-
series: [
|
|
227
|
-
...barTypeList.map((name, index)=>{
|
|
228
|
-
const areaColor = color?.[index] ?? COLOR_LIST[index];
|
|
229
|
-
return {
|
|
230
|
-
name,
|
|
231
|
-
type: 'line',
|
|
232
|
-
smooth: true,
|
|
233
|
-
lineStyle: {
|
|
234
|
-
width: 2
|
|
235
|
-
},
|
|
236
|
-
showSymbol: false,
|
|
237
|
-
areaStyle: {
|
|
238
|
-
opacity: 0.8,
|
|
239
|
-
color: new __WEBPACK_EXTERNAL_MODULE_echarts__.graphic.LinearGradient(0, 0, 0, 1, [
|
|
240
|
-
{
|
|
241
|
-
offset: 0,
|
|
242
|
-
color: rgba(areaColor, 0.5)
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
offset: 1,
|
|
246
|
-
color: 'dark' === winChartProps.theme ? rgba('gray', 0.1) : '#fff'
|
|
247
|
-
}
|
|
248
|
-
])
|
|
249
|
-
},
|
|
250
|
-
emphasis: {
|
|
251
|
-
focus: 'series'
|
|
252
|
-
},
|
|
253
|
-
...winChartProps.showLabel && {
|
|
254
|
-
label: {
|
|
255
|
-
show: true,
|
|
256
|
-
formatter: '{c}',
|
|
257
|
-
position: 'top'
|
|
258
|
-
}
|
|
259
|
-
},
|
|
260
|
-
data: winChartProps.data?.filter((item)=>item.type === name).map((item)=>item.value)
|
|
261
|
-
};
|
|
262
|
-
})
|
|
263
|
-
]
|
|
264
|
-
};
|
|
265
|
-
};
|
|
266
|
-
const getAreaOpt = (winChartProps)=>{
|
|
267
|
-
const barTypeList = arrDeduplication(winChartProps.data?.map((item)=>item.type));
|
|
268
|
-
return {
|
|
269
|
-
tooltip: {
|
|
270
|
-
trigger: 'axis',
|
|
271
|
-
axisPointer: {
|
|
272
|
-
type: 'cross',
|
|
273
|
-
label: {
|
|
274
|
-
backgroundColor: '#999'
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
},
|
|
278
|
-
legend: {
|
|
279
|
-
bottom: 0,
|
|
280
|
-
type: 'scroll'
|
|
281
|
-
},
|
|
282
|
-
xAxis: getAxisOpt(winChartProps),
|
|
283
|
-
yAxis: {
|
|
284
|
-
min: winChartProps.yStart?.[0]
|
|
285
|
-
},
|
|
286
|
-
series: [
|
|
287
|
-
...barTypeList.map((name, index)=>{
|
|
288
|
-
const areaColor = COLOR_LIST[index];
|
|
289
|
-
return {
|
|
290
|
-
name,
|
|
291
|
-
type: 'line',
|
|
292
|
-
smooth: true,
|
|
293
|
-
lineStyle: {
|
|
294
|
-
width: 2
|
|
295
|
-
},
|
|
296
|
-
showSymbol: false,
|
|
297
|
-
areaStyle: {
|
|
298
|
-
opacity: 0.8,
|
|
299
|
-
color: new __WEBPACK_EXTERNAL_MODULE_echarts__.graphic.LinearGradient(0, 0, 0, 1, [
|
|
300
|
-
{
|
|
301
|
-
offset: 0,
|
|
302
|
-
color: rgba(areaColor, 0.5)
|
|
303
|
-
},
|
|
304
|
-
{
|
|
305
|
-
offset: 1,
|
|
306
|
-
color: 'dark' === winChartProps.theme ? rgba('gray', 0.1) : '#fff'
|
|
307
|
-
}
|
|
308
|
-
])
|
|
309
|
-
},
|
|
310
|
-
emphasis: {
|
|
311
|
-
focus: 'series'
|
|
312
|
-
},
|
|
313
|
-
...winChartProps.showLabel && {
|
|
314
|
-
label: {
|
|
315
|
-
show: true,
|
|
316
|
-
formatter: '{c}',
|
|
317
|
-
position: 'top'
|
|
318
|
-
},
|
|
319
|
-
showSymbol: true
|
|
320
|
-
},
|
|
321
|
-
data: winChartProps.data?.filter((item)=>item.type === name).map((item)=>item.value)
|
|
322
|
-
};
|
|
323
|
-
})
|
|
324
|
-
]
|
|
325
|
-
};
|
|
326
|
-
};
|
|
327
|
-
const getDualOpt = (winChartProps)=>{
|
|
328
|
-
const barTypeList = arrDeduplication(winChartProps.data?.map((item)=>item.type));
|
|
329
|
-
const lineTypeList = arrDeduplication(winChartProps.extraData?.map((item)=>item.type));
|
|
330
|
-
return {
|
|
331
|
-
tooltip: {
|
|
332
|
-
trigger: 'axis',
|
|
333
|
-
axisPointer: {
|
|
334
|
-
type: 'cross',
|
|
335
|
-
crossStyle: {
|
|
336
|
-
color: '#999'
|
|
337
|
-
},
|
|
338
|
-
label: {
|
|
339
|
-
backgroundColor: '#999'
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
},
|
|
343
|
-
legend: {
|
|
344
|
-
bottom: 0,
|
|
345
|
-
type: 'scroll'
|
|
346
|
-
},
|
|
347
|
-
xAxis: {
|
|
348
|
-
...getAxisOpt(winChartProps),
|
|
349
|
-
axisPointer: {
|
|
350
|
-
type: 'shadow'
|
|
351
|
-
}
|
|
352
|
-
},
|
|
353
|
-
yAxis: [
|
|
354
|
-
{
|
|
355
|
-
alignTicks: true,
|
|
356
|
-
min: winChartProps.yStart?.[0]
|
|
357
|
-
},
|
|
358
|
-
{
|
|
359
|
-
alignTicks: true,
|
|
360
|
-
min: winChartProps.yStart?.[1]
|
|
361
|
-
}
|
|
362
|
-
],
|
|
363
|
-
series: [
|
|
364
|
-
...barTypeList.map((name)=>({
|
|
365
|
-
name,
|
|
366
|
-
type: 'bar',
|
|
367
|
-
barGap: '30%',
|
|
368
|
-
barCategoryGap: '30%',
|
|
369
|
-
barMaxWidth: 8,
|
|
370
|
-
...winChartProps.showLabel && {
|
|
371
|
-
label: {
|
|
372
|
-
show: true,
|
|
373
|
-
formatter: '{c}',
|
|
374
|
-
position: 'top'
|
|
375
|
-
}
|
|
376
|
-
},
|
|
377
|
-
data: winChartProps.data?.filter((item)=>item.type === name).map((item)=>({
|
|
378
|
-
value: item.value,
|
|
379
|
-
itemStyle: {
|
|
380
|
-
borderRadius: item.value > 0 ? [
|
|
381
|
-
500,
|
|
382
|
-
500,
|
|
383
|
-
0,
|
|
384
|
-
0
|
|
385
|
-
] : [
|
|
386
|
-
0,
|
|
387
|
-
0,
|
|
388
|
-
500,
|
|
389
|
-
500
|
|
390
|
-
]
|
|
391
|
-
}
|
|
392
|
-
}))
|
|
393
|
-
})),
|
|
394
|
-
...lineTypeList.map((name)=>({
|
|
395
|
-
name,
|
|
396
|
-
type: 'line',
|
|
397
|
-
smooth: true,
|
|
398
|
-
yAxisIndex: 1,
|
|
399
|
-
showSymbol: false,
|
|
400
|
-
...winChartProps.showLabel && {
|
|
401
|
-
label: {
|
|
402
|
-
show: true,
|
|
403
|
-
formatter: '{c}',
|
|
404
|
-
position: 'top'
|
|
405
|
-
}
|
|
406
|
-
},
|
|
407
|
-
data: winChartProps.extraData?.filter((item)=>item.type === name).map((item)=>item.value)
|
|
408
|
-
}))
|
|
409
|
-
]
|
|
410
|
-
};
|
|
411
|
-
};
|
|
412
|
-
const getStackDualOpt = (winChartProps)=>{
|
|
413
|
-
const barTypeList = arrDeduplication(winChartProps.data?.map((item)=>item.type));
|
|
414
|
-
const lineTypeList = arrDeduplication(winChartProps.extraData?.map((item)=>item.type));
|
|
415
|
-
return {
|
|
416
|
-
tooltip: {
|
|
417
|
-
trigger: 'axis',
|
|
418
|
-
axisPointer: {
|
|
419
|
-
type: 'cross',
|
|
420
|
-
crossStyle: {
|
|
421
|
-
color: '#999'
|
|
422
|
-
},
|
|
423
|
-
label: {
|
|
424
|
-
backgroundColor: '#999'
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
},
|
|
428
|
-
legend: {
|
|
429
|
-
bottom: 0,
|
|
430
|
-
type: 'scroll'
|
|
431
|
-
},
|
|
432
|
-
xAxis: {
|
|
433
|
-
...getAxisOpt(winChartProps),
|
|
434
|
-
axisPointer: {
|
|
435
|
-
type: 'shadow'
|
|
436
|
-
}
|
|
437
|
-
},
|
|
438
|
-
yAxis: [
|
|
439
|
-
{
|
|
440
|
-
alignTicks: true,
|
|
441
|
-
min: winChartProps.yStart?.[0]
|
|
442
|
-
},
|
|
443
|
-
{
|
|
444
|
-
alignTicks: true,
|
|
445
|
-
min: winChartProps.yStart?.[1]
|
|
446
|
-
}
|
|
447
|
-
],
|
|
448
|
-
series: [
|
|
449
|
-
...barTypeList.map((name)=>({
|
|
450
|
-
name,
|
|
451
|
-
type: 'bar',
|
|
452
|
-
stack: 'total',
|
|
453
|
-
barGap: '30%',
|
|
454
|
-
barCategoryGap: '30%',
|
|
455
|
-
barMaxWidth: 8,
|
|
456
|
-
...winChartProps.showLabel && {
|
|
457
|
-
label: {
|
|
458
|
-
show: true,
|
|
459
|
-
formatter: '{c}',
|
|
460
|
-
position: 'top'
|
|
461
|
-
}
|
|
462
|
-
},
|
|
463
|
-
data: winChartProps.data?.filter((item)=>item.type === name).map((item)=>({
|
|
464
|
-
value: item.value
|
|
465
|
-
}))
|
|
466
|
-
})),
|
|
467
|
-
...lineTypeList.map((name)=>({
|
|
468
|
-
name,
|
|
469
|
-
type: 'line',
|
|
470
|
-
smooth: true,
|
|
471
|
-
yAxisIndex: 1,
|
|
472
|
-
showSymbol: false,
|
|
473
|
-
...winChartProps.showLabel && {
|
|
474
|
-
label: {
|
|
475
|
-
show: true,
|
|
476
|
-
formatter: '{c}',
|
|
477
|
-
position: 'top'
|
|
478
|
-
}
|
|
479
|
-
},
|
|
480
|
-
data: winChartProps.extraData?.filter((item)=>item.type === name).map((item)=>item.value)
|
|
481
|
-
}))
|
|
482
|
-
]
|
|
483
|
-
};
|
|
484
|
-
};
|
|
485
|
-
const getPieOpt = (winChartProps)=>{
|
|
486
|
-
const total = arraySum(winChartProps.data?.map((item)=>item.value));
|
|
487
|
-
return {
|
|
488
|
-
tooltip: {
|
|
489
|
-
trigger: 'item'
|
|
490
|
-
},
|
|
491
|
-
legend: {
|
|
492
|
-
bottom: 0,
|
|
493
|
-
type: 'scroll'
|
|
494
|
-
},
|
|
495
|
-
series: [
|
|
496
|
-
{
|
|
497
|
-
top: -30,
|
|
498
|
-
type: 'pie',
|
|
499
|
-
radius: '50%',
|
|
500
|
-
data: dataDescOrder(winChartProps.data)?.map((item)=>({
|
|
501
|
-
value: item.value,
|
|
502
|
-
name: winChartProps.reserveValueWithLabelType ? item.label : item.type
|
|
503
|
-
})),
|
|
504
|
-
label: {
|
|
505
|
-
show: true,
|
|
506
|
-
fontSize: 12,
|
|
507
|
-
color: getLabelColor(winChartProps),
|
|
508
|
-
position: 'outside',
|
|
509
|
-
formatter: (data)=>handleToPercent(data.value / (total || 1))
|
|
510
|
-
},
|
|
511
|
-
emphasis: {
|
|
512
|
-
itemStyle: {
|
|
513
|
-
shadowBlur: 10,
|
|
514
|
-
shadowOffsetX: 0,
|
|
515
|
-
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
]
|
|
520
|
-
};
|
|
521
|
-
};
|
|
522
|
-
const getPieCycleOpt = (winChartProps)=>{
|
|
523
|
-
const total = arraySum(winChartProps.data?.map((item)=>item.value));
|
|
524
|
-
return {
|
|
525
|
-
tooltip: {
|
|
526
|
-
trigger: 'item'
|
|
527
|
-
},
|
|
528
|
-
legend: {
|
|
529
|
-
bottom: 0,
|
|
530
|
-
type: 'scroll'
|
|
531
|
-
},
|
|
532
|
-
series: [
|
|
533
|
-
{
|
|
534
|
-
top: -30,
|
|
535
|
-
type: 'pie',
|
|
536
|
-
radius: [
|
|
537
|
-
'60%',
|
|
538
|
-
'48%'
|
|
539
|
-
],
|
|
540
|
-
data: dataDescOrder(winChartProps.data, winChartProps.sort)?.map((item)=>({
|
|
541
|
-
value: item.value,
|
|
542
|
-
name: winChartProps.reserveValueWithLabelType ? item.label : item.type
|
|
543
|
-
})),
|
|
544
|
-
label: {
|
|
545
|
-
show: true,
|
|
546
|
-
fontSize: 12,
|
|
547
|
-
color: getLabelColor(winChartProps),
|
|
548
|
-
position: 'outside',
|
|
549
|
-
formatter: (data)=>handleToPercent(data.value / (total || 1))
|
|
550
|
-
},
|
|
551
|
-
emphasis: {
|
|
552
|
-
itemStyle: {
|
|
553
|
-
shadowBlur: 10,
|
|
554
|
-
shadowOffsetX: 0,
|
|
555
|
-
shadowColor: 'rgba(0, 0, 0, 0.5)'
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
|
-
],
|
|
560
|
-
graphic: [
|
|
561
|
-
{
|
|
562
|
-
type: 'text',
|
|
563
|
-
left: 'center',
|
|
564
|
-
top: winChartProps.cycleCenterConfig?.content?.top ?? 76,
|
|
565
|
-
style: {
|
|
566
|
-
text: winChartProps.cycleCenterConfig?.content?.value ?? Number(total.toFixed(2)).toString(),
|
|
567
|
-
fill: 'dark' === winChartProps.theme ? '#fff' : '#12161F',
|
|
568
|
-
fontFamily: 'roboto',
|
|
569
|
-
fontSize: winChartProps.cycleCenterConfig?.content?.fontSize ?? 28,
|
|
570
|
-
fontWeight: 'bold'
|
|
571
|
-
}
|
|
572
|
-
},
|
|
573
|
-
{
|
|
574
|
-
type: 'text',
|
|
575
|
-
left: 'center',
|
|
576
|
-
top: winChartProps.cycleCenterConfig?.title?.top ?? 112,
|
|
577
|
-
style: {
|
|
578
|
-
text: winChartProps.cycleCenterConfig?.title?.value ?? "\u603B\u8BA1",
|
|
579
|
-
fill: 'dark' === winChartProps.theme ? '#fff' : '#394252 ',
|
|
580
|
-
fontSize: winChartProps.cycleCenterConfig?.title?.fontSize ?? 14
|
|
581
|
-
}
|
|
582
|
-
}
|
|
583
|
-
]
|
|
584
|
-
};
|
|
585
|
-
};
|
|
586
|
-
const getLineOpt = (winChartProps)=>{
|
|
587
|
-
const typeList = arrDeduplication(winChartProps.data?.map((item)=>item.type));
|
|
588
|
-
return {
|
|
589
|
-
tooltip: {
|
|
590
|
-
trigger: 'axis',
|
|
591
|
-
axisPointer: {
|
|
592
|
-
type: 'cross',
|
|
593
|
-
label: {
|
|
594
|
-
backgroundColor: '#999'
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
},
|
|
598
|
-
legend: {
|
|
599
|
-
bottom: 0,
|
|
600
|
-
type: 'scroll'
|
|
601
|
-
},
|
|
602
|
-
xAxis: getAxisOpt(winChartProps),
|
|
603
|
-
yAxis: {
|
|
604
|
-
min: winChartProps.yStart?.[0]
|
|
605
|
-
},
|
|
606
|
-
series: typeList.map((name)=>({
|
|
607
|
-
name,
|
|
608
|
-
type: 'line',
|
|
609
|
-
smooth: false,
|
|
610
|
-
lineStyle: {
|
|
611
|
-
width: 2
|
|
612
|
-
},
|
|
613
|
-
showSymbol: true,
|
|
614
|
-
emphasis: {
|
|
615
|
-
focus: 'series'
|
|
616
|
-
},
|
|
617
|
-
...winChartProps.showLabel && {
|
|
618
|
-
label: {
|
|
619
|
-
show: true,
|
|
620
|
-
formatter: '{c}',
|
|
621
|
-
position: 'top'
|
|
622
|
-
}
|
|
623
|
-
},
|
|
624
|
-
data: winChartProps.data?.filter((item)=>item.type === name).map((item)=>item.value)
|
|
625
|
-
}))
|
|
626
|
-
};
|
|
627
|
-
};
|
|
628
|
-
const getColumnOpt = (winChartProps)=>{
|
|
629
|
-
const barTypeList = arrDeduplication(winChartProps.data?.map((item)=>item.type));
|
|
630
|
-
return {
|
|
631
|
-
tooltip: {
|
|
632
|
-
trigger: 'axis',
|
|
633
|
-
axisPointer: {
|
|
634
|
-
type: 'cross',
|
|
635
|
-
label: {
|
|
636
|
-
backgroundColor: '#999'
|
|
637
|
-
}
|
|
638
|
-
}
|
|
639
|
-
},
|
|
640
|
-
legend: {
|
|
641
|
-
bottom: 0,
|
|
642
|
-
type: 'scroll'
|
|
643
|
-
},
|
|
644
|
-
xAxis: {
|
|
645
|
-
...getAxisOpt(winChartProps),
|
|
646
|
-
axisPointer: {
|
|
647
|
-
type: 'shadow'
|
|
648
|
-
}
|
|
649
|
-
},
|
|
650
|
-
yAxis: {
|
|
651
|
-
min: winChartProps.yStart?.[0]
|
|
652
|
-
},
|
|
653
|
-
series: barTypeList.map((name)=>({
|
|
654
|
-
name,
|
|
655
|
-
type: 'bar',
|
|
656
|
-
barGap: '30%',
|
|
657
|
-
barCategoryGap: '30%',
|
|
658
|
-
barMaxWidth: 8,
|
|
659
|
-
...winChartProps.showLabel && {
|
|
660
|
-
label: {
|
|
661
|
-
show: true,
|
|
662
|
-
formatter: '{c}',
|
|
663
|
-
position: 'top'
|
|
664
|
-
}
|
|
665
|
-
},
|
|
666
|
-
data: winChartProps.data?.filter((item)=>item.type === name).map((item)=>({
|
|
667
|
-
value: item.value,
|
|
668
|
-
itemStyle: {
|
|
669
|
-
borderRadius: item.value > 0 ? [
|
|
670
|
-
500,
|
|
671
|
-
500,
|
|
672
|
-
0,
|
|
673
|
-
0
|
|
674
|
-
] : [
|
|
675
|
-
0,
|
|
676
|
-
0,
|
|
677
|
-
500,
|
|
678
|
-
500
|
|
679
|
-
]
|
|
680
|
-
}
|
|
681
|
-
}))
|
|
682
|
-
}))
|
|
683
|
-
};
|
|
684
|
-
};
|
|
685
|
-
const getColumnStackOpt = (winChartProps)=>{
|
|
686
|
-
const barTypeList = arrDeduplication(winChartProps.data?.map((item)=>item.type));
|
|
687
|
-
return {
|
|
688
|
-
tooltip: {
|
|
689
|
-
trigger: 'axis',
|
|
690
|
-
axisPointer: {
|
|
691
|
-
type: 'cross',
|
|
692
|
-
label: {
|
|
693
|
-
backgroundColor: '#999'
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
},
|
|
697
|
-
legend: {
|
|
698
|
-
bottom: 0,
|
|
699
|
-
type: 'scroll'
|
|
700
|
-
},
|
|
701
|
-
xAxis: {
|
|
702
|
-
...getAxisOpt(winChartProps),
|
|
703
|
-
axisPointer: {
|
|
704
|
-
type: 'shadow'
|
|
705
|
-
}
|
|
706
|
-
},
|
|
707
|
-
yAxis: {
|
|
708
|
-
min: winChartProps.yStart?.[0]
|
|
709
|
-
},
|
|
710
|
-
series: barTypeList.map((name)=>({
|
|
711
|
-
name,
|
|
712
|
-
type: 'bar',
|
|
713
|
-
stack: 'total',
|
|
714
|
-
barGap: '30%',
|
|
715
|
-
barCategoryGap: '30%',
|
|
716
|
-
barMaxWidth: 8,
|
|
717
|
-
...winChartProps.showLabel && {
|
|
718
|
-
label: {
|
|
719
|
-
show: true,
|
|
720
|
-
formatter: '{c}',
|
|
721
|
-
position: 'top'
|
|
722
|
-
}
|
|
723
|
-
},
|
|
724
|
-
data: winChartProps.data?.filter((item)=>item.type === name).map((item)=>({
|
|
725
|
-
value: item.value
|
|
726
|
-
}))
|
|
727
|
-
}))
|
|
728
|
-
};
|
|
729
|
-
};
|
|
730
|
-
const getFunnelOpt = (winChartProps)=>{
|
|
731
|
-
const data = dataDescOrder(winChartProps.data)?.map((item)=>({
|
|
732
|
-
value: item.value ?? 0,
|
|
733
|
-
name: winChartProps.reserveValueWithLabelType ? item.label : item.type
|
|
734
|
-
})) ?? [];
|
|
735
|
-
const seriesConfig = {
|
|
736
|
-
type: 'funnel',
|
|
737
|
-
minSize: '20%',
|
|
738
|
-
left: 10,
|
|
739
|
-
top: 24,
|
|
740
|
-
width: '76%',
|
|
741
|
-
sort: 'descending',
|
|
742
|
-
data
|
|
743
|
-
};
|
|
744
|
-
return {
|
|
745
|
-
tooltip: {
|
|
746
|
-
trigger: 'item'
|
|
747
|
-
},
|
|
748
|
-
legend: {
|
|
749
|
-
bottom: 0,
|
|
750
|
-
type: 'scroll'
|
|
751
|
-
},
|
|
752
|
-
series: [
|
|
753
|
-
{
|
|
754
|
-
...seriesConfig,
|
|
755
|
-
label: {
|
|
756
|
-
show: true,
|
|
757
|
-
position: 'outer',
|
|
758
|
-
formatter: '{c}'
|
|
759
|
-
}
|
|
760
|
-
},
|
|
761
|
-
{
|
|
762
|
-
...seriesConfig,
|
|
763
|
-
emphasis: {
|
|
764
|
-
label: {
|
|
765
|
-
fontSize: 20
|
|
766
|
-
}
|
|
767
|
-
},
|
|
768
|
-
label: {
|
|
769
|
-
show: true,
|
|
770
|
-
position: 'inner',
|
|
771
|
-
color: '#fff',
|
|
772
|
-
formatter: (params)=>{
|
|
773
|
-
const currentIndex = params.dataIndex;
|
|
774
|
-
if (0 === currentIndex) return '100%';
|
|
775
|
-
const prevValue = data[currentIndex - 1].value;
|
|
776
|
-
return handleToPercent(params.value / prevValue);
|
|
777
|
-
}
|
|
778
|
-
}
|
|
779
|
-
}
|
|
780
|
-
]
|
|
781
|
-
};
|
|
782
|
-
};
|
|
783
|
-
const getBarOpt = (winChartProps)=>{
|
|
784
|
-
const barTypeList = arrDeduplication(winChartProps.data?.map((item)=>item.type));
|
|
785
|
-
return {
|
|
786
|
-
tooltip: {
|
|
787
|
-
trigger: 'axis',
|
|
788
|
-
axisPointer: {
|
|
789
|
-
type: 'cross',
|
|
790
|
-
label: {
|
|
791
|
-
backgroundColor: '#999'
|
|
792
|
-
}
|
|
793
|
-
}
|
|
794
|
-
},
|
|
795
|
-
legend: {
|
|
796
|
-
bottom: 0,
|
|
797
|
-
type: 'scroll'
|
|
798
|
-
},
|
|
799
|
-
xAxis: {},
|
|
800
|
-
yAxis: {
|
|
801
|
-
data: arrDeduplication(winChartProps.data?.map((item)=>item.label)),
|
|
802
|
-
axisTick: {
|
|
803
|
-
alignWithLabel: true
|
|
804
|
-
},
|
|
805
|
-
axisPointer: {
|
|
806
|
-
type: 'shadow'
|
|
807
|
-
},
|
|
808
|
-
min: winChartProps.yStart?.[0],
|
|
809
|
-
axisLabel: {
|
|
810
|
-
rotate: winChartProps.xAxisLabelRotate,
|
|
811
|
-
formatter: (name)=>{
|
|
812
|
-
const configLength = winChartProps.xAxisLabelLength;
|
|
813
|
-
if ('number' == typeof configLength && name.length > configLength) return `${name.slice(0, configLength)}...`;
|
|
814
|
-
return name;
|
|
815
|
-
}
|
|
816
|
-
}
|
|
817
|
-
},
|
|
818
|
-
series: barTypeList.map((name)=>({
|
|
819
|
-
name,
|
|
820
|
-
type: 'bar',
|
|
821
|
-
barGap: '30%',
|
|
822
|
-
barCategoryGap: '30%',
|
|
823
|
-
barMaxWidth: 8,
|
|
824
|
-
...winChartProps.showLabel && {
|
|
825
|
-
label: {
|
|
826
|
-
show: true,
|
|
827
|
-
formatter: '{c}',
|
|
828
|
-
position: 'right'
|
|
829
|
-
}
|
|
830
|
-
},
|
|
831
|
-
data: winChartProps.data?.filter((item)=>item.type === name).map((item)=>({
|
|
832
|
-
value: item.value,
|
|
833
|
-
itemStyle: {
|
|
834
|
-
borderRadius: [
|
|
835
|
-
0,
|
|
836
|
-
500,
|
|
837
|
-
500,
|
|
838
|
-
0
|
|
839
|
-
]
|
|
840
|
-
}
|
|
841
|
-
}))
|
|
842
|
-
}))
|
|
843
|
-
};
|
|
844
|
-
};
|
|
845
|
-
const getStackBarOpt = (winChartProps)=>{
|
|
846
|
-
const barTypeList = arrDeduplication(winChartProps.data?.map((item)=>item.type));
|
|
847
|
-
return {
|
|
848
|
-
grid: {
|
|
849
|
-
...winChartProps.showStackTotal && {
|
|
850
|
-
right: 32
|
|
851
|
-
}
|
|
852
|
-
},
|
|
853
|
-
tooltip: {
|
|
854
|
-
trigger: 'axis',
|
|
855
|
-
axisPointer: {
|
|
856
|
-
type: 'cross',
|
|
857
|
-
label: {
|
|
858
|
-
backgroundColor: '#999'
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
},
|
|
862
|
-
legend: {
|
|
863
|
-
bottom: 0,
|
|
864
|
-
type: 'scroll',
|
|
865
|
-
data: barTypeList
|
|
866
|
-
},
|
|
867
|
-
xAxis: {},
|
|
868
|
-
yAxis: {
|
|
869
|
-
data: arrDeduplication(winChartProps.data?.map((item)=>item.label)),
|
|
870
|
-
axisTick: {
|
|
871
|
-
alignWithLabel: true
|
|
872
|
-
},
|
|
873
|
-
axisPointer: {
|
|
874
|
-
type: 'shadow'
|
|
875
|
-
},
|
|
876
|
-
min: winChartProps.yStart?.[0],
|
|
877
|
-
axisLabel: {
|
|
878
|
-
rotate: winChartProps.xAxisLabelRotate,
|
|
879
|
-
formatter: (name)=>{
|
|
880
|
-
const configLength = winChartProps.xAxisLabelLength;
|
|
881
|
-
if ('number' == typeof configLength && name.length > configLength) return `${name.slice(0, configLength)}...`;
|
|
882
|
-
return name;
|
|
883
|
-
}
|
|
884
|
-
}
|
|
885
|
-
},
|
|
886
|
-
series: [
|
|
887
|
-
...barTypeList.map((name)=>({
|
|
888
|
-
name,
|
|
889
|
-
type: 'bar',
|
|
890
|
-
stack: 'total',
|
|
891
|
-
barGap: '30%',
|
|
892
|
-
barCategoryGap: '30%',
|
|
893
|
-
barMaxWidth: 8,
|
|
894
|
-
...winChartProps.showLabel && !winChartProps.showStackTotal && {
|
|
895
|
-
label: {
|
|
896
|
-
show: true,
|
|
897
|
-
formatter: '{c}',
|
|
898
|
-
position: 'right'
|
|
899
|
-
}
|
|
900
|
-
},
|
|
901
|
-
data: winChartProps.data?.filter((item)=>item.type === name).map((item)=>({
|
|
902
|
-
value: item.value
|
|
903
|
-
}))
|
|
904
|
-
})),
|
|
905
|
-
{
|
|
906
|
-
name: "\u603B\u548C",
|
|
907
|
-
type: 'bar',
|
|
908
|
-
stack: 'abc',
|
|
909
|
-
barGap: '-100%',
|
|
910
|
-
barMaxWidth: 8,
|
|
911
|
-
itemStyle: {
|
|
912
|
-
normal: {
|
|
913
|
-
color: 'transparent'
|
|
914
|
-
}
|
|
915
|
-
},
|
|
916
|
-
tooltip: {
|
|
917
|
-
show: false
|
|
918
|
-
},
|
|
919
|
-
...winChartProps.showStackTotal && {
|
|
920
|
-
label: {
|
|
921
|
-
normal: {
|
|
922
|
-
show: true,
|
|
923
|
-
position: 'right',
|
|
924
|
-
color: '#000'
|
|
925
|
-
},
|
|
926
|
-
formatter: (params)=>String(Number(arraySum(winChartProps.data?.filter((item)=>item.label === params.name).map((item)=>item.value)).toFixed(2)))
|
|
927
|
-
}
|
|
928
|
-
},
|
|
929
|
-
data: aggregateStackData(winChartProps.data)
|
|
930
|
-
}
|
|
931
|
-
]
|
|
932
|
-
};
|
|
933
|
-
};
|
|
934
|
-
const getRadarOpt = (winChartProps)=>{
|
|
935
|
-
const typeList = arrDeduplication(winChartProps.data?.map((item)=>winChartProps.reserveValueWithLabelType ? item.label : item.type));
|
|
936
|
-
return {
|
|
937
|
-
tooltip: {
|
|
938
|
-
trigger: 'item'
|
|
939
|
-
},
|
|
940
|
-
legend: {
|
|
941
|
-
bottom: 0,
|
|
942
|
-
type: 'scroll'
|
|
943
|
-
},
|
|
944
|
-
radar: {
|
|
945
|
-
shape: 'circle',
|
|
946
|
-
radius: '60%',
|
|
947
|
-
indicator: arrDeduplication(winChartProps.data?.map((item)=>winChartProps.reserveValueWithLabelType ? item.type : item.label)).map((name)=>({
|
|
948
|
-
name
|
|
949
|
-
})),
|
|
950
|
-
axisName: {
|
|
951
|
-
color: '#5d677a'
|
|
952
|
-
},
|
|
953
|
-
splitArea: {
|
|
954
|
-
areaStyle: {
|
|
955
|
-
color: [
|
|
956
|
-
'transparent'
|
|
957
|
-
]
|
|
958
|
-
}
|
|
959
|
-
},
|
|
960
|
-
axisLine: {
|
|
961
|
-
lineStyle: {
|
|
962
|
-
color: 'rgba(226, 229, 235, .3)'
|
|
963
|
-
}
|
|
964
|
-
},
|
|
965
|
-
splitLine: {
|
|
966
|
-
lineStyle: {
|
|
967
|
-
color: '#e2e5eb',
|
|
968
|
-
type: 'dashed',
|
|
969
|
-
dashOffset: 1.5
|
|
970
|
-
}
|
|
971
|
-
}
|
|
972
|
-
},
|
|
973
|
-
series: [
|
|
974
|
-
{
|
|
975
|
-
type: 'radar',
|
|
976
|
-
data: typeList.map((name, index)=>({
|
|
977
|
-
name,
|
|
978
|
-
value: winChartProps.data?.filter((item)=>winChartProps.reserveValueWithLabelType ? item.label : item.type === name).map((item)=>item.value),
|
|
979
|
-
areaStyle: {
|
|
980
|
-
color: rgba(COLOR_LIST[index], 0.2)
|
|
981
|
-
},
|
|
982
|
-
label: {
|
|
983
|
-
show: winChartProps.reserveValueWithLabelType,
|
|
984
|
-
formatter: (params)=>params.value?.toString()
|
|
985
|
-
}
|
|
986
|
-
})),
|
|
987
|
-
emphasis: {
|
|
988
|
-
lineStyle: {
|
|
989
|
-
width: 4
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
]
|
|
994
|
-
};
|
|
995
|
-
};
|
|
996
|
-
const getEChartOptions = (originWinChartProps)=>{
|
|
997
|
-
const winChartProps = handleSort(originWinChartProps);
|
|
998
|
-
switch(winChartProps.chartType){
|
|
999
|
-
case types_WinChartType.MINI_AREA:
|
|
1000
|
-
return getMiniAreaOpt(winChartProps);
|
|
1001
|
-
case types_WinChartType.AREA:
|
|
1002
|
-
return getAreaOpt(winChartProps);
|
|
1003
|
-
case types_WinChartType.LINE:
|
|
1004
|
-
return getLineOpt(winChartProps);
|
|
1005
|
-
case types_WinChartType.COLUMN:
|
|
1006
|
-
return getColumnOpt(winChartProps);
|
|
1007
|
-
case types_WinChartType.STACK_COLUMN:
|
|
1008
|
-
return getColumnStackOpt(winChartProps);
|
|
1009
|
-
case types_WinChartType.BAR:
|
|
1010
|
-
return getBarOpt(winChartProps);
|
|
1011
|
-
case types_WinChartType.STACK_BAR:
|
|
1012
|
-
return getStackBarOpt(winChartProps);
|
|
1013
|
-
case types_WinChartType.FUNNEL:
|
|
1014
|
-
return getFunnelOpt(winChartProps);
|
|
1015
|
-
case types_WinChartType.DUAL_LINE_BAR:
|
|
1016
|
-
return getDualOpt(winChartProps);
|
|
1017
|
-
case types_WinChartType.STACK_DUAL_LINE_BAR:
|
|
1018
|
-
return getStackDualOpt(winChartProps);
|
|
1019
|
-
case types_WinChartType.PIE:
|
|
1020
|
-
return getPieOpt(winChartProps);
|
|
1021
|
-
case types_WinChartType.CYCLE:
|
|
1022
|
-
return getPieCycleOpt(winChartProps);
|
|
1023
|
-
case types_WinChartType.RADAR:
|
|
1024
|
-
return getRadarOpt(winChartProps);
|
|
1025
|
-
default:
|
|
1026
|
-
return {};
|
|
1027
|
-
}
|
|
1028
|
-
};
|
|
1029
|
-
var win_light_namespaceObject = JSON.parse('{"color":["#3379ff","#00dcf0","#ffc94d","#00db75","#b8b3ff","#40b4ff","#ffa101","#90abe0","#6ee67a","#6b84ff","#fa6b69"],"backgroundColor":"rgba(0,0,0,0)","textStyle":{},"title":{"textStyle":{"color":"#272f3d"},"subtextStyle":{"color":"#394252"}},"line":{"itemStyle":{"borderWidth":1},"lineStyle":{"width":2},"symbolSize":4,"symbol":"emptyCircle","smooth":false},"radar":{"itemStyle":{"borderWidth":1},"lineStyle":{"width":2},"symbolSize":4,"symbol":"emptyCircle","smooth":false},"bar":{"itemStyle":{"barBorderWidth":"0","barBorderColor":"#cccccc"}},"pie":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"scatter":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"boxplot":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"parallel":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"sankey":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"funnel":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"gauge":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"candlestick":{"itemStyle":{"color":"#f15451","color0":"#00c267","borderColor":"#f15451","borderColor0":"#00c267","borderWidth":1}},"graph":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"},"lineStyle":{"width":"1","color":"#dfe3eb"},"symbolSize":4,"symbol":"emptyCircle","smooth":false,"color":["#3379ff","#00dcf0","#ffc94d","#00db75","#b8b3ff","#40b4ff","#ffa101","#90abe0","#6ee67a","#6b84ff","#fa6b69"],"label":{"color":"#ffffff"}},"map":{"itemStyle":{"areaColor":"#eee","borderColor":"#444","borderWidth":0.5},"label":{"color":"#000"},"emphasis":{"itemStyle":{"areaColor":"rgba(255,215,0,0.8)","borderColor":"#444","borderWidth":1},"label":{"color":"rgb(100,0,0)"}}},"geo":{"itemStyle":{"areaColor":"#eee","borderColor":"#444","borderWidth":0.5},"label":{"color":"#000"},"emphasis":{"itemStyle":{"areaColor":"rgba(255,215,0,0.8)","borderColor":"#444","borderWidth":1},"label":{"color":"rgb(100,0,0)"}}},"categoryAxis":{"axisLine":{"show":true,"lineStyle":{"color":"#eef0f5"}},"axisTick":{"show":true,"lineStyle":{"color":"#eef0f5"}},"axisLabel":{"show":true,"color":"#828b9e"},"splitLine":{"show":false,"lineStyle":{"color":["#E0E6F1"]}},"splitArea":{"show":false,"areaStyle":{"color":["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},"valueAxis":{"axisLine":{"show":false,"lineStyle":{"color":"#6E7079"}},"axisTick":{"show":false,"lineStyle":{"color":"#6E7079"}},"axisLabel":{"show":true,"color":"#828b9e"},"splitLine":{"show":true,"lineStyle":{"color":["#eef0f5"]}},"splitArea":{"show":false,"areaStyle":{"color":["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},"logAxis":{"axisLine":{"show":false,"lineStyle":{"color":"#6E7079"}},"axisTick":{"show":false,"lineStyle":{"color":"#6E7079"}},"axisLabel":{"show":true,"color":"#828b9e"},"splitLine":{"show":true,"lineStyle":{"color":["#eef0f5"]}},"splitArea":{"show":false,"areaStyle":{"color":["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},"timeAxis":{"axisLine":{"show":true,"lineStyle":{"color":"#eef0f5"}},"axisTick":{"show":true,"lineStyle":{"color":"#eef0f5"}},"axisLabel":{"show":true,"color":"#828b9e"},"splitLine":{"show":false,"lineStyle":{"color":["#E0E6F1"]}},"splitArea":{"show":false,"areaStyle":{"color":["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},"toolbox":{"iconStyle":{"borderColor":"#828c9e"},"emphasis":{"iconStyle":{"borderColor":"#394252"}}},"legend":{"textStyle":{"color":"#828b9e"}},"tooltip":{"axisPointer":{"lineStyle":{"color":"#ccd1db","width":"1"},"crossStyle":{"color":"#ccd1db","width":"1"}}},"timeline":{"lineStyle":{"color":"#eef0f5","width":2},"itemStyle":{"color":"#eef0f5","borderWidth":"1"},"controlStyle":{"color":"#828c9e","borderColor":"#828c9e","borderWidth":1},"checkpointStyle":{"color":"#3379ff","borderColor":"#ffffff"},"label":{"color":"#b1b9c7"},"emphasis":{"itemStyle":{"color":"#3379ff"},"controlStyle":{"color":"#828c9e","borderColor":"#828c9e","borderWidth":1},"label":{"color":"#b1b9c7"}}},"visualMap":{"color":["#062379","#2058d2","#3379ff","#a0cbff","#e8f4ff"]},"dataZoom":{"handleSize":"undefined%","textStyle":{}},"markPoint":{"label":{"color":"#ffffff"},"emphasis":{"label":{"color":"#ffffff"}}}}');
|
|
1030
|
-
var win_dark_namespaceObject = JSON.parse('{"color":["#5798ff","#00dcf0","#ffc94d","#00db75","#b8b3ff","#40b4ff","#ffa101","#90abe0","#6ee67a","#6b84ff","#fa6b69"],"backgroundColor":"transparent","textStyle":{},"title":{"textStyle":{"color":"#ffffff"},"subtextStyle":{"color":"#ffffff"}},"line":{"itemStyle":{"borderWidth":"1"},"lineStyle":{"width":"2"},"symbolSize":"6","symbol":"emptyCircle","smooth":true},"radar":{"itemStyle":{"borderWidth":"1"},"lineStyle":{"width":"2"},"symbolSize":"6","symbol":"emptyCircle","smooth":true},"bar":{"itemStyle":{"barBorderWidth":"0","barBorderColor":"#cccccc"}},"pie":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"scatter":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"boxplot":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"parallel":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"sankey":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"funnel":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"gauge":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"}},"candlestick":{"itemStyle":{"color":"#f15451","color0":"#00c267","borderColor":"#f15451","borderColor0":"#00c267","borderWidth":1}},"graph":{"itemStyle":{"borderWidth":"0","borderColor":"#cccccc"},"lineStyle":{"width":"1","color":"#ffffff"},"symbolSize":"6","symbol":"emptyCircle","smooth":true,"color":["#5798ff","#00dcf0","#ffc94d","#00db75","#b8b3ff","#40b4ff","#ffa101","#90abe0","#6ee67a","#6b84ff","#fa6b69"],"label":{"color":"#ffffff"}},"map":{"itemStyle":{"areaColor":"#eee","borderColor":"#444","borderWidth":0.5},"label":{"color":"#000"},"emphasis":{"itemStyle":{"areaColor":"rgba(255,215,0,0.8)","borderColor":"#444","borderWidth":1},"label":{"color":"rgb(100,0,0)"}}},"geo":{"itemStyle":{"areaColor":"#eee","borderColor":"#444","borderWidth":0.5},"label":{"color":"#000"},"emphasis":{"itemStyle":{"areaColor":"rgba(255,215,0,0.8)","borderColor":"#444","borderWidth":1},"label":{"color":"rgb(100,0,0)"}}},"categoryAxis":{"axisLine":{"show":true,"lineStyle":{"color":"rgba(255,255,255,0.12)"}},"axisTick":{"show":true,"lineStyle":{"color":"rgba(255,255,255,0.12)"}},"axisLabel":{"show":true,"color":"rgba(255,255,255,0.5)"},"splitLine":{"show":false,"lineStyle":{"color":["#E0E6F1"]}},"splitArea":{"show":false,"areaStyle":{"color":["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},"valueAxis":{"axisLine":{"show":false,"lineStyle":{"color":"#6E7079"}},"axisTick":{"show":false,"lineStyle":{"color":"#6E7079"}},"axisLabel":{"show":true,"color":"rgba(255,255,255,0.5)"},"splitLine":{"show":true,"lineStyle":{"color":["rgba(255,255,255,0.12)"]}},"splitArea":{"show":false,"areaStyle":{"color":["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},"logAxis":{"axisLine":{"show":false,"lineStyle":{"color":"#6E7079"}},"axisTick":{"show":false,"lineStyle":{"color":"#6E7079"}},"axisLabel":{"show":true,"color":"rgba(255,255,255,0.5)"},"splitLine":{"show":true,"lineStyle":{"color":["rgba(255,255,255,0.12)"]}},"splitArea":{"show":false,"areaStyle":{"color":["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},"timeAxis":{"axisLine":{"show":true,"lineStyle":{"color":"rgba(255,255,255,0.12)"}},"axisTick":{"show":true,"lineStyle":{"color":"rgba(255,255,255,0.12)"}},"axisLabel":{"show":true,"color":"rgba(255,255,255,0.5)"},"splitLine":{"show":false,"lineStyle":{"color":["#E0E6F1"]}},"splitArea":{"show":false,"areaStyle":{"color":["rgba(250,250,250,0.2)","rgba(210,219,238,0.2)"]}}},"toolbox":{"iconStyle":{"borderColor":"#ffffff"},"emphasis":{"iconStyle":{"borderColor":"#ffffff"}}},"legend":{"textStyle":{"color":"#ffffff"}},"tooltip":{"axisPointer":{"lineStyle":{"color":"#ffffff","width":"1"},"crossStyle":{"color":"#ffffff","width":"1"}}},"timeline":{"lineStyle":{"color":"#ffffff","width":2},"itemStyle":{"color":"#ffffff","borderWidth":"1"},"controlStyle":{"color":"#ffffff","borderColor":"#ffffff","borderWidth":1},"checkpointStyle":{"color":"#5798ff","borderColor":"#ffffff"},"label":{"color":"#ffffff"},"emphasis":{"itemStyle":{"color":"#5798ff"},"controlStyle":{"color":"#ffffff","borderColor":"#ffffff","borderWidth":1},"label":{"color":"#ffffff"}}},"visualMap":{"color":["#062379","#2058d2","#3379ff","#a0cbff","#e8f4ff"]},"dataZoom":{"handleSize":"undefined%","textStyle":{}},"markPoint":{"label":{"color":"#ffffff"},"emphasis":{"label":{"color":"#ffffff"}}}}');
|
|
1031
|
-
__WEBPACK_EXTERNAL_MODULE_echarts__.registerTheme('light', deepmerge(win_light_namespaceObject, commonOpt));
|
|
1032
|
-
__WEBPACK_EXTERNAL_MODULE_echarts__.registerTheme('dark', deepmerge(win_dark_namespaceObject, commonOpt));
|
|
1033
|
-
const mergeOption = {
|
|
1034
|
-
arrayMerge: (_destinationArray, sourceArray)=>sourceArray
|
|
1035
|
-
};
|
|
1036
|
-
const WinChart = (props)=>{
|
|
1037
|
-
const boxRef = useRef(null);
|
|
1038
|
-
const [instance, setInstance] = useState();
|
|
1039
|
-
useEffect(()=>{
|
|
1040
|
-
const chart = __WEBPACK_EXTERNAL_MODULE_echarts__.init(boxRef.current, props.theme ?? 'light');
|
|
1041
|
-
setInstance(chart);
|
|
1042
|
-
const resize = debounce(chart.resize, 500);
|
|
1043
|
-
const handlerResize = ()=>resize();
|
|
1044
|
-
globalThis.addEventListener('resize', handlerResize);
|
|
1045
|
-
return ()=>{
|
|
1046
|
-
globalThis.removeEventListener('resize', handlerResize);
|
|
1047
|
-
};
|
|
1048
|
-
}, [
|
|
1049
|
-
props.theme
|
|
1050
|
-
]);
|
|
1051
|
-
useEffect(()=>{
|
|
1052
|
-
if (instance) {
|
|
1053
|
-
const actualChartHeight = instance.getHeight() - 48;
|
|
1054
|
-
const newProps = {
|
|
1055
|
-
...props,
|
|
1056
|
-
...props.chartType === types_WinChartType.CYCLE && !props.cycleCenterConfig && {
|
|
1057
|
-
cycleCenterConfig: {
|
|
1058
|
-
title: {
|
|
1059
|
-
top: actualChartHeight / 2 + 24
|
|
1060
|
-
},
|
|
1061
|
-
content: {
|
|
1062
|
-
top: actualChartHeight / 2 - 8
|
|
1063
|
-
}
|
|
1064
|
-
}
|
|
1065
|
-
}
|
|
1066
|
-
};
|
|
1067
|
-
const { extraOption = {}, extraSeriesOption } = newProps;
|
|
1068
|
-
instance.clear();
|
|
1069
|
-
const option = deepmerge(mergeSeriesOption(getEChartOptions(newProps), extraSeriesOption), extraOption, mergeOption);
|
|
1070
|
-
instance.setOption(option);
|
|
1071
|
-
newProps.onLoad?.(instance);
|
|
1072
|
-
const timer = setTimeout(()=>{
|
|
1073
|
-
instance.resize();
|
|
1074
|
-
}, 500);
|
|
1075
|
-
return ()=>{
|
|
1076
|
-
clearTimeout(timer);
|
|
1077
|
-
};
|
|
1078
|
-
}
|
|
1079
|
-
}, [
|
|
1080
|
-
instance,
|
|
1081
|
-
props
|
|
1082
|
-
]);
|
|
1083
|
-
return /*#__PURE__*/ jsx(ChartWrapper, {
|
|
1084
|
-
ref: boxRef,
|
|
1085
|
-
className: props.className,
|
|
1086
|
-
style: props.style
|
|
1087
|
-
});
|
|
1088
|
-
};
|
|
1089
|
-
const mockPointsData = [];
|
|
1090
|
-
for(let i = 0; i < 50; i++)mockPointsData.push({
|
|
1091
|
-
name: `\u{6D4B}\u{8BD5}${i + 1}`,
|
|
1092
|
-
value: [
|
|
1093
|
-
150 * Math.random(),
|
|
1094
|
-
50 * Math.random()
|
|
1095
|
-
],
|
|
1096
|
-
symbolSize: 8
|
|
1097
|
-
});
|
|
1098
|
-
const mockLinesData = [];
|
|
1099
|
-
for(let i = 0; i < 10; i++)mockLinesData.push([
|
|
1100
|
-
[
|
|
1101
|
-
150 * Math.random(),
|
|
1102
|
-
50 * Math.random()
|
|
1103
|
-
],
|
|
1104
|
-
[
|
|
1105
|
-
150 * Math.random(),
|
|
1106
|
-
50 * Math.random()
|
|
1107
|
-
]
|
|
1108
|
-
]);
|
|
1109
|
-
const EarthChart = ({ className = '', style = {}, extraOption = {}, lineStyles = {}, pointsStyles = {}, pointsData = [], linesData = [], globeOption = {} })=>{
|
|
1110
|
-
const boxRef = useRef(null);
|
|
1111
|
-
const [eChart, setEChart] = useState();
|
|
1112
|
-
useEffect(()=>{
|
|
1113
|
-
const eChart = __WEBPACK_EXTERNAL_MODULE_echarts__.init(boxRef.current);
|
|
1114
|
-
setEChart(eChart);
|
|
1115
|
-
const resize = debounce(eChart.resize, 500);
|
|
1116
|
-
const handlerResize = ()=>{
|
|
1117
|
-
resize();
|
|
1118
|
-
};
|
|
1119
|
-
globalThis.addEventListener('resize', handlerResize);
|
|
1120
|
-
return ()=>{
|
|
1121
|
-
globalThis.removeEventListener('resize', handlerResize);
|
|
1122
|
-
};
|
|
1123
|
-
}, []);
|
|
1124
|
-
useEffect(()=>{
|
|
1125
|
-
if (eChart) {
|
|
1126
|
-
const series = [];
|
|
1127
|
-
series.push({
|
|
1128
|
-
type: 'lines3D',
|
|
1129
|
-
name: "lines3D",
|
|
1130
|
-
effect: {
|
|
1131
|
-
show: true,
|
|
1132
|
-
trailWidth: 2,
|
|
1133
|
-
trailLength: 0.15,
|
|
1134
|
-
trailOpacity: 1,
|
|
1135
|
-
trailColor: 'rgb(30, 30, 60)'
|
|
1136
|
-
},
|
|
1137
|
-
lineStyle: {
|
|
1138
|
-
width: 5,
|
|
1139
|
-
color: 'rgb(50, 50, 150)',
|
|
1140
|
-
opacity: 0.3
|
|
1141
|
-
},
|
|
1142
|
-
blendMode: 'lighter',
|
|
1143
|
-
data: linesData,
|
|
1144
|
-
...lineStyles
|
|
1145
|
-
});
|
|
1146
|
-
series.push({
|
|
1147
|
-
type: 'scatter3D',
|
|
1148
|
-
coordinateSystem: 'globe',
|
|
1149
|
-
zlevel: 3,
|
|
1150
|
-
rippleEffect: {
|
|
1151
|
-
brushType: 'stroke'
|
|
1152
|
-
},
|
|
1153
|
-
label: {
|
|
1154
|
-
fontSize: 8,
|
|
1155
|
-
show: true,
|
|
1156
|
-
position: 'right',
|
|
1157
|
-
formatter: '{b}'
|
|
1158
|
-
},
|
|
1159
|
-
itemStyle: {
|
|
1160
|
-
normal: {
|
|
1161
|
-
color: '#f5f802'
|
|
1162
|
-
}
|
|
1163
|
-
},
|
|
1164
|
-
data: pointsData,
|
|
1165
|
-
...pointsStyles
|
|
1166
|
-
});
|
|
1167
|
-
eChart.setOption({
|
|
1168
|
-
backgroundColor: '#000',
|
|
1169
|
-
baseColor: '#000',
|
|
1170
|
-
shading: 'realistic',
|
|
1171
|
-
globe: {
|
|
1172
|
-
environment: 'https://img.alicdn.com/imgextra/i2/O1CN017x8UE61p6wqej1Y0c_!!6000000005312-0-tps-2048-1024.jpg',
|
|
1173
|
-
heightTexture: 'https://img.alicdn.com/imgextra/i2/O1CN01BB16kM1ILFttfdYZg_!!6000000000876-0-tps-4096-2048.jpg',
|
|
1174
|
-
baseTexture: 'https://img.alicdn.com/imgextra/i4/O1CN01fs70Dq25ElSd8mU6C_!!6000000007495-0-tps-5400-2700.jpg',
|
|
1175
|
-
shading: 'lambert',
|
|
1176
|
-
light: {
|
|
1177
|
-
ambient: {
|
|
1178
|
-
intensity: 1
|
|
1179
|
-
},
|
|
1180
|
-
main: {
|
|
1181
|
-
intensity: 0.1
|
|
1182
|
-
}
|
|
1183
|
-
},
|
|
1184
|
-
viewControl: {
|
|
1185
|
-
autoRotate: true,
|
|
1186
|
-
distance: 230
|
|
1187
|
-
},
|
|
1188
|
-
left: '20%',
|
|
1189
|
-
...globeOption
|
|
1190
|
-
},
|
|
1191
|
-
series: series,
|
|
1192
|
-
...extraOption
|
|
1193
|
-
});
|
|
1194
|
-
const timer = setTimeout(()=>{
|
|
1195
|
-
eChart.resize();
|
|
1196
|
-
}, 500);
|
|
1197
|
-
return ()=>{
|
|
1198
|
-
clearTimeout(timer);
|
|
1199
|
-
};
|
|
1200
|
-
}
|
|
1201
|
-
}, [
|
|
1202
|
-
eChart,
|
|
1203
|
-
extraOption,
|
|
1204
|
-
globeOption,
|
|
1205
|
-
lineStyles,
|
|
1206
|
-
linesData,
|
|
1207
|
-
pointsData,
|
|
1208
|
-
pointsStyles
|
|
1209
|
-
]);
|
|
1210
|
-
return /*#__PURE__*/ jsx(ChartWrapper, {
|
|
1211
|
-
ref: boxRef,
|
|
1212
|
-
className: className,
|
|
1213
|
-
style: style
|
|
1214
|
-
});
|
|
1215
|
-
};
|
|
1216
|
-
const src = WinChart;
|
|
1217
|
-
var __webpack_exports__IChartInfo = types_namespaceObject.IChartInfo;
|
|
1218
|
-
var __webpack_exports__IWinChartProps = types_namespaceObject.IWinChartProps;
|
|
1219
|
-
export { EarthChart, WinChart, types_WinChartType as WinChartType, src as default, __WEBPACK_EXTERNAL_MODULE_echarts__ as echarts, __webpack_exports__IChartInfo as IChartInfo, __webpack_exports__IWinChartProps as IWinChartProps };
|