win-chart 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/.eslintrc.json +3 -0
  2. package/.prettierrc.json +5 -0
  3. package/README.md +0 -0
  4. package/localhost-key.pem +28 -0
  5. package/localhost.pem +25 -0
  6. package/package.json +65 -0
  7. package/rsbuild.config.ts +48 -0
  8. package/src/api/README.md +15 -0
  9. package/src/api/index.js +5 -0
  10. package/src/api/layout/index.js +32 -0
  11. package/src/api/request.ts +87 -0
  12. package/src/api/url-map/index.js +10 -0
  13. package/src/api/user/index.js +12 -0
  14. package/src/components/FilterContext.tsx +6 -0
  15. package/src/components/GlobalStyle.tsx +25 -0
  16. package/src/components/HalfScreenBrowser.tsx +95 -0
  17. package/src/components/ImgBox.tsx +19 -0
  18. package/src/components/JumpBtn.tsx +38 -0
  19. package/src/components/MCardWrapper.tsx +33 -0
  20. package/src/components/NoContent/index.tsx +85 -0
  21. package/src/components/ResponsiveReactGridLayout.tsx +218 -0
  22. package/src/components/SliderDecoration.tsx +27 -0
  23. package/src/components/VisionUserConfigContext.ts +6 -0
  24. package/src/components/WinMenu/README.md +11 -0
  25. package/src/components/WinMenu/WinHeader.tsx +5 -0
  26. package/src/components/WinMenu/components/ExtraBox.tsx +61 -0
  27. package/src/components/WinMenu/components/FullMenuBox.tsx +80 -0
  28. package/src/components/WinMenu/components/FullMenuContainer.tsx +50 -0
  29. package/src/components/WinMenu/components/FullMenuItem.tsx +128 -0
  30. package/src/components/WinMenu/components/LangSwitch.tsx +84 -0
  31. package/src/components/WinMenu/components/LogoBox.tsx +29 -0
  32. package/src/components/WinMenu/components/PinDialog.tsx +72 -0
  33. package/src/components/WinMenu/components/PinnedMenuBox.tsx +183 -0
  34. package/src/components/WinMenu/components/UserBox.tsx +83 -0
  35. package/src/components/WinMenu/hooks/useUserInfo.ts +21 -0
  36. package/src/components/WinMenu/hooks/useUserMenu.ts +35 -0
  37. package/src/components/WinMenu/index.tsx +100 -0
  38. package/src/components/WinMenu/services/WinService.ts +79 -0
  39. package/src/components/WinMenu/services/request.ts +53 -0
  40. package/src/components/WinMenu/utils/const.ts +80 -0
  41. package/src/components/WinMenu/utils/enum.ts +19 -0
  42. package/src/components/WinMenu/utils/interface.ts +61 -0
  43. package/src/components/WinMenu/utils/map.ts +39 -0
  44. package/src/components/WinMenu/utils/tool.ts +142 -0
  45. package/src/components/WinMenu/utils/type.ts +1 -0
  46. package/src/components/hover-view.tsx +48 -0
  47. package/src/components/icon.tsx +44 -0
  48. package/src/components/indicator-remark.tsx +25 -0
  49. package/src/components/none-content.tsx +93 -0
  50. package/src/components/panel-tab.tsx +150 -0
  51. package/src/components/panel-title-tab.tsx +60 -0
  52. package/src/components/win-card/components/ChartContent.tsx +47 -0
  53. package/src/components/win-card/components/Indicator.tsx +42 -0
  54. package/src/components/win-card/components/IndicatorArea.tsx +63 -0
  55. package/src/components/win-card/components/IndicatorInfo.tsx +78 -0
  56. package/src/components/win-card/components/MatterContent.tsx +121 -0
  57. package/src/components/win-card/components/MatterList.tsx +141 -0
  58. package/src/components/win-card/components/NoticeContent.tsx +73 -0
  59. package/src/components/win-card/components/NoticeList.tsx +68 -0
  60. package/src/components/win-card/components/SelectDecoration.tsx +34 -0
  61. package/src/components/win-card/components/WinRankContent.tsx +102 -0
  62. package/src/components/win-card/index.tsx +298 -0
  63. package/src/components/win-card/utils/interface.ts +12 -0
  64. package/src/components/win-card/utils/tool.ts +11 -0
  65. package/src/components/win-card-mobile/components/ChartContent.tsx +47 -0
  66. package/src/components/win-card-mobile/components/DualLineBar.tsx +61 -0
  67. package/src/components/win-card-mobile/components/Indicator.tsx +42 -0
  68. package/src/components/win-card-mobile/components/IndicatorArea.tsx +65 -0
  69. package/src/components/win-card-mobile/components/IndicatorInfo.tsx +83 -0
  70. package/src/components/win-card-mobile/components/SelectDecoration.tsx +28 -0
  71. package/src/components/win-card-mobile/index.tsx +235 -0
  72. package/src/components/win-card-mobile/utils/interface.ts +12 -0
  73. package/src/components/win-card-mobile/utils/tool.ts +9 -0
  74. package/src/components/win-chart/components/chart-wrapper.tsx +5 -0
  75. package/src/components/win-chart/index.tsx +59 -0
  76. package/src/components/win-chart/theme/win-dark.json +372 -0
  77. package/src/components/win-chart/theme/win-light.json +372 -0
  78. package/src/components/win-chart/utils/const.ts +37 -0
  79. package/src/components/win-chart/utils/getAreaSpec.ts +150 -0
  80. package/src/components/win-chart/utils/getBarSpec.ts +60 -0
  81. package/src/components/win-chart/utils/getChartOptions.ts +59 -0
  82. package/src/components/win-chart/utils/getColumnSpec.ts +112 -0
  83. package/src/components/win-chart/utils/getDualSpec.ts +79 -0
  84. package/src/components/win-chart/utils/getFunnelSpec.ts +70 -0
  85. package/src/components/win-chart/utils/getLineSpec.ts +53 -0
  86. package/src/components/win-chart/utils/getPieSpec.ts +124 -0
  87. package/src/components/win-chart/utils/getRadarSpec.ts +87 -0
  88. package/src/components/win-chart/utils/tool.ts +163 -0
  89. package/src/components/win-chart/utils/type.ts +96 -0
  90. package/src/components/win-icon/index.tsx +97 -0
  91. package/src/components/win-v/components/EmptyBox.tsx +9 -0
  92. package/src/components/win-v/components/VDialog.tsx +173 -0
  93. package/src/components/win-v/components/VDialogBtn.tsx +119 -0
  94. package/src/components/win-v/components/VDialogMsg.tsx +325 -0
  95. package/src/components/win-v/components/VInput.tsx +15 -0
  96. package/src/components/win-v/components/VRemindMsgList.tsx +303 -0
  97. package/src/components/win-v/components/VRobot.tsx +97 -0
  98. package/src/components/win-v/hooks/useVDialogCore.ts +102 -0
  99. package/src/components/win-v/hooks/useVDialogOperate.ts +132 -0
  100. package/src/components/win-v/hooks/useVDialogState.ts +52 -0
  101. package/src/components/win-v/hooks/useVRemindMsgShow.ts +15 -0
  102. package/src/components/win-v/index.tsx +205 -0
  103. package/src/components/win-wrappers/card-wrapper.tsx +103 -0
  104. package/src/components/win-wrappers/dot-wrapper.tsx +18 -0
  105. package/src/components/win-wrappers/iframe-wrapper.tsx +7 -0
  106. package/src/components/win-wrappers/request-wrapper.tsx +190 -0
  107. package/src/global.d.ts +53 -0
  108. package/src/hooks/useCardOptionList.ts +23 -0
  109. package/src/hooks/useCostFiltersDicList.ts +22 -0
  110. package/src/hooks/useFbiUrl.ts +22 -0
  111. package/src/hooks/useHalfScreenState.ts +50 -0
  112. package/src/hooks/useHasIntersected.ts +36 -0
  113. package/src/hooks/useIndicatorCardInfo.ts +26 -0
  114. package/src/hooks/useIndicatorCardQueryList.ts +22 -0
  115. package/src/hooks/useIndicatorClassifyList.ts +25 -0
  116. package/src/hooks/useIndicatorDetailsDateList.ts +22 -0
  117. package/src/hooks/useIndicatorDetailsInfo.ts +49 -0
  118. package/src/hooks/useIndicatorDetailsTrend.ts +25 -0
  119. package/src/hooks/useIndicatorDicList.ts +22 -0
  120. package/src/hooks/useIndicatorLabelList.ts +20 -0
  121. package/src/hooks/useIndicatorList.ts +24 -0
  122. package/src/hooks/useIndicatorRangeList.ts +20 -0
  123. package/src/hooks/useIndicatorTypeList.ts +20 -0
  124. package/src/hooks/useIndicatorUnitList.ts +21 -0
  125. package/src/hooks/useListenQuery.ts +29 -0
  126. package/src/hooks/useMobile.ts +58 -0
  127. package/src/hooks/useNotice.ts +42 -0
  128. package/src/hooks/useOrgLevelList.ts +23 -0
  129. package/src/hooks/usePageSelection.ts +121 -0
  130. package/src/hooks/usePageState.ts +22 -0
  131. package/src/hooks/usePendingList.ts +27 -0
  132. package/src/hooks/usePortalPageInfo.ts +43 -0
  133. package/src/hooks/useRefreshByLocationChange.ts +16 -0
  134. package/src/hooks/useReportIndicatorList.ts +21 -0
  135. package/src/hooks/useReportInfo.ts +45 -0
  136. package/src/hooks/useReportPersonList.ts +21 -0
  137. package/src/hooks/useScriptLoader.ts +22 -0
  138. package/src/hooks/useUnreadMsgList.ts +26 -0
  139. package/src/hooks/useUserAvatar.ts +23 -0
  140. package/src/hooks/useVReportInfo.ts +50 -0
  141. package/src/hooks/useVisionUserConfig.ts +25 -0
  142. package/src/hooks/useWorkbenchOptions.ts +63 -0
  143. package/src/index.tsx +20 -0
  144. package/src/services/CardService.ts +91 -0
  145. package/src/services/CommonService.ts +23 -0
  146. package/src/services/CostService.ts +56 -0
  147. package/src/services/DialogService.ts +74 -0
  148. package/src/services/IndicatorService.ts +406 -0
  149. package/src/services/PageService.ts +204 -0
  150. package/src/services/ReportService.ts +335 -0
  151. package/src/services/WorkbenchService.ts +411 -0
  152. package/src/styles/README.md +12 -0
  153. package/src/styles/index.scss +9 -0
  154. package/src/styles/mixins/index.scss +25 -0
  155. package/src/styles/next-cover.scss +4 -0
  156. package/src/styles/normalize.scss +27 -0
  157. package/src/styles/utilities/index.scss +5 -0
  158. package/src/styles/vars/index.scss +17 -0
  159. package/src/types/enum-workbench.ts +29 -0
  160. package/src/types/enum.ts +156 -0
  161. package/src/types/index.ts +19 -0
  162. package/src/types/indicator.ts +299 -0
  163. package/src/types/interface.ts +303 -0
  164. package/src/types/portal.ts +211 -0
  165. package/src/types/report.ts +28 -0
  166. package/src/types/type.ts +11 -0
  167. package/src/types/user.ts +28 -0
  168. package/src/utils/README.md +4 -0
  169. package/src/utils/arms.ts +59 -0
  170. package/src/utils/arr.ts +123 -0
  171. package/src/utils/const-workbench.ts +9 -0
  172. package/src/utils/const.ts +18 -0
  173. package/src/utils/index.ts +18 -0
  174. package/src/utils/init.ts +5 -0
  175. package/src/utils/map-workbench.ts +66 -0
  176. package/src/utils/map.ts +377 -0
  177. package/src/utils/number.ts +101 -0
  178. package/src/utils/page.ts +81 -0
  179. package/src/utils/str.ts +26 -0
  180. package/src/utils/tools.ts +44 -0
  181. package/src/utils/tree.ts +145 -0
  182. package/src/utils/url.ts +40 -0
  183. package/src/utils/util.ts +99 -0
  184. package/src/utils/workbench.ts +25 -0
  185. package/tsconfig.json +33 -0
