win-chart 3.0.2 → 3.0.3
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/dist/bun/index.js +5 -0
- package/dist/bun/index.js.map +25 -0
- package/dist/bun/types/components/ChartWrapper.d.ts +1 -0
- package/dist/bun/types/components/EarthChart.d.ts +15 -0
- package/dist/bun/types/components/GanttChart.d.ts +8 -0
- package/dist/bun/types/components/WinChart.d.ts +2 -0
- package/dist/bun/types/components/__tests__/Playground.test.d.ts +1 -0
- package/dist/bun/types/components/__tests__/WinChart.test.d.ts +1 -0
- package/dist/bun/types/index.d.ts +8 -0
- package/dist/bun/types/types/index.d.ts +126 -0
- package/dist/bun/types/utils/const.d.ts +14 -0
- package/dist/bun/types/utils/data.d.ts +20 -0
- package/dist/bun/types/utils/earthMockData.d.ts +7 -0
- package/dist/bun/types/utils/getAreaSpec.d.ts +14 -0
- package/dist/bun/types/utils/getBarSpec.d.ts +14 -0
- package/dist/bun/types/utils/getChartOptions.d.ts +7 -0
- package/dist/bun/types/utils/getColumnSpec.d.ts +14 -0
- package/dist/bun/types/utils/getDualSpec.d.ts +14 -0
- package/dist/bun/types/utils/getFunnelSpec.d.ts +8 -0
- package/dist/bun/types/utils/getLineSpec.d.ts +8 -0
- package/dist/bun/types/utils/getPieSpec.d.ts +13 -0
- package/dist/bun/types/utils/getRadarSpec.d.ts +7 -0
- package/dist/bun/types/utils/tool.d.ts +140 -0
- package/dist/cjs/components/__tests__/Playground.test.cjs +90 -0
- package/dist/cjs/components/__tests__/WinChart.test.cjs +112 -0
- package/dist/cjs/stories/WinChart.stories.cjs +524 -0
- package/dist/cjs/utils/const.cjs +21 -0
- package/dist/cjs/utils/getAreaSpec.cjs +2 -18
- package/dist/cjs/utils/getBarSpec.cjs +7 -21
- package/dist/cjs/utils/getColumnSpec.cjs +3 -18
- package/dist/cjs/utils/getDualSpec.cjs +3 -24
- package/dist/cjs/utils/getFunnelSpec.cjs +2 -3
- package/dist/cjs/utils/getLineSpec.cjs +2 -9
- package/dist/cjs/utils/getPieSpec.cjs +3 -6
- package/dist/cjs/utils/getRadarSpec.cjs +1 -3
- package/dist/cjs/utils/tool.cjs +7 -4
- package/dist/esm/components/__tests__/Playground.test.js +84 -0
- package/dist/esm/components/__tests__/WinChart.test.js +106 -0
- package/dist/esm/stories/WinChart.stories.js +466 -0
- package/dist/esm/utils/const.js +16 -1
- package/dist/esm/utils/getAreaSpec.js +3 -19
- package/dist/esm/utils/getBarSpec.js +8 -22
- package/dist/esm/utils/getColumnSpec.js +3 -18
- package/dist/esm/utils/getDualSpec.js +3 -24
- package/dist/esm/utils/getFunnelSpec.js +2 -3
- package/dist/esm/utils/getLineSpec.js +2 -9
- package/dist/esm/utils/getPieSpec.js +3 -6
- package/dist/esm/utils/getRadarSpec.js +2 -4
- package/dist/esm/utils/tool.js +7 -4
- package/dist/types/components/__tests__/Playground.test.d.ts +1 -0
- package/dist/types/components/__tests__/WinChart.test.d.ts +1 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/types/index.d.ts +1 -2
- package/dist/types/utils/const.d.ts +6 -0
- package/dist/types/utils/getDualSpec.d.ts +1 -0
- package/dist/types/utils/tool.d.ts +2 -1
- package/package.json +28 -6
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { WinChart } from "../components/WinChart.js";
|
|
3
|
+
import { WinChartType } from "../types/index.js";
|
|
4
|
+
const meta = {
|
|
5
|
+
title: '图表组件/WinChart',
|
|
6
|
+
component: WinChart,
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: 'centered'
|
|
9
|
+
},
|
|
10
|
+
tags: [
|
|
11
|
+
'autodocs'
|
|
12
|
+
],
|
|
13
|
+
argTypes: {
|
|
14
|
+
chartType: {
|
|
15
|
+
control: 'select',
|
|
16
|
+
options: Object.values(WinChartType),
|
|
17
|
+
description: '图表类型',
|
|
18
|
+
table: {
|
|
19
|
+
type: {
|
|
20
|
+
summary: 'string'
|
|
21
|
+
},
|
|
22
|
+
defaultValue: {
|
|
23
|
+
summary: 'line'
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
theme: {
|
|
28
|
+
control: 'radio',
|
|
29
|
+
options: [
|
|
30
|
+
'light',
|
|
31
|
+
'dark'
|
|
32
|
+
],
|
|
33
|
+
description: '主题',
|
|
34
|
+
table: {
|
|
35
|
+
type: {
|
|
36
|
+
summary: 'string'
|
|
37
|
+
},
|
|
38
|
+
defaultValue: {
|
|
39
|
+
summary: 'light'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
data: {
|
|
44
|
+
description: '图表数据'
|
|
45
|
+
},
|
|
46
|
+
extraOption: {
|
|
47
|
+
description: 'ECharts 扩展配置'
|
|
48
|
+
},
|
|
49
|
+
color: {
|
|
50
|
+
description: '颜色列表'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
decorators: [
|
|
54
|
+
(Story)=>/*#__PURE__*/ jsx("div", {
|
|
55
|
+
style: {
|
|
56
|
+
width: '800px',
|
|
57
|
+
height: '500px'
|
|
58
|
+
},
|
|
59
|
+
children: /*#__PURE__*/ jsx(Story, {})
|
|
60
|
+
})
|
|
61
|
+
]
|
|
62
|
+
};
|
|
63
|
+
const WinChart_stories = meta;
|
|
64
|
+
const LineChart = {
|
|
65
|
+
args: {
|
|
66
|
+
chartType: WinChartType.LINE,
|
|
67
|
+
data: [
|
|
68
|
+
{
|
|
69
|
+
label: '1961',
|
|
70
|
+
value: 0,
|
|
71
|
+
type: '统考认可州数(个)'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
label: '2000',
|
|
75
|
+
value: 0,
|
|
76
|
+
type: '统考认可州数(个)'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
label: '2019',
|
|
80
|
+
value: 5,
|
|
81
|
+
type: '统考认可州数(个)'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
label: '2025',
|
|
85
|
+
value: 5,
|
|
86
|
+
type: '统考认可州数(个)'
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
label: '1961',
|
|
90
|
+
value: 22,
|
|
91
|
+
type: '国中华语开课率(%)'
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
label: '2000',
|
|
95
|
+
value: 40,
|
|
96
|
+
type: '国中华语开课率(%)'
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
label: '2019',
|
|
100
|
+
value: 65,
|
|
101
|
+
type: '国中华语开课率(%)'
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
label: '2025',
|
|
105
|
+
value: 88,
|
|
106
|
+
type: '国中华语开课率(%)'
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
color: [
|
|
110
|
+
'#ff4d4f',
|
|
111
|
+
'#52c41a'
|
|
112
|
+
],
|
|
113
|
+
extraOption: {
|
|
114
|
+
title: {
|
|
115
|
+
text: '中文政策核心指标增长趋势',
|
|
116
|
+
left: 'center'
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
const BarChart = {
|
|
122
|
+
args: {
|
|
123
|
+
chartType: WinChartType.BAR,
|
|
124
|
+
data: [
|
|
125
|
+
{
|
|
126
|
+
label: '政府经费依赖度',
|
|
127
|
+
value: 0,
|
|
128
|
+
type: '华文独立体系(独中)(%)'
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
label: '非华裔参与率',
|
|
132
|
+
value: 12,
|
|
133
|
+
type: '华文独立体系(独中)(%)'
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: '政府经费依赖度',
|
|
137
|
+
value: 85,
|
|
138
|
+
type: '国民教育体系(国中)(%)'
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
label: '非华裔参与率',
|
|
142
|
+
value: 38,
|
|
143
|
+
type: '国民教育体系(国中)(%)'
|
|
144
|
+
}
|
|
145
|
+
],
|
|
146
|
+
extraOption: {
|
|
147
|
+
title: {
|
|
148
|
+
text: '双轨体系核心数据对比',
|
|
149
|
+
left: 'center'
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
const ColumnChart = {
|
|
155
|
+
args: {
|
|
156
|
+
chartType: WinChartType.COLUMN,
|
|
157
|
+
data: [
|
|
158
|
+
{
|
|
159
|
+
label: 'Jan',
|
|
160
|
+
value: 100,
|
|
161
|
+
type: 'Sales'
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
label: 'Feb',
|
|
165
|
+
value: 120,
|
|
166
|
+
type: 'Sales'
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
label: 'Mar',
|
|
170
|
+
value: 150,
|
|
171
|
+
type: 'Sales'
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
label: 'Jan',
|
|
175
|
+
value: 80,
|
|
176
|
+
type: 'Profit'
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
label: 'Feb',
|
|
180
|
+
value: 90,
|
|
181
|
+
type: 'Profit'
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
label: 'Mar',
|
|
185
|
+
value: 110,
|
|
186
|
+
type: 'Profit'
|
|
187
|
+
}
|
|
188
|
+
],
|
|
189
|
+
extraOption: {
|
|
190
|
+
title: {
|
|
191
|
+
text: 'Monthly Sales & Profit',
|
|
192
|
+
left: 'center'
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
const StackColumnChart = {
|
|
198
|
+
args: {
|
|
199
|
+
chartType: WinChartType.STACK_COLUMN,
|
|
200
|
+
data: [
|
|
201
|
+
{
|
|
202
|
+
label: 'Mon',
|
|
203
|
+
value: 120,
|
|
204
|
+
type: 'Email'
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
label: 'Tue',
|
|
208
|
+
value: 132,
|
|
209
|
+
type: 'Email'
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
label: 'Wed',
|
|
213
|
+
value: 101,
|
|
214
|
+
type: 'Email'
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
label: 'Mon',
|
|
218
|
+
value: 220,
|
|
219
|
+
type: 'Ad'
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
label: 'Tue',
|
|
223
|
+
value: 182,
|
|
224
|
+
type: 'Ad'
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
label: 'Wed',
|
|
228
|
+
value: 191,
|
|
229
|
+
type: 'Ad'
|
|
230
|
+
}
|
|
231
|
+
],
|
|
232
|
+
extraOption: {
|
|
233
|
+
title: {
|
|
234
|
+
text: 'Traffic Sources',
|
|
235
|
+
left: 'center'
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
};
|
|
240
|
+
const PieChart = {
|
|
241
|
+
args: {
|
|
242
|
+
chartType: WinChartType.PIE,
|
|
243
|
+
data: [
|
|
244
|
+
{
|
|
245
|
+
label: 'Search Engine',
|
|
246
|
+
value: 1048,
|
|
247
|
+
type: 'Search Engine'
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
label: 'Direct',
|
|
251
|
+
value: 735,
|
|
252
|
+
type: 'Direct'
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
label: 'Email',
|
|
256
|
+
value: 580,
|
|
257
|
+
type: 'Email'
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
label: 'Union Ads',
|
|
261
|
+
value: 484,
|
|
262
|
+
type: 'Union Ads'
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
label: 'Video Ads',
|
|
266
|
+
value: 300,
|
|
267
|
+
type: 'Video Ads'
|
|
268
|
+
}
|
|
269
|
+
],
|
|
270
|
+
extraOption: {
|
|
271
|
+
title: {
|
|
272
|
+
text: 'Referer of a Website',
|
|
273
|
+
left: 'center'
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
};
|
|
278
|
+
const RadarChart = {
|
|
279
|
+
args: {
|
|
280
|
+
chartType: WinChartType.RADAR,
|
|
281
|
+
data: [
|
|
282
|
+
{
|
|
283
|
+
label: 'Sales',
|
|
284
|
+
value: 4200,
|
|
285
|
+
type: 'Allocated Budget'
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
label: 'Administration',
|
|
289
|
+
value: 3000,
|
|
290
|
+
type: 'Allocated Budget'
|
|
291
|
+
},
|
|
292
|
+
{
|
|
293
|
+
label: 'IT',
|
|
294
|
+
value: 20000,
|
|
295
|
+
type: 'Allocated Budget'
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
label: 'Customer Support',
|
|
299
|
+
value: 35000,
|
|
300
|
+
type: 'Allocated Budget'
|
|
301
|
+
},
|
|
302
|
+
{
|
|
303
|
+
label: 'Development',
|
|
304
|
+
value: 50000,
|
|
305
|
+
type: 'Allocated Budget'
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
label: 'Marketing',
|
|
309
|
+
value: 18000,
|
|
310
|
+
type: 'Allocated Budget'
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
label: 'Sales',
|
|
314
|
+
value: 5000,
|
|
315
|
+
type: 'Actual Spending'
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
label: 'Administration',
|
|
319
|
+
value: 14000,
|
|
320
|
+
type: 'Actual Spending'
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
label: 'IT',
|
|
324
|
+
value: 28000,
|
|
325
|
+
type: 'Actual Spending'
|
|
326
|
+
},
|
|
327
|
+
{
|
|
328
|
+
label: 'Customer Support',
|
|
329
|
+
value: 26000,
|
|
330
|
+
type: 'Actual Spending'
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
label: 'Development',
|
|
334
|
+
value: 42000,
|
|
335
|
+
type: 'Actual Spending'
|
|
336
|
+
},
|
|
337
|
+
{
|
|
338
|
+
label: 'Marketing',
|
|
339
|
+
value: 21000,
|
|
340
|
+
type: 'Actual Spending'
|
|
341
|
+
}
|
|
342
|
+
],
|
|
343
|
+
extraOption: {
|
|
344
|
+
title: {
|
|
345
|
+
text: 'Budget vs Spending',
|
|
346
|
+
left: 'center'
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
const FunnelChart = {
|
|
352
|
+
args: {
|
|
353
|
+
chartType: WinChartType.FUNNEL,
|
|
354
|
+
data: [
|
|
355
|
+
{
|
|
356
|
+
label: 'Visit',
|
|
357
|
+
value: 60,
|
|
358
|
+
type: 'Visit'
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
label: 'Inquiry',
|
|
362
|
+
value: 40,
|
|
363
|
+
type: 'Inquiry'
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
label: 'Order',
|
|
367
|
+
value: 20,
|
|
368
|
+
type: 'Order'
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
label: 'Click',
|
|
372
|
+
value: 80,
|
|
373
|
+
type: 'Click'
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
label: 'Show',
|
|
377
|
+
value: 100,
|
|
378
|
+
type: 'Show'
|
|
379
|
+
}
|
|
380
|
+
],
|
|
381
|
+
extraOption: {
|
|
382
|
+
title: {
|
|
383
|
+
text: 'Funnel',
|
|
384
|
+
left: 'center'
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
};
|
|
389
|
+
const DualAxisChart = {
|
|
390
|
+
args: {
|
|
391
|
+
chartType: WinChartType.DUAL_LINE_BAR,
|
|
392
|
+
data: [
|
|
393
|
+
{
|
|
394
|
+
label: '2015',
|
|
395
|
+
value: 2.0,
|
|
396
|
+
type: 'Evaporation'
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
label: '2016',
|
|
400
|
+
value: 4.9,
|
|
401
|
+
type: 'Evaporation'
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
label: '2017',
|
|
405
|
+
value: 7.0,
|
|
406
|
+
type: 'Evaporation'
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
label: '2018',
|
|
410
|
+
value: 23.2,
|
|
411
|
+
type: 'Evaporation'
|
|
412
|
+
}
|
|
413
|
+
],
|
|
414
|
+
extraData: [
|
|
415
|
+
{
|
|
416
|
+
label: '2015',
|
|
417
|
+
value: 2.6,
|
|
418
|
+
type: 'Temperature'
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
label: '2016',
|
|
422
|
+
value: 5.9,
|
|
423
|
+
type: 'Temperature'
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
label: '2017',
|
|
427
|
+
value: 9.0,
|
|
428
|
+
type: 'Temperature'
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
label: '2018',
|
|
432
|
+
value: 26.4,
|
|
433
|
+
type: 'Temperature'
|
|
434
|
+
}
|
|
435
|
+
],
|
|
436
|
+
extraOption: {
|
|
437
|
+
title: {
|
|
438
|
+
text: 'Rainfall vs Evaporation',
|
|
439
|
+
left: 'center'
|
|
440
|
+
},
|
|
441
|
+
yAxis: [
|
|
442
|
+
{
|
|
443
|
+
type: 'value',
|
|
444
|
+
name: 'Evaporation',
|
|
445
|
+
min: 0,
|
|
446
|
+
max: 250,
|
|
447
|
+
interval: 50,
|
|
448
|
+
axisLabel: {
|
|
449
|
+
formatter: '{value} ml'
|
|
450
|
+
}
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
type: 'value',
|
|
454
|
+
name: 'Temperature',
|
|
455
|
+
min: 0,
|
|
456
|
+
max: 25,
|
|
457
|
+
interval: 5,
|
|
458
|
+
axisLabel: {
|
|
459
|
+
formatter: '{value} °C'
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
]
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
};
|
|
466
|
+
export { BarChart, ColumnChart, DualAxisChart, FunnelChart, LineChart, PieChart, RadarChart, StackColumnChart, WinChart_stories as default };
|
package/dist/esm/utils/const.js
CHANGED
|
@@ -28,4 +28,19 @@ const commonOpt = {
|
|
|
28
28
|
icon: 'circle'
|
|
29
29
|
}
|
|
30
30
|
};
|
|
31
|
-
|
|
31
|
+
const COMMON_TOOLTIP_OPT = {
|
|
32
|
+
trigger: 'axis',
|
|
33
|
+
axisPointer: {
|
|
34
|
+
type: 'cross',
|
|
35
|
+
crossStyle: {
|
|
36
|
+
color: '#999'
|
|
37
|
+
},
|
|
38
|
+
label: {
|
|
39
|
+
backgroundColor: '#999'
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
const ITEM_TOOLTIP_OPT = {
|
|
44
|
+
trigger: 'item'
|
|
45
|
+
};
|
|
46
|
+
export { COLOR_LIST, COMMON_TOOLTIP_OPT, ITEM_TOOLTIP_OPT, commonOpt };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { COLOR_LIST } from "./const.js";
|
|
1
|
+
import { COLOR_LIST, COMMON_TOOLTIP_OPT } from "./const.js";
|
|
2
2
|
import { getDataTypes, getGradientColor, getMainAxisLabels, getSeriesDataByType, getSeriesLabelConfig, getXAxisOpt } from "./tool.js";
|
|
3
3
|
const getMiniAreaOpt = (winChartProps)=>{
|
|
4
4
|
const areaTypeList = getDataTypes(winChartProps);
|
|
@@ -12,15 +12,7 @@ const getMiniAreaOpt = (winChartProps)=>{
|
|
|
12
12
|
bottom: 0,
|
|
13
13
|
containLabel: true
|
|
14
14
|
},
|
|
15
|
-
tooltip:
|
|
16
|
-
trigger: 'axis',
|
|
17
|
-
axisPointer: {
|
|
18
|
-
type: 'cross',
|
|
19
|
-
label: {
|
|
20
|
-
backgroundColor: '#999'
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
15
|
+
tooltip: COMMON_TOOLTIP_OPT,
|
|
24
16
|
legend: {
|
|
25
17
|
show: false
|
|
26
18
|
},
|
|
@@ -61,15 +53,7 @@ const getMiniAreaOpt = (winChartProps)=>{
|
|
|
61
53
|
const getAreaOpt = (winChartProps)=>{
|
|
62
54
|
const areaTypeList = getDataTypes(winChartProps);
|
|
63
55
|
return {
|
|
64
|
-
tooltip:
|
|
65
|
-
trigger: 'axis',
|
|
66
|
-
axisPointer: {
|
|
67
|
-
type: 'cross',
|
|
68
|
-
label: {
|
|
69
|
-
backgroundColor: '#999'
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
56
|
+
tooltip: COMMON_TOOLTIP_OPT,
|
|
73
57
|
legend: {
|
|
74
58
|
bottom: 0,
|
|
75
59
|
type: 'scroll'
|
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { aggregateStackData,
|
|
1
|
+
import { aggregateStackData, getDataTypes, getMainAxisLabels, getSeriesDataByType, getSeriesLabelConfig, handleMainAxisLabel } from "./tool.js";
|
|
2
|
+
import { COMMON_TOOLTIP_OPT } from "./const.js";
|
|
2
3
|
const getBarOpt = (winChartProps)=>({
|
|
3
|
-
tooltip:
|
|
4
|
-
trigger: 'axis',
|
|
5
|
-
axisPointer: {
|
|
6
|
-
type: 'cross',
|
|
7
|
-
label: {
|
|
8
|
-
backgroundColor: '#999'
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
},
|
|
4
|
+
tooltip: COMMON_TOOLTIP_OPT,
|
|
12
5
|
legend: {
|
|
13
6
|
bottom: 0,
|
|
14
7
|
type: 'scroll'
|
|
@@ -53,21 +46,14 @@ const getBarOpt = (winChartProps)=>({
|
|
|
53
46
|
});
|
|
54
47
|
const getStackBarOpt = (winChartProps)=>{
|
|
55
48
|
const barTypeList = getDataTypes(winChartProps);
|
|
49
|
+
const axisLabels = getMainAxisLabels(winChartProps);
|
|
56
50
|
return {
|
|
57
51
|
grid: {
|
|
58
52
|
...winChartProps.showStackTotal && {
|
|
59
53
|
right: 32
|
|
60
54
|
}
|
|
61
55
|
},
|
|
62
|
-
tooltip:
|
|
63
|
-
trigger: 'axis',
|
|
64
|
-
axisPointer: {
|
|
65
|
-
type: 'cross',
|
|
66
|
-
label: {
|
|
67
|
-
backgroundColor: '#999'
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
},
|
|
56
|
+
tooltip: COMMON_TOOLTIP_OPT,
|
|
71
57
|
legend: {
|
|
72
58
|
bottom: 0,
|
|
73
59
|
type: 'scroll',
|
|
@@ -75,7 +61,7 @@ const getStackBarOpt = (winChartProps)=>{
|
|
|
75
61
|
},
|
|
76
62
|
xAxis: {},
|
|
77
63
|
yAxis: {
|
|
78
|
-
data:
|
|
64
|
+
data: axisLabels,
|
|
79
65
|
axisTick: {
|
|
80
66
|
alignWithLabel: true
|
|
81
67
|
},
|
|
@@ -124,9 +110,9 @@ const getStackBarOpt = (winChartProps)=>{
|
|
|
124
110
|
position: 'right',
|
|
125
111
|
color: '#000'
|
|
126
112
|
},
|
|
127
|
-
formatter:
|
|
113
|
+
formatter: '{c}'
|
|
128
114
|
},
|
|
129
|
-
data: aggregateStackData(winChartProps.data ?? [])
|
|
115
|
+
data: aggregateStackData(winChartProps.data ?? [], axisLabels)
|
|
130
116
|
}
|
|
131
117
|
]
|
|
132
118
|
};
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { getDataTypes, getSeriesDataByType, getSeriesLabelConfig, getXAxisOpt } from "./tool.js";
|
|
2
|
+
import { COMMON_TOOLTIP_OPT } from "./const.js";
|
|
2
3
|
const getColumnOpt = (winChartProps)=>{
|
|
3
4
|
const barTypeList = getDataTypes(winChartProps);
|
|
4
5
|
return {
|
|
5
|
-
tooltip:
|
|
6
|
-
trigger: 'axis',
|
|
7
|
-
axisPointer: {
|
|
8
|
-
type: 'cross',
|
|
9
|
-
label: {
|
|
10
|
-
backgroundColor: '#999'
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
},
|
|
6
|
+
tooltip: COMMON_TOOLTIP_OPT,
|
|
14
7
|
legend: {
|
|
15
8
|
bottom: 0,
|
|
16
9
|
type: 'scroll'
|
|
@@ -53,15 +46,7 @@ const getColumnOpt = (winChartProps)=>{
|
|
|
53
46
|
const getColumnStackOpt = (winChartProps)=>{
|
|
54
47
|
const barTypeList = getDataTypes(winChartProps);
|
|
55
48
|
return {
|
|
56
|
-
tooltip:
|
|
57
|
-
trigger: 'axis',
|
|
58
|
-
axisPointer: {
|
|
59
|
-
type: 'cross',
|
|
60
|
-
label: {
|
|
61
|
-
backgroundColor: '#999'
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
},
|
|
49
|
+
tooltip: COMMON_TOOLTIP_OPT,
|
|
65
50
|
legend: {
|
|
66
51
|
bottom: 0,
|
|
67
52
|
type: 'scroll'
|
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
import { getDataTypes, getExtraDataTypes, getSeriesDataByType, getSeriesLabelConfig, getXAxisOpt } from "./tool.js";
|
|
2
|
+
import { COMMON_TOOLTIP_OPT } from "./const.js";
|
|
2
3
|
const getDualOpt = (winChartProps)=>{
|
|
3
4
|
const barTypeList = getDataTypes(winChartProps);
|
|
4
5
|
const lineTypeList = getExtraDataTypes(winChartProps);
|
|
5
6
|
return {
|
|
6
|
-
tooltip:
|
|
7
|
-
trigger: 'axis',
|
|
8
|
-
axisPointer: {
|
|
9
|
-
type: 'cross',
|
|
10
|
-
crossStyle: {
|
|
11
|
-
color: '#999'
|
|
12
|
-
},
|
|
13
|
-
label: {
|
|
14
|
-
backgroundColor: '#999'
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
7
|
+
tooltip: COMMON_TOOLTIP_OPT,
|
|
18
8
|
legend: {
|
|
19
9
|
bottom: 0,
|
|
20
10
|
type: 'scroll'
|
|
@@ -76,18 +66,7 @@ const getStackDualOpt = (winChartProps)=>{
|
|
|
76
66
|
const barTypeList = getDataTypes(winChartProps);
|
|
77
67
|
const lineTypeList = getExtraDataTypes(winChartProps);
|
|
78
68
|
return {
|
|
79
|
-
tooltip:
|
|
80
|
-
trigger: 'axis',
|
|
81
|
-
axisPointer: {
|
|
82
|
-
type: 'cross',
|
|
83
|
-
crossStyle: {
|
|
84
|
-
color: '#999'
|
|
85
|
-
},
|
|
86
|
-
label: {
|
|
87
|
-
backgroundColor: '#999'
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
},
|
|
69
|
+
tooltip: COMMON_TOOLTIP_OPT,
|
|
91
70
|
legend: {
|
|
92
71
|
bottom: 0,
|
|
93
72
|
type: 'scroll'
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { dataDescOrder, handleToPercent } from "./tool.js";
|
|
2
|
+
import { ITEM_TOOLTIP_OPT } from "./const.js";
|
|
2
3
|
const getFunnelOpt = (winChartProps)=>{
|
|
3
4
|
const data = dataDescOrder(winChartProps.data)?.map((item)=>({
|
|
4
5
|
value: item.value ?? 0,
|
|
@@ -14,9 +15,7 @@ const getFunnelOpt = (winChartProps)=>{
|
|
|
14
15
|
data
|
|
15
16
|
};
|
|
16
17
|
return {
|
|
17
|
-
tooltip:
|
|
18
|
-
trigger: 'item'
|
|
19
|
-
},
|
|
18
|
+
tooltip: ITEM_TOOLTIP_OPT,
|
|
20
19
|
legend: {
|
|
21
20
|
bottom: 0,
|
|
22
21
|
type: 'scroll'
|
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
import { getDataTypes, getSeriesDataByType, getSeriesLabelConfig, getXAxisOpt } from "./tool.js";
|
|
2
|
+
import { COMMON_TOOLTIP_OPT } from "./const.js";
|
|
2
3
|
const getLineOpt = (winChartProps)=>{
|
|
3
4
|
const typeList = getDataTypes(winChartProps);
|
|
4
5
|
return {
|
|
5
|
-
tooltip:
|
|
6
|
-
trigger: 'axis',
|
|
7
|
-
axisPointer: {
|
|
8
|
-
type: 'cross',
|
|
9
|
-
label: {
|
|
10
|
-
backgroundColor: '#999'
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
},
|
|
6
|
+
tooltip: COMMON_TOOLTIP_OPT,
|
|
14
7
|
legend: {
|
|
15
8
|
bottom: 0,
|
|
16
9
|
type: 'scroll'
|