@@ -0,0 +1,372 @@
1
+ {
2
+ "color": [
3
+ "#3379ff",
4
+ "#00dcf0",
5
+ "#ffc94d",
6
+ "#00db75",
7
+ "#b8b3ff",
8
+ "#40b4ff",
9
+ "#ffa101",
10
+ "#90abe0",
11
+ "#6ee67a",
12
+ "#6b84ff",
13
+ "#fa6b69"
14
+ ],
15
+ "backgroundColor": "rgba(0,0,0,0)",
16
+ "textStyle": {},
17
+ "title": {
18
+ "textStyle": {
19
+ "color": "#272f3d"
20
+ },
21
+ "subtextStyle": {
22
+ "color": "#394252"
23
+ }
24
+ },
25
+ "line": {
26
+ "itemStyle": {
27
+ "borderWidth": 1
28
+ },
29
+ "lineStyle": {
30
+ "width": 2
31
+ },
32
+ "symbolSize": 4,
33
+ "symbol": "emptyCircle",
34
+ "smooth": false
35
+ },
36
+ "radar": {
37
+ "itemStyle": {
38
+ "borderWidth": 1
39
+ },
40
+ "lineStyle": {
41
+ "width": 2
42
+ },
43
+ "symbolSize": 4,
44
+ "symbol": "emptyCircle",
45
+ "smooth": false
46
+ },
47
+ "bar": {
48
+ "itemStyle": {
49
+ "barBorderWidth": "0",
50
+ "barBorderColor": "#cccccc"
51
+ }
52
+ },
53
+ "pie": {
54
+ "itemStyle": {
55
+ "borderWidth": "0",
56
+ "borderColor": "#cccccc"
57
+ }
58
+ },
59
+ "scatter": {
60
+ "itemStyle": {
61
+ "borderWidth": "0",
62
+ "borderColor": "#cccccc"
63
+ }
64
+ },
65
+ "boxplot": {
66
+ "itemStyle": {
67
+ "borderWidth": "0",
68
+ "borderColor": "#cccccc"
69
+ }
70
+ },
71
+ "parallel": {
72
+ "itemStyle": {
73
+ "borderWidth": "0",
74
+ "borderColor": "#cccccc"
75
+ }
76
+ },
77
+ "sankey": {
78
+ "itemStyle": {
79
+ "borderWidth": "0",
80
+ "borderColor": "#cccccc"
81
+ }
82
+ },
83
+ "funnel": {
84
+ "itemStyle": {
85
+ "borderWidth": "0",
86
+ "borderColor": "#cccccc"
87
+ }
88
+ },
89
+ "gauge": {
90
+ "itemStyle": {
91
+ "borderWidth": "0",
92
+ "borderColor": "#cccccc"
93
+ }
94
+ },
95
+ "candlestick": {
96
+ "itemStyle": {
97
+ "color": "#f15451",
98
+ "color0": "#00c267",
99
+ "borderColor": "#f15451",
100
+ "borderColor0": "#00c267",
101
+ "borderWidth": 1
102
+ }
103
+ },
104
+ "graph": {
105
+ "itemStyle": {
106
+ "borderWidth": "0",
107
+ "borderColor": "#cccccc"
108
+ },
109
+ "lineStyle": {
110
+ "width": "1",
111
+ "color": "#dfe3eb"
112
+ },
113
+ "symbolSize": 4,
114
+ "symbol": "emptyCircle",
115
+ "smooth": false,
116
+ "color": [
117
+ "#3379ff",
118
+ "#00dcf0",
119
+ "#ffc94d",
120
+ "#00db75",
121
+ "#b8b3ff",
122
+ "#40b4ff",
123
+ "#ffa101",
124
+ "#90abe0",
125
+ "#6ee67a",
126
+ "#6b84ff",
127
+ "#fa6b69"
128
+ ],
129
+ "label": {
130
+ "color": "#ffffff"
131
+ }
132
+ },
133
+ "map": {
134
+ "itemStyle": {
135
+ "areaColor": "#eee",
136
+ "borderColor": "#444",
137
+ "borderWidth": 0.5
138
+ },
139
+ "label": {
140
+ "color": "#000"
141
+ },
142
+ "emphasis": {
143
+ "itemStyle": {
144
+ "areaColor": "rgba(255,215,0,0.8)",
145
+ "borderColor": "#444",
146
+ "borderWidth": 1
147
+ },
148
+ "label": {
149
+ "color": "rgb(100,0,0)"
150
+ }
151
+ }
152
+ },
153
+ "geo": {
154
+ "itemStyle": {
155
+ "areaColor": "#eee",
156
+ "borderColor": "#444",
157
+ "borderWidth": 0.5
158
+ },
159
+ "label": {
160
+ "color": "#000"
161
+ },
162
+ "emphasis": {
163
+ "itemStyle": {
164
+ "areaColor": "rgba(255,215,0,0.8)",
165
+ "borderColor": "#444",
166
+ "borderWidth": 1
167
+ },
168
+ "label": {
169
+ "color": "rgb(100,0,0)"
170
+ }
171
+ }
172
+ },
173
+ "categoryAxis": {
174
+ "axisLine": {
175
+ "show": true,
176
+ "lineStyle": {
177
+ "color": "#eef0f5"
178
+ }
179
+ },
180
+ "axisTick": {
181
+ "show": true,
182
+ "lineStyle": {
183
+ "color": "#eef0f5"
184
+ }
185
+ },
186
+ "axisLabel": {
187
+ "show": true,
188
+ "color": "#828b9e"
189
+ },
190
+ "splitLine": {
191
+ "show": false,
192
+ "lineStyle": {
193
+ "color": ["#E0E6F1"]
194
+ }
195
+ },
196
+ "splitArea": {
197
+ "show": false,
198
+ "areaStyle": {
199
+ "color": ["rgba(250,250,250,0.2)", "rgba(210,219,238,0.2)"]
200
+ }
201
+ }
202
+ },
203
+ "valueAxis": {
204
+ "axisLine": {
205
+ "show": false,
206
+ "lineStyle": {
207
+ "color": "#6E7079"
208
+ }
209
+ },
210
+ "axisTick": {
211
+ "show": false,
212
+ "lineStyle": {
213
+ "color": "#6E7079"
214
+ }
215
+ },
216
+ "axisLabel": {
217
+ "show": true,
218
+ "color": "#828b9e"
219
+ },
220
+ "splitLine": {
221
+ "show": true,
222
+ "lineStyle": {
223
+ "color": ["#eef0f5"]
224
+ }
225
+ },
226
+ "splitArea": {
227
+ "show": false,
228
+ "areaStyle": {
229
+ "color": ["rgba(250,250,250,0.2)", "rgba(210,219,238,0.2)"]
230
+ }
231
+ }
232
+ },
233
+ "logAxis": {
234
+ "axisLine": {
235
+ "show": false,
236
+ "lineStyle": {
237
+ "color": "#6E7079"
238
+ }
239
+ },
240
+ "axisTick": {
241
+ "show": false,
242
+ "lineStyle": {
243
+ "color": "#6E7079"
244
+ }
245
+ },
246
+ "axisLabel": {
247
+ "show": true,
248
+ "color": "#828b9e"
249
+ },
250
+ "splitLine": {
251
+ "show": true,
252
+ "lineStyle": {
253
+ "color": ["#eef0f5"]
254
+ }
255
+ },
256
+ "splitArea": {
257
+ "show": false,
258
+ "areaStyle": {
259
+ "color": ["rgba(250,250,250,0.2)", "rgba(210,219,238,0.2)"]
260
+ }
261
+ }
262
+ },
263
+ "timeAxis": {
264
+ "axisLine": {
265
+ "show": true,
266
+ "lineStyle": {
267
+ "color": "#eef0f5"
268
+ }
269
+ },
270
+ "axisTick": {
271
+ "show": true,
272
+ "lineStyle": {
273
+ "color": "#eef0f5"
274
+ }
275
+ },
276
+ "axisLabel": {
277
+ "show": true,
278
+ "color": "#828b9e"
279
+ },
280
+ "splitLine": {
281
+ "show": false,
282
+ "lineStyle": {
283
+ "color": ["#E0E6F1"]
284
+ }
285
+ },
286
+ "splitArea": {
287
+ "show": false,
288
+ "areaStyle": {
289
+ "color": ["rgba(250,250,250,0.2)", "rgba(210,219,238,0.2)"]
290
+ }
291
+ }
292
+ },
293
+ "toolbox": {
294
+ "iconStyle": {
295
+ "borderColor": "#828c9e"
296
+ },
297
+ "emphasis": {
298
+ "iconStyle": {
299
+ "borderColor": "#394252"
300
+ }
301
+ }
302
+ },
303
+ "legend": {
304
+ "textStyle": {
305
+ "color": "#828b9e"
306
+ }
307
+ },
308
+ "tooltip": {
309
+ "axisPointer": {
310
+ "lineStyle": {
311
+ "color": "#ccd1db",
312
+ "width": "1"
313
+ },
314
+ "crossStyle": {
315
+ "color": "#ccd1db",
316
+ "width": "1"
317
+ }
318
+ }
319
+ },
320
+ "timeline": {
321
+ "lineStyle": {
322
+ "color": "#eef0f5",
323
+ "width": 2
324
+ },
325
+ "itemStyle": {
326
+ "color": "#eef0f5",
327
+ "borderWidth": "1"
328
+ },
329
+ "controlStyle": {
330
+ "color": "#828c9e",
331
+ "borderColor": "#828c9e",
332
+ "borderWidth": 1
333
+ },
334
+ "checkpointStyle": {
335
+ "color": "#3379ff",
336
+ "borderColor": "#ffffff"
337
+ },
338
+ "label": {
339
+ "color": "#b1b9c7"
340
+ },
341
+ "emphasis": {
342
+ "itemStyle": {
343
+ "color": "#3379ff"
344
+ },
345
+ "controlStyle": {
346
+ "color": "#828c9e",
347
+ "borderColor": "#828c9e",
348
+ "borderWidth": 1
349
+ },
350
+ "label": {
351
+ "color": "#b1b9c7"
352
+ }
353
+ }
354
+ },
355
+ "visualMap": {
356
+ "color": ["#062379", "#2058d2", "#3379ff", "#a0cbff", "#e8f4ff"]
357
+ },
358
+ "dataZoom": {
359
+ "handleSize": "undefined%",
360
+ "textStyle": {}
361
+ },
362
+ "markPoint": {
363
+ "label": {
364
+ "color": "#ffffff"
365
+ },
366
+ "emphasis": {
367
+ "label": {
368
+ "color": "#ffffff"
369
+ }
370
+ }
371
+ }
372
+ }
@@ -0,0 +1,37 @@
1
+ /**
2
+ * 色值
3
+ */
4
+ export const COLOR_LIST = [
5
+ '#3D84FF',
6
+ '#00DCF0',
7
+ '#FCBC26',
8
+ '#00DB75',
9
+ '#BDB8FF',
10
+ '#40B4FF',
11
+ '#FFA101',
12
+ '#90ABE0',
13
+ '#6EE67A',
14
+ '#6B84FF',
15
+ '#FA6B69',
16
+ ];
17
+
18
+ /**
19
+ * 通用配置
20
+ */
21
+ export const commonOpt: echarts.EChartsOption = {
22
+ grid: {
23
+ top: 24,
24
+ left: 0,
25
+ right: 12,
26
+ bottom: 32,
27
+ containLabel: true,
28
+ },
29
+ color: COLOR_LIST,
30
+ legend: {
31
+ itemWidth: 10,
32
+ itemHeight: 10,
33
+ bottom: 0,
34
+ type: 'scroll',
35
+ icon: 'circle',
36
+ },
37
+ };
@@ -0,0 +1,150 @@
1
+ import { COLOR_LIST } from './const';
2
+ import { rgba } from 'polished';
3
+ import { IWinChartProps } from './type';
4
+ import { arrDeduplication, checkEntityArr, getAxisOpt } from './tool';
5
+ import * as echarts from 'echarts';
6
+
7
+ /**
8
+ * Mini 面积图
9
+ * @param winChartProps
10
+ * @returns
11
+ */
12
+ export const getMiniAreaOpt = (
13
+ winChartProps: IWinChartProps,
14
+ ): echarts.EChartsOption => {
15
+ const barTypeList = arrDeduplication<string>(
16
+ winChartProps.data?.map((item) => item.type!),
17
+ );
18
+ const color = winChartProps.color;
19
+
20
+ return {
21
+ color,
22
+ grid: {
23
+ top: 4,
24
+ left: 0,
25
+ right: 0,
26
+ bottom: 0,
27
+ containLabel: true,
28
+ },
29
+ tooltip: {
30
+ trigger: 'axis',
31
+ axisPointer: {
32
+ type: 'cross',
33
+ label: {
34
+ backgroundColor: '#999',
35
+ },
36
+ },
37
+ },
38
+ legend: {
39
+ show: false,
40
+ },
41
+ xAxis: {
42
+ show: false,
43
+ boundaryGap: false,
44
+ data: arrDeduplication(winChartProps.data?.map((item) => item.label)),
45
+ },
46
+ yAxis: {
47
+ show: false,
48
+ min: winChartProps.yStart?.[0],
49
+ },
50
+ series: [
51
+ ...barTypeList.map((name, index) => {
52
+ const areaColor = color?.[index] ?? COLOR_LIST[index];
53
+ return {
54
+ name,
55
+ type: 'line',
56
+ smooth: true,
57
+ lineStyle: {
58
+ width: 2,
59
+ },
60
+ showSymbol: false,
61
+ areaStyle: {
62
+ opacity: 0.8,
63
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
64
+ {
65
+ offset: 0,
66
+ color: rgba(areaColor, 0.5),
67
+ },
68
+ {
69
+ offset: 1,
70
+ color: '#fff',
71
+ },
72
+ ]),
73
+ },
74
+ emphasis: {
75
+ focus: 'series',
76
+ },
77
+ data: winChartProps.data
78
+ ?.filter((item) => item.type === name)
79
+ .map((item) => item.value),
80
+ };
81
+ }),
82
+ ] as any,
83
+ };
84
+ };
85
+
86
+ /**
87
+ * 面积图
88
+ * @param winChartProps
89
+ * @returns
90
+ */
91
+ export const getAreaOpt = (
92
+ winChartProps: IWinChartProps,
93
+ ): echarts.EChartsOption => {
94
+ const barTypeList = arrDeduplication<string>(
95
+ winChartProps.data?.map((item) => item.type!),
96
+ );
97
+
98
+ return {
99
+ tooltip: {
100
+ trigger: 'axis',
101
+ axisPointer: {
102
+ type: 'cross',
103
+ label: {
104
+ backgroundColor: '#999',
105
+ },
106
+ },
107
+ },
108
+ legend: {
109
+ bottom: 0,
110
+ type: 'scroll',
111
+ },
112
+ xAxis: getAxisOpt(winChartProps),
113
+ yAxis: {
114
+ min: winChartProps.yStart?.[0],
115
+ },
116
+ series: [
117
+ ...barTypeList.map((name, index) => {
118
+ const areaColor = COLOR_LIST[index];
119
+ return {
120
+ name,
121
+ type: 'line' as any,
122
+ smooth: true,
123
+ lineStyle: {
124
+ width: 2,
125
+ },
126
+ showSymbol: false,
127
+ areaStyle: {
128
+ opacity: 0.8,
129
+ color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
130
+ {
131
+ offset: 0,
132
+ color: rgba(areaColor, 0.5),
133
+ },
134
+ {
135
+ offset: 1,
136
+ color: '#fff',
137
+ },
138
+ ]),
139
+ },
140
+ emphasis: {
141
+ focus: 'series' as any,
142
+ },
143
+ data: winChartProps.data
144
+ ?.filter((item) => item.type === name)
145
+ .map((item) => item.value),
146
+ };
147
+ }),
148
+ ],
149
+ };
150
+ };
@@ -0,0 +1,60 @@
1
+ import { IWinChartProps } from './type';
2
+ import { arrDeduplication } from './tool';
3
+ import * as echarts from 'echarts';
4
+
5
+ /**
6
+ * 条形图
7
+ * @param winChartProps
8
+ * @returns
9
+ */
10
+ export const getBarOpt = (
11
+ winChartProps: IWinChartProps,
12
+ ): echarts.EChartsOption => {
13
+ const barTypeList = arrDeduplication<string>(
14
+ winChartProps.data?.map((item) => item.type!),
15
+ );
16
+
17
+ return {
18
+ tooltip: {
19
+ trigger: 'axis',
20
+ axisPointer: {
21
+ type: 'cross',
22
+ label: {
23
+ backgroundColor: '#999',
24
+ },
25
+ },
26
+ },
27
+ legend: {
28
+ bottom: 0,
29
+ type: 'scroll',
30
+ },
31
+ xAxis: {},
32
+ yAxis: {
33
+ data: arrDeduplication(winChartProps.data?.map((item) => item.label)),
34
+ axisTick: {
35
+ alignWithLabel: true,
36
+ },
37
+ axisPointer: {
38
+ type: 'shadow',
39
+ },
40
+ min: winChartProps.yStart?.[0],
41
+ },
42
+ series: barTypeList.map((name) => {
43
+ return {
44
+ name,
45
+ type: 'bar',
46
+ barGap: '30%',
47
+ barCategoryGap: '30%',
48
+ barMaxWidth: 8,
49
+ data: winChartProps.data
50
+ ?.filter((item) => item.type === name)
51
+ .map((item) => ({
52
+ value: item.value,
53
+ itemStyle: {
54
+ borderRadius: [0, 500, 500, 0],
55
+ },
56
+ })),
57
+ };
58
+ }),
59
+ };
60
+ };
@@ -0,0 +1,59 @@
1
+ import { IWinChartProps, WinChartType } from './type';
2
+ import { getAreaOpt, getMiniAreaOpt } from './getAreaSpec';
3
+ import { getDualOpt } from './getDualSpec';
4
+ import { getPieCycleOpt, getPieOpt } from './getPieSpec';
5
+ import { getLineOpt } from './getLineSpec';
6
+ import { getColumnOpt, getColumnStackOpt } from './getColumnSpec';
7
+ import { getFunnelOpt } from './getFunnelSpec';
8
+ import { getBarOpt } from './getBarSpec';
9
+ import { handleSort } from './tool';
10
+ import { getRadarOpt } from './getRadarSpec';
11
+
12
+ /**
13
+ * 获取图表配置
14
+ * @param chartType
15
+ * @returns
16
+ */
17
+ export const getEChartOptions = (
18
+ originWinChartProps: IWinChartProps,
19
+ ): echarts.EChartsOption => {
20
+ const winChartProps = handleSort(originWinChartProps);
21
+
22
+ switch (winChartProps.chartType) {
23
+ case WinChartType.MINI_AREA:
24
+ return getMiniAreaOpt(winChartProps);
25
+
26
+ case WinChartType.AREA:
27
+ return getAreaOpt(winChartProps);
28
+
29
+ case WinChartType.LINE:
30
+ return getLineOpt(winChartProps);
31
+
32
+ case WinChartType.COLUMN:
33
+ return getColumnOpt(winChartProps);
34
+
35
+ case WinChartType.STACK_COLUMN:
36
+ return getColumnStackOpt(winChartProps);
37
+
38
+ case WinChartType.BAR:
39
+ return getBarOpt(winChartProps);
40
+
41
+ case WinChartType.FUNNEL:
42
+ return getFunnelOpt(winChartProps);
43
+
44
+ case WinChartType.DUAL_LINE_BAR:
45
+ return getDualOpt(winChartProps);
46
+
47
+ case WinChartType.PIE:
48
+ return getPieOpt(winChartProps);
49
+
50
+ case WinChartType.CYCLE:
51
+ return getPieCycleOpt(winChartProps);
52
+
53
+ case WinChartType.RADAR:
54
+ return getRadarOpt(winChartProps);
55
+
56
+ default:
57
+ return {};
58
+ }
59
+ };