@tsingroc/tsingroc-components 1.0.4 → 1.0.5
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 +64 -0
- package/dist/components/Button/index.d.ts +5 -0
- package/dist/components/Button/index.js +8 -0
- package/dist/components/Button/index.js.map +1 -0
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/tsingrocCom.d.ts +15 -0
- package/dist/components/tsingrocCom.js +967 -0
- package/dist/components/tsingrocCom.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.js +16 -0
- package/dist/index.js.map +1 -0
- package/package.json +35 -14
- package/.babelrc +0 -3
- package/build.config.js +0 -55
- package/dist/bundle.js +0 -11220
- package/dist/index.html +0 -11
- package/example/public/index.html +0 -11
- package/example/src/App.js +0 -17
- package/example/src/index.js +0 -11
- package/index.js +0 -6
- package/src/components/Button/index.js +0 -10
- package/src/components/index.js +0 -3
- package/src/components/tsingrocCom.js +0 -1121
- package/src/index.js +0 -39
- package/test/test.js +0 -2
- package/webpack.config.js +0 -41
|
@@ -1,1121 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useRef,useState } from "react";
|
|
2
|
-
import DayJs from "dayjs";
|
|
3
|
-
import ReactECharts from "echarts-for-react";
|
|
4
|
-
import * as echarts from "echarts";
|
|
5
|
-
import { LeftOutlined, RightOutlined } from "@ant-design/icons"
|
|
6
|
-
import { DatePicker } from "antd"
|
|
7
|
-
|
|
8
|
-
// 带风险区间的折线图
|
|
9
|
-
const RiskEchartMult = React.memo(function EchartMult(props) {
|
|
10
|
-
const l = localStorage.getItem("lang");
|
|
11
|
-
const {
|
|
12
|
-
riskArr,
|
|
13
|
-
max,
|
|
14
|
-
x: propsX,
|
|
15
|
-
yArr,
|
|
16
|
-
nameArr,
|
|
17
|
-
notFormat,
|
|
18
|
-
nofoot,
|
|
19
|
-
step,
|
|
20
|
-
h = "350px",
|
|
21
|
-
w = "100%",
|
|
22
|
-
noDiff,
|
|
23
|
-
addMaxBar,
|
|
24
|
-
echartColorArr = [
|
|
25
|
-
"#2FDAFF",
|
|
26
|
-
"#77DA9B",
|
|
27
|
-
"#FFB82E",
|
|
28
|
-
"#5470c6",
|
|
29
|
-
"#91cc75",
|
|
30
|
-
"#fac858",
|
|
31
|
-
"#ee6666",
|
|
32
|
-
"#73c0de",
|
|
33
|
-
"#3ba272",
|
|
34
|
-
"#fc8452",
|
|
35
|
-
"#9a60b4",
|
|
36
|
-
"#ea7ccc",
|
|
37
|
-
],
|
|
38
|
-
areaStyle = ['rgba(47,218,255 ,0.3)', 'rgba(119,218,155,0.3)', 'rgba(255,184,46,0.3)'],
|
|
39
|
-
yAxis = "功率(MW)",
|
|
40
|
-
barColor,
|
|
41
|
-
legendLeft,
|
|
42
|
-
unit = "MW",
|
|
43
|
-
specialLine,
|
|
44
|
-
pickLine,
|
|
45
|
-
type
|
|
46
|
-
} = props;
|
|
47
|
-
const xTemp = useMemo(() => {
|
|
48
|
-
return new Array(24).fill(0).map((item, index) => {
|
|
49
|
-
let time = (index + 1).toString().padStart(2, "0");
|
|
50
|
-
return time + ":00";
|
|
51
|
-
});
|
|
52
|
-
}, []);
|
|
53
|
-
let x = [];
|
|
54
|
-
if (!propsX) {
|
|
55
|
-
x = xTemp;
|
|
56
|
-
} else {
|
|
57
|
-
x = propsX;
|
|
58
|
-
}
|
|
59
|
-
// 获取最大值,构建bar
|
|
60
|
-
const option = useMemo(() => {
|
|
61
|
-
let barArr = [];
|
|
62
|
-
if (Array.isArray(yArr) && yArr.length > 0 && addMaxBar) {
|
|
63
|
-
let length = yArr[0].length;
|
|
64
|
-
for (let i = 0; i < length; i++) {
|
|
65
|
-
let max = -Infinity;
|
|
66
|
-
let tempIndex = -1;
|
|
67
|
-
let secendLoopLength = yArr.length;
|
|
68
|
-
for (let j = 0; j < secendLoopLength; j++) {
|
|
69
|
-
if (yArr[j][i] > max) {
|
|
70
|
-
max = yArr[j][i];
|
|
71
|
-
tempIndex = j;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
barArr.push({
|
|
75
|
-
value: max,
|
|
76
|
-
itemStyle: {
|
|
77
|
-
color: barColor[tempIndex],
|
|
78
|
-
},
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const option = {
|
|
84
|
-
grid: {
|
|
85
|
-
top: "30",
|
|
86
|
-
left: "40",
|
|
87
|
-
right: "40",
|
|
88
|
-
bottom: "20",
|
|
89
|
-
containLabel: true,
|
|
90
|
-
},
|
|
91
|
-
xAxis: {
|
|
92
|
-
type: "category",
|
|
93
|
-
show: !nofoot,
|
|
94
|
-
data: notFormat ? x.map((item) => new DayJs(item).format("HH:mm")) : x,
|
|
95
|
-
},
|
|
96
|
-
yAxis: [
|
|
97
|
-
{
|
|
98
|
-
max: max,
|
|
99
|
-
name: yAxis,
|
|
100
|
-
nameGap: 10,
|
|
101
|
-
position: "left",
|
|
102
|
-
nameTextStyle: {
|
|
103
|
-
align: "center",
|
|
104
|
-
fontWeight: "bold",
|
|
105
|
-
},
|
|
106
|
-
type: "value",
|
|
107
|
-
splitLine: {
|
|
108
|
-
lineStyle: {
|
|
109
|
-
color: "rgba(130, 144, 157, 0.18)",
|
|
110
|
-
},
|
|
111
|
-
},
|
|
112
|
-
splitNumber: 3,
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
type: "value",
|
|
116
|
-
splitLine: {
|
|
117
|
-
lineStyle: {
|
|
118
|
-
color: "#DCDEE0",
|
|
119
|
-
},
|
|
120
|
-
},
|
|
121
|
-
splitNumber: 3,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
legend: {
|
|
125
|
-
data: [...nameArr, '风险区间'].map((item, index) => {
|
|
126
|
-
return {
|
|
127
|
-
name: item,
|
|
128
|
-
itemStyle: {
|
|
129
|
-
color: item === '风险区间' ? 'rgba(99,211,149,0.8)' : echartColorArr[index],
|
|
130
|
-
},
|
|
131
|
-
icon:
|
|
132
|
-
item === "实际"
|
|
133
|
-
? "path://M304.43 532.76H221.4c-11.47 0-20.76-9.3-20.76-20.76s9.29-20.76 20.76-20.76h83.03c11.47 0 20.76 9.3 20.76 20.76s-9.29 20.76-20.76 20.76zM581.19 532.76H442.81c-11.47 0-20.76-9.3-20.76-20.76s9.29-20.76 20.76-20.76h138.38c11.47 0 20.76 9.3 20.76 20.76s-9.3 20.76-20.76 20.76zM802.59 532.76h-83.03c-11.47 0-20.76-9.3-20.76-20.76s9.29-20.76 20.76-20.76h83.03c11.47 0 20.76 9.3 20.76 20.76s-9.29 20.76-20.76 20.76z"
|
|
134
|
-
: "rect",
|
|
135
|
-
};
|
|
136
|
-
}),
|
|
137
|
-
textStyle: {
|
|
138
|
-
color: "#646566",
|
|
139
|
-
},
|
|
140
|
-
left: legendLeft,
|
|
141
|
-
right: "20",
|
|
142
|
-
// formatter: (name) => {
|
|
143
|
-
// return shark(name,l)
|
|
144
|
-
// }
|
|
145
|
-
},
|
|
146
|
-
color: echartColorArr,
|
|
147
|
-
tooltip: {
|
|
148
|
-
trigger: "axis",
|
|
149
|
-
valueFormatter: (value) =>
|
|
150
|
-
value ? value.toFixed(2) + unit : value === 0 ? 0 + unit : "",
|
|
151
|
-
},
|
|
152
|
-
series: yArr
|
|
153
|
-
?.map((item, index) => ({
|
|
154
|
-
data: item?.map((i) => (typeof i === "number" ? i : undefined)),
|
|
155
|
-
type: type || "line",
|
|
156
|
-
smooth: true,
|
|
157
|
-
name: nameArr[index],
|
|
158
|
-
lineStyle: {
|
|
159
|
-
// type: noDiff ? "solid" : index === 0 ? "dashed" : "solid",
|
|
160
|
-
type: specialLine ? nameArr[index] === pickLine ? 'solid' : "dashed" : "solid",
|
|
161
|
-
color: echartColorArr[index],
|
|
162
|
-
},
|
|
163
|
-
step: step || "",
|
|
164
|
-
symbol: "none",
|
|
165
|
-
emphasis: {
|
|
166
|
-
itemStyle: {
|
|
167
|
-
color: "red",
|
|
168
|
-
},
|
|
169
|
-
},
|
|
170
|
-
// areaStyle:{
|
|
171
|
-
// color:areaStyle[index]
|
|
172
|
-
// }
|
|
173
|
-
}))
|
|
174
|
-
.concat(
|
|
175
|
-
addMaxBar
|
|
176
|
-
? [
|
|
177
|
-
{
|
|
178
|
-
data: barArr,
|
|
179
|
-
type: "bar",
|
|
180
|
-
name: "max",
|
|
181
|
-
barWidth: "101%",
|
|
182
|
-
yAxisIndex: 1,
|
|
183
|
-
tooltip: {
|
|
184
|
-
show: false,
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
]
|
|
188
|
-
: []
|
|
189
|
-
),
|
|
190
|
-
};
|
|
191
|
-
if (riskArr && riskArr.length > 0 && riskArr[0]) {
|
|
192
|
-
option.series.push({
|
|
193
|
-
data: riskArr[1],
|
|
194
|
-
type: 'line',
|
|
195
|
-
name: "风险上边界",
|
|
196
|
-
smooth: true,
|
|
197
|
-
showSymbol: false,
|
|
198
|
-
tooltip: {
|
|
199
|
-
show: true
|
|
200
|
-
},
|
|
201
|
-
lineStyle: {
|
|
202
|
-
opacity: 0
|
|
203
|
-
},
|
|
204
|
-
}, {
|
|
205
|
-
yAxisIndex: 0,
|
|
206
|
-
data: riskArr[0],
|
|
207
|
-
type: 'line',
|
|
208
|
-
name: "风险下边界",
|
|
209
|
-
smooth: true,
|
|
210
|
-
stack: 'st',
|
|
211
|
-
showSymbol: false,
|
|
212
|
-
lineStyle: {
|
|
213
|
-
opacity: 0
|
|
214
|
-
},
|
|
215
|
-
tooltip: {
|
|
216
|
-
show: true
|
|
217
|
-
},
|
|
218
|
-
emphasis: {
|
|
219
|
-
disabled: true
|
|
220
|
-
},
|
|
221
|
-
}, {
|
|
222
|
-
yAxisIndex: 0,
|
|
223
|
-
name: '风险区间',
|
|
224
|
-
stack: 'st',
|
|
225
|
-
stackStrategy: "all",
|
|
226
|
-
data: riskArr[1].map((item, index) => {
|
|
227
|
-
return riskArr[1][index] - riskArr[0][index]
|
|
228
|
-
}),
|
|
229
|
-
type: 'line',
|
|
230
|
-
smooth: true,
|
|
231
|
-
symbol: "none",
|
|
232
|
-
lineStyle: {
|
|
233
|
-
opacity: 0
|
|
234
|
-
},
|
|
235
|
-
areaStyle: {
|
|
236
|
-
color: "#63D395",
|
|
237
|
-
},
|
|
238
|
-
emphasis: {
|
|
239
|
-
disabled: true
|
|
240
|
-
},
|
|
241
|
-
tooltip: {
|
|
242
|
-
show: false
|
|
243
|
-
},
|
|
244
|
-
},)
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
return option;
|
|
248
|
-
}, [
|
|
249
|
-
echartColorArr,
|
|
250
|
-
addMaxBar,
|
|
251
|
-
x,
|
|
252
|
-
yArr,
|
|
253
|
-
nameArr,
|
|
254
|
-
noDiff,
|
|
255
|
-
nofoot,
|
|
256
|
-
step,
|
|
257
|
-
yAxis,
|
|
258
|
-
notFormat,
|
|
259
|
-
barColor,
|
|
260
|
-
riskArr
|
|
261
|
-
]);
|
|
262
|
-
const echartRef = useRef(null);
|
|
263
|
-
useEffect(() => {
|
|
264
|
-
if (echartRef.current) {
|
|
265
|
-
const ins = echartRef.current.getEchartsInstance();
|
|
266
|
-
}
|
|
267
|
-
}, [x, yArr, nameArr, riskArr, option]);
|
|
268
|
-
|
|
269
|
-
const onEvents = {
|
|
270
|
-
" click": () => { },
|
|
271
|
-
};
|
|
272
|
-
return (
|
|
273
|
-
<ReactECharts
|
|
274
|
-
ref={echartRef}
|
|
275
|
-
option={option}
|
|
276
|
-
style={{ height: h, width: w }}
|
|
277
|
-
onEvents={onEvents}
|
|
278
|
-
/>
|
|
279
|
-
);
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
// 折线图
|
|
283
|
-
const EchartMult = React.memo(function EchartMult(props) {
|
|
284
|
-
const l = localStorage.getItem("lang");
|
|
285
|
-
const {
|
|
286
|
-
max,
|
|
287
|
-
x: propsX,
|
|
288
|
-
yArr,
|
|
289
|
-
nameArr,
|
|
290
|
-
notFormat,
|
|
291
|
-
nofoot,
|
|
292
|
-
step,
|
|
293
|
-
h = "350px",
|
|
294
|
-
w = "100%",
|
|
295
|
-
left=30,
|
|
296
|
-
right=40,
|
|
297
|
-
noDiff,
|
|
298
|
-
addMaxBar,
|
|
299
|
-
barWidth = '15px',
|
|
300
|
-
barLinearGradientArr,
|
|
301
|
-
echartColorArr = [
|
|
302
|
-
"#2FDAFF",
|
|
303
|
-
"#77DA9B",
|
|
304
|
-
"#FFB82E",
|
|
305
|
-
"#5470c6",
|
|
306
|
-
"#91cc75",
|
|
307
|
-
"#fac858",
|
|
308
|
-
"#ee6666",
|
|
309
|
-
"#73c0de",
|
|
310
|
-
"#3ba272",
|
|
311
|
-
"#fc8452",
|
|
312
|
-
"#9a60b4",
|
|
313
|
-
"#ea7ccc",
|
|
314
|
-
],
|
|
315
|
-
legendTextColor = "#fff",
|
|
316
|
-
areaStyle = ['rgba(47,218,255 ,0.3)', 'rgba(119,218,155,0.3)', 'rgba(255,184,46,0.3)'],
|
|
317
|
-
yAxis = "功率(MW)",
|
|
318
|
-
barColor,
|
|
319
|
-
legendLeft,
|
|
320
|
-
unit = "MW",
|
|
321
|
-
specialLine,
|
|
322
|
-
pickLine,
|
|
323
|
-
type
|
|
324
|
-
} = props;
|
|
325
|
-
if (barLinearGradientArr) {
|
|
326
|
-
echartColorArr[0] = barLinearGradientArr[1]
|
|
327
|
-
}
|
|
328
|
-
const xTemp = useMemo(() => {
|
|
329
|
-
return new Array(24).fill(0).map((item, index) => {
|
|
330
|
-
let time = (index + 1).toString().padStart(2, "0");
|
|
331
|
-
return time + ":00";
|
|
332
|
-
});
|
|
333
|
-
}, []);
|
|
334
|
-
let x = [];
|
|
335
|
-
if (!propsX) {
|
|
336
|
-
x = xTemp;
|
|
337
|
-
} else {
|
|
338
|
-
x = propsX;
|
|
339
|
-
}
|
|
340
|
-
// 获取最大值,构建bar
|
|
341
|
-
const option = useMemo(() => {
|
|
342
|
-
let barArr = [];
|
|
343
|
-
if (Array.isArray(yArr) && yArr.length > 0 && addMaxBar) {
|
|
344
|
-
let length = yArr[0].length;
|
|
345
|
-
for (let i = 0; i < length; i++) {
|
|
346
|
-
let max = -Infinity;
|
|
347
|
-
let tempIndex = -1;
|
|
348
|
-
let secendLoopLength = yArr.length;
|
|
349
|
-
for (let j = 0; j < secendLoopLength; j++) {
|
|
350
|
-
if (yArr[j][i] > max) {
|
|
351
|
-
max = yArr[j][i];
|
|
352
|
-
tempIndex = j;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
barArr.push({
|
|
356
|
-
value: max,
|
|
357
|
-
itemStyle: {
|
|
358
|
-
color: barColor[tempIndex],
|
|
359
|
-
},
|
|
360
|
-
});
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
const option = {
|
|
365
|
-
grid: {
|
|
366
|
-
top: "30",
|
|
367
|
-
left: left,
|
|
368
|
-
right: right,
|
|
369
|
-
bottom: "20",
|
|
370
|
-
containLabel: true,
|
|
371
|
-
},
|
|
372
|
-
xAxis: {
|
|
373
|
-
type: "category",
|
|
374
|
-
// axisLabel: {
|
|
375
|
-
// interval: 0 // 强制显示所有x轴标签
|
|
376
|
-
// },
|
|
377
|
-
show: !nofoot,
|
|
378
|
-
data: notFormat ? x.map((item) => new DayJs(item).format("HH:mm")) : x,
|
|
379
|
-
},
|
|
380
|
-
yAxis: [
|
|
381
|
-
{
|
|
382
|
-
max: max,
|
|
383
|
-
name: yAxis,
|
|
384
|
-
nameGap: 10,
|
|
385
|
-
position: "left",
|
|
386
|
-
nameTextStyle: {
|
|
387
|
-
align: "center",
|
|
388
|
-
fontWeight: "bold",
|
|
389
|
-
},
|
|
390
|
-
type: "value",
|
|
391
|
-
splitLine: {
|
|
392
|
-
lineStyle: {
|
|
393
|
-
color: "rgba(130, 144, 157, 0.18)",
|
|
394
|
-
},
|
|
395
|
-
},
|
|
396
|
-
splitNumber: 3,
|
|
397
|
-
},
|
|
398
|
-
{
|
|
399
|
-
type: "value",
|
|
400
|
-
splitLine: {
|
|
401
|
-
lineStyle: {
|
|
402
|
-
color: "#DCDEE0",
|
|
403
|
-
},
|
|
404
|
-
},
|
|
405
|
-
splitNumber: 3,
|
|
406
|
-
},
|
|
407
|
-
],
|
|
408
|
-
legend: {
|
|
409
|
-
data: nameArr.map((item, index) => {
|
|
410
|
-
return {
|
|
411
|
-
name: item,
|
|
412
|
-
itemStyle: {
|
|
413
|
-
color: echartColorArr[index],
|
|
414
|
-
},
|
|
415
|
-
icon:
|
|
416
|
-
item === "实际"
|
|
417
|
-
? "path://M304.43 532.76H221.4c-11.47 0-20.76-9.3-20.76-20.76s9.29-20.76 20.76-20.76h83.03c11.47 0 20.76 9.3 20.76 20.76s-9.29 20.76-20.76 20.76zM581.19 532.76H442.81c-11.47 0-20.76-9.3-20.76-20.76s9.29-20.76 20.76-20.76h138.38c11.47 0 20.76 9.3 20.76 20.76s-9.3 20.76-20.76 20.76zM802.59 532.76h-83.03c-11.47 0-20.76-9.3-20.76-20.76s9.29-20.76 20.76-20.76h83.03c11.47 0 20.76 9.3 20.76 20.76s-9.29 20.76-20.76 20.76z"
|
|
418
|
-
: "rect",
|
|
419
|
-
};
|
|
420
|
-
}),
|
|
421
|
-
textStyle: {
|
|
422
|
-
// color: "#646566",
|
|
423
|
-
color: legendTextColor
|
|
424
|
-
},
|
|
425
|
-
left: legendLeft,
|
|
426
|
-
right: "20",
|
|
427
|
-
// formatter: (name) => {
|
|
428
|
-
// return shark(name,l)
|
|
429
|
-
// }
|
|
430
|
-
},
|
|
431
|
-
color: echartColorArr,
|
|
432
|
-
tooltip: {
|
|
433
|
-
trigger: "axis",
|
|
434
|
-
valueFormatter: (value) =>
|
|
435
|
-
value ? value.toFixed(2) + unit : value === 0 ? 0 + unit : "",
|
|
436
|
-
},
|
|
437
|
-
series: yArr
|
|
438
|
-
?.map((item, index) => ({
|
|
439
|
-
data: item?.map((i) => (typeof i === "number" ? i : undefined)),
|
|
440
|
-
type: type || "line",
|
|
441
|
-
smooth: true,
|
|
442
|
-
name: nameArr[index],
|
|
443
|
-
lineStyle: {
|
|
444
|
-
// type: noDiff ? "solid" : index === 0 ? "dashed" : "solid",
|
|
445
|
-
type: specialLine ? nameArr[index] === pickLine ? 'solid' : "dashed" : "solid",
|
|
446
|
-
color: echartColorArr[index],
|
|
447
|
-
},
|
|
448
|
-
step: step || "",
|
|
449
|
-
symbol: "none",
|
|
450
|
-
emphasis: {
|
|
451
|
-
itemStyle: {
|
|
452
|
-
color: "red",
|
|
453
|
-
},
|
|
454
|
-
},
|
|
455
|
-
areaStyle:areaStyle? {
|
|
456
|
-
color: areaStyle[index]
|
|
457
|
-
}:null,
|
|
458
|
-
barWidth: barWidth,
|
|
459
|
-
itemStyle: barLinearGradientArr ? {
|
|
460
|
-
barBorderRadius: [3, 3, 0, 0],
|
|
461
|
-
color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
|
|
462
|
-
{ offset: 0, color: barLinearGradientArr[1] },
|
|
463
|
-
{ offset: 1, color: barLinearGradientArr[0] }
|
|
464
|
-
])
|
|
465
|
-
} : {}
|
|
466
|
-
}))
|
|
467
|
-
.concat(
|
|
468
|
-
addMaxBar
|
|
469
|
-
? [
|
|
470
|
-
{
|
|
471
|
-
data: barArr,
|
|
472
|
-
type: "bar",
|
|
473
|
-
name: "max",
|
|
474
|
-
barWidth: "101%",
|
|
475
|
-
yAxisIndex: 1,
|
|
476
|
-
tooltip: {
|
|
477
|
-
show: false,
|
|
478
|
-
},
|
|
479
|
-
},
|
|
480
|
-
]
|
|
481
|
-
: []
|
|
482
|
-
),
|
|
483
|
-
};
|
|
484
|
-
return option;
|
|
485
|
-
}, [
|
|
486
|
-
echartColorArr,
|
|
487
|
-
addMaxBar,
|
|
488
|
-
x,
|
|
489
|
-
yArr,
|
|
490
|
-
nameArr,
|
|
491
|
-
noDiff,
|
|
492
|
-
nofoot,
|
|
493
|
-
step,
|
|
494
|
-
yAxis,
|
|
495
|
-
notFormat,
|
|
496
|
-
barColor,
|
|
497
|
-
]);
|
|
498
|
-
const echartRef = useRef(null);
|
|
499
|
-
useEffect(() => {
|
|
500
|
-
if (echartRef.current) {
|
|
501
|
-
const ins = echartRef.current.getEchartsInstance();
|
|
502
|
-
ins.setOption(
|
|
503
|
-
{
|
|
504
|
-
...ins.getOption(),
|
|
505
|
-
series: ins
|
|
506
|
-
.getOption()
|
|
507
|
-
.series.filter((item) => [...nameArr, "max"].includes(item.name)),
|
|
508
|
-
},
|
|
509
|
-
true,
|
|
510
|
-
true
|
|
511
|
-
);
|
|
512
|
-
}
|
|
513
|
-
}, [x, yArr, nameArr]);
|
|
514
|
-
|
|
515
|
-
const onEvents = {
|
|
516
|
-
" click": () => { },
|
|
517
|
-
};
|
|
518
|
-
return (
|
|
519
|
-
<ReactECharts
|
|
520
|
-
ref={echartRef}
|
|
521
|
-
option={option}
|
|
522
|
-
style={{ height: h, width: w }}
|
|
523
|
-
onEvents={onEvents}
|
|
524
|
-
/>
|
|
525
|
-
);
|
|
526
|
-
});
|
|
527
|
-
|
|
528
|
-
// 待快速跳转的日,周,月 选择器
|
|
529
|
-
function TsingrocDatePick(props){
|
|
530
|
-
const {value,onChange:propsOnChange,dataType ='month',className,popupClassName}=props
|
|
531
|
-
const [dateValue,setDateValue]=useState(value)
|
|
532
|
-
const quickGo=(type)=>{
|
|
533
|
-
let temp = dateValue.add(type, dataType)
|
|
534
|
-
setDateValue(temp)
|
|
535
|
-
propsOnChange && propsOnChange(temp)
|
|
536
|
-
}
|
|
537
|
-
const onChange=(value)=>{
|
|
538
|
-
setDateValue(value)
|
|
539
|
-
propsOnChange && propsOnChange(value)
|
|
540
|
-
}
|
|
541
|
-
return <div>
|
|
542
|
-
<div onClick={() => { quickGo(-1) }} className={`quick-jump ${className}`} style={{borderRight: 'none', borderRadius: '2px 0 0 2px' }}>
|
|
543
|
-
<LeftOutlined className="quick-icon" />
|
|
544
|
-
</div>
|
|
545
|
-
{
|
|
546
|
-
dataType === 'day' && <DatePicker value={dateValue} onChange={onChange} />
|
|
547
|
-
}
|
|
548
|
-
{
|
|
549
|
-
dataType === 'week' && <DatePicker value={dateValue} onChange={onChange} picker="week" />
|
|
550
|
-
}
|
|
551
|
-
{
|
|
552
|
-
dataType === 'month' && <DatePicker popupClassName={popupClassName} className={className} value={dateValue} onChange={onChange} picker="month" />
|
|
553
|
-
}
|
|
554
|
-
<div onClick={() => { quickGo(1) }} className={`quick-jump ${className}`} style={{ borderLeft:'none', borderRadius: '0 2px 2px 0' }}>
|
|
555
|
-
<RightOutlined className="quick-icon" />
|
|
556
|
-
</div>
|
|
557
|
-
|
|
558
|
-
</div>
|
|
559
|
-
}
|
|
560
|
-
// 雷达图
|
|
561
|
-
function RadarEchart(props) {
|
|
562
|
-
const { h = '100px', x = [], yAxis, arr = [], value = [] } = props
|
|
563
|
-
const echartRef = useRef(null);
|
|
564
|
-
const option = {
|
|
565
|
-
// grid: {
|
|
566
|
-
// top: "20%",
|
|
567
|
-
// left: "40",
|
|
568
|
-
// right: "40",
|
|
569
|
-
// containLabel: true,
|
|
570
|
-
// },
|
|
571
|
-
radar: {
|
|
572
|
-
indicator: arr.map((item, key) => {
|
|
573
|
-
return { name: item, max: 1 }
|
|
574
|
-
}),
|
|
575
|
-
// indicator: [
|
|
576
|
-
// { name: 'Sales', max: 6500 },
|
|
577
|
-
// { name: 'Administration', max: 16000 },
|
|
578
|
-
// { name: 'Information Technology', max: 30000 },
|
|
579
|
-
// { name: 'Customer Support', max: 38000 },
|
|
580
|
-
// ],
|
|
581
|
-
radius: '60%',
|
|
582
|
-
splitArea: {
|
|
583
|
-
areaStyle: {
|
|
584
|
-
color: 'rgba(119, 218, 155, 0)' // 设置分隔区域颜色为渐变色
|
|
585
|
-
}
|
|
586
|
-
},
|
|
587
|
-
splitLine: {
|
|
588
|
-
lineStyle: {
|
|
589
|
-
color: 'rgba(64, 175, 239, 0.15)'
|
|
590
|
-
}
|
|
591
|
-
},
|
|
592
|
-
axisLine: {
|
|
593
|
-
// show: false,
|
|
594
|
-
lineStyle: {
|
|
595
|
-
with: 1,
|
|
596
|
-
color: "rgba(130, 144, 157, 0.18)",
|
|
597
|
-
},
|
|
598
|
-
},
|
|
599
|
-
axisName: {
|
|
600
|
-
show: true,
|
|
601
|
-
color: "#9FC7DD",
|
|
602
|
-
}
|
|
603
|
-
},
|
|
604
|
-
series: [
|
|
605
|
-
{
|
|
606
|
-
name: 'Budget vs spending',
|
|
607
|
-
type: 'radar',
|
|
608
|
-
data: [
|
|
609
|
-
{
|
|
610
|
-
value: value,
|
|
611
|
-
name: 'Actual Spending'
|
|
612
|
-
}
|
|
613
|
-
],
|
|
614
|
-
lineStyle: {
|
|
615
|
-
normal: {
|
|
616
|
-
color: '#77DA9B' // 设置线条颜色为橙色,透明度为0.5
|
|
617
|
-
}
|
|
618
|
-
},
|
|
619
|
-
areaStyle: {
|
|
620
|
-
color: 'rgba(119, 218, 155, 0.3)'
|
|
621
|
-
},
|
|
622
|
-
symbol: "none",
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
]
|
|
626
|
-
};
|
|
627
|
-
const onEvents = () => { }
|
|
628
|
-
return <ReactECharts
|
|
629
|
-
ref={echartRef}
|
|
630
|
-
option={option}
|
|
631
|
-
style={{ height: h, width: "100%" }}
|
|
632
|
-
onEvents={onEvents}
|
|
633
|
-
/>
|
|
634
|
-
|
|
635
|
-
}
|
|
636
|
-
// 饼图
|
|
637
|
-
function TsingrocPie(props) {
|
|
638
|
-
const {
|
|
639
|
-
name = "饼图",
|
|
640
|
-
valueArr = [
|
|
641
|
-
{ value: 735, name: 'Search Engine' },
|
|
642
|
-
{ value: 735, name: 'Direct' },
|
|
643
|
-
{ value: 735, name: 'Email' },
|
|
644
|
-
{ value: 735, name: 'Union Ads' },
|
|
645
|
-
{ value: 735, name: 'Video Ads' }
|
|
646
|
-
], color = ["#ECA926", "#32ADF4", "#DC7756", '#62CE89', '#4256B9', '#00D0FF', '#96D0DD']
|
|
647
|
-
} = props
|
|
648
|
-
const option = {
|
|
649
|
-
color: color,
|
|
650
|
-
tooltip: {
|
|
651
|
-
trigger: 'item'
|
|
652
|
-
},
|
|
653
|
-
legend: {
|
|
654
|
-
top: '5%',
|
|
655
|
-
left: 'center',
|
|
656
|
-
show: false
|
|
657
|
-
},
|
|
658
|
-
series: [
|
|
659
|
-
{
|
|
660
|
-
name: name,
|
|
661
|
-
type: 'pie',
|
|
662
|
-
radius: ['40%', '70%'],
|
|
663
|
-
avoidLabelOverlap: false,
|
|
664
|
-
padAngle: 2,
|
|
665
|
-
itemStyle: {
|
|
666
|
-
borderRadius: 1
|
|
667
|
-
},
|
|
668
|
-
label: {
|
|
669
|
-
show: false,
|
|
670
|
-
position: 'center'
|
|
671
|
-
},
|
|
672
|
-
emphasis: {
|
|
673
|
-
label: {
|
|
674
|
-
show: true,
|
|
675
|
-
fontSize: 16,
|
|
676
|
-
fontWeight: 'bold'
|
|
677
|
-
}
|
|
678
|
-
},
|
|
679
|
-
labelLine: {
|
|
680
|
-
show: false
|
|
681
|
-
},
|
|
682
|
-
data: valueArr
|
|
683
|
-
}
|
|
684
|
-
]
|
|
685
|
-
};
|
|
686
|
-
return <div style={{ height: "100%" }}>
|
|
687
|
-
<div style={{ display: 'flex', height: "100%" }}>
|
|
688
|
-
<div style={{ flex: 3 }}>
|
|
689
|
-
<ReactECharts style={{ height: '100%' }} option={option} />
|
|
690
|
-
</div>
|
|
691
|
-
<div style={{ flex: 2, display: "flex", alignItems: 'center' }}>
|
|
692
|
-
<div style={{}}>
|
|
693
|
-
{
|
|
694
|
-
valueArr.map((item, key) => {
|
|
695
|
-
return <div key={key} style={{ fontSize: '14px', lineHeight: "20px" }}>
|
|
696
|
-
<div style={{ display: 'inline-block', width: '6px', height: '6px', backgroundColor: color[key], marginRight: "5px", transform: "translateY(-1px)" }}></div>
|
|
697
|
-
<Space>
|
|
698
|
-
<div style={{ color: "#96A9BA" }}>{item.name}:</div>
|
|
699
|
-
<div style={{ color: '#fff' }}>{item.value}</div>
|
|
700
|
-
</Space>
|
|
701
|
-
</div>
|
|
702
|
-
})
|
|
703
|
-
}
|
|
704
|
-
</div>
|
|
705
|
-
</div>
|
|
706
|
-
</div>
|
|
707
|
-
</div>
|
|
708
|
-
|
|
709
|
-
}
|
|
710
|
-
// 环形统计图
|
|
711
|
-
const CircularProgress = ({ progress,color="#34A9D4" }) => {
|
|
712
|
-
// 确保进度值在0到100之间
|
|
713
|
-
const clampProgress = (value) => Math.max(0, Math.min(100, value));
|
|
714
|
-
|
|
715
|
-
// 计算圆的周长
|
|
716
|
-
const circumference = 2 * Math.PI * 15.91549430918954;
|
|
717
|
-
|
|
718
|
-
return (
|
|
719
|
-
<div style={{ width: "100%", height: "100%", position: 'relative' }}>
|
|
720
|
-
<svg
|
|
721
|
-
width="100%"
|
|
722
|
-
height="100%"
|
|
723
|
-
viewBox="0 0 42 42"
|
|
724
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
725
|
-
>
|
|
726
|
-
<circle
|
|
727
|
-
className="circle"
|
|
728
|
-
cx="21"
|
|
729
|
-
cy="21"
|
|
730
|
-
r="15.91549430918954"
|
|
731
|
-
stroke="#22405a"
|
|
732
|
-
strokeWidth="3"
|
|
733
|
-
fill="none"
|
|
734
|
-
/>
|
|
735
|
-
<circle
|
|
736
|
-
className="circle"
|
|
737
|
-
cx="21"
|
|
738
|
-
cy="21"
|
|
739
|
-
r="15.91549430918954"
|
|
740
|
-
stroke={color}
|
|
741
|
-
// stroke="#ff0"
|
|
742
|
-
strokeWidth="3"
|
|
743
|
-
fill="none"
|
|
744
|
-
strokeDasharray={circumference}
|
|
745
|
-
strokeDashoffset={circumference - (clampProgress(progress) / 100) * circumference}
|
|
746
|
-
/>
|
|
747
|
-
</svg>
|
|
748
|
-
<div style={{ position: "absolute", top: '50%', transform: 'translateY(-50%)', textAlign: "center", width: "100%" }}>{clampProgress(progress)}%</div>
|
|
749
|
-
</div>
|
|
750
|
-
);
|
|
751
|
-
};
|
|
752
|
-
|
|
753
|
-
// 风向模拟
|
|
754
|
-
const WindFlow=React.memo(function WindFlowFunc(props) {
|
|
755
|
-
const { weatherData } = props
|
|
756
|
-
const echartRef = useRef(null)
|
|
757
|
-
const { h = '150%' } = props
|
|
758
|
-
const noise = createNoise2D(Math.random);
|
|
759
|
-
const noise2 = createNoise2D(Math.random)
|
|
760
|
-
// returns a value between -1 and 1
|
|
761
|
-
let valMin = Infinity;
|
|
762
|
-
let valMax = -Infinity;
|
|
763
|
-
let tempMap = {}
|
|
764
|
-
let orderArr = []
|
|
765
|
-
weatherData.forEach((item) => {
|
|
766
|
-
let a = item.location.split(" ")
|
|
767
|
-
let x = a[0]
|
|
768
|
-
let y = a[1]
|
|
769
|
-
if (tempMap[x]) {
|
|
770
|
-
tempMap[x].push(item)
|
|
771
|
-
} else {
|
|
772
|
-
orderArr.push(x)
|
|
773
|
-
tempMap[x] = [item]
|
|
774
|
-
}
|
|
775
|
-
})
|
|
776
|
-
orderArr.sort((a, b) => {
|
|
777
|
-
return a - b
|
|
778
|
-
})
|
|
779
|
-
Object.keys(tempMap).forEach((key) => {
|
|
780
|
-
tempMap[key].sort((a, b) => {
|
|
781
|
-
return a.location.split(" ")[1] - b.location.split(" ")[1]
|
|
782
|
-
})
|
|
783
|
-
})
|
|
784
|
-
let retArr = []
|
|
785
|
-
orderArr.forEach((key, index) => {
|
|
786
|
-
retArr[index] = tempMap[key]
|
|
787
|
-
})
|
|
788
|
-
console.log(retArr)
|
|
789
|
-
|
|
790
|
-
function generateData() {
|
|
791
|
-
var data = [];
|
|
792
|
-
// for (var i = 0; i <= 100; i++) {
|
|
793
|
-
// for (var j = 0; j <= 100; j++) {
|
|
794
|
-
// var dx = noise(i / 150, j / 150);
|
|
795
|
-
// var dy = noise2(i / 150, j / 150);
|
|
796
|
-
// var mag = Math.sqrt(dx * dx + dy * dy);
|
|
797
|
-
// valMax = Math.max(valMax, mag);
|
|
798
|
-
// valMin = Math.min(valMin, mag);
|
|
799
|
-
// // data.push([i, j, dx, dy, mag]);
|
|
800
|
-
// data.push([i, j, 0.2 + 0.01 * i, -0.9 + i * 0.01, 1])
|
|
801
|
-
// }
|
|
802
|
-
// }
|
|
803
|
-
|
|
804
|
-
// todo
|
|
805
|
-
retArr.forEach((item, i) => {
|
|
806
|
-
item.forEach((sub, j) => {
|
|
807
|
-
data.push([i, j, -Math.cos((sub.wind_direction_80m) * (Math.PI / 180)), Math.sin((sub.wind_direction_80m) * (Math.PI / 180)), 1])
|
|
808
|
-
})
|
|
809
|
-
}
|
|
810
|
-
)
|
|
811
|
-
return data;
|
|
812
|
-
}
|
|
813
|
-
const data = generateData()
|
|
814
|
-
// const data = windData
|
|
815
|
-
const onEvents = {
|
|
816
|
-
" click": () => { },
|
|
817
|
-
};
|
|
818
|
-
const option = {
|
|
819
|
-
grid: {
|
|
820
|
-
left: 0,
|
|
821
|
-
top: 0,
|
|
822
|
-
bottom: 0,
|
|
823
|
-
right: 0
|
|
824
|
-
},
|
|
825
|
-
visualMap: {
|
|
826
|
-
show: false,
|
|
827
|
-
min: valMin,
|
|
828
|
-
max: valMax,
|
|
829
|
-
dimension: 2,
|
|
830
|
-
inRange: {
|
|
831
|
-
color: [
|
|
832
|
-
'#fff',
|
|
833
|
-
]
|
|
834
|
-
}
|
|
835
|
-
},
|
|
836
|
-
|
|
837
|
-
xAxis: {
|
|
838
|
-
type: 'value',
|
|
839
|
-
axisLine: {
|
|
840
|
-
|
|
841
|
-
lineStyle: {
|
|
842
|
-
color: '#fff'
|
|
843
|
-
}
|
|
844
|
-
},
|
|
845
|
-
splitLine: {
|
|
846
|
-
show: false,
|
|
847
|
-
lineStyle: {
|
|
848
|
-
color: 'rgba(255,255,255,0.2)'
|
|
849
|
-
}
|
|
850
|
-
}
|
|
851
|
-
},
|
|
852
|
-
yAxis: {
|
|
853
|
-
type: 'value',
|
|
854
|
-
axisLine: {
|
|
855
|
-
lineStyle: {
|
|
856
|
-
color: '#fff'
|
|
857
|
-
}
|
|
858
|
-
},
|
|
859
|
-
show: false,
|
|
860
|
-
splitLine: {
|
|
861
|
-
show: false,
|
|
862
|
-
lineStyle: {
|
|
863
|
-
color: 'rgba(255,255,255,0.2)'
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
},
|
|
867
|
-
series: [
|
|
868
|
-
{
|
|
869
|
-
type: 'flowGL',
|
|
870
|
-
data: data,
|
|
871
|
-
particleDensity: 20,
|
|
872
|
-
particleSize: 3,
|
|
873
|
-
// particleDensity: 15,
|
|
874
|
-
// particleSize: 3,
|
|
875
|
-
particleSpeed: 0.5,
|
|
876
|
-
itemStyle: {
|
|
877
|
-
opacity: 0.5
|
|
878
|
-
}
|
|
879
|
-
},
|
|
880
|
-
// {
|
|
881
|
-
// type: 'custom',
|
|
882
|
-
// data: data,
|
|
883
|
-
// encode: {
|
|
884
|
-
// x: 0,
|
|
885
|
-
// y: 0
|
|
886
|
-
// },
|
|
887
|
-
// renderItem: function (params, api) {
|
|
888
|
-
// var x = api.value(0),
|
|
889
|
-
// y = api.value(1),
|
|
890
|
-
// dx = api.value(2),
|
|
891
|
-
// dy = api.value(3);
|
|
892
|
-
// var start = api.coord([x - dx / 2, y - dy / 2]);
|
|
893
|
-
// var end = api.coord([x + dx / 2, y + dy / 2]);
|
|
894
|
-
// return {
|
|
895
|
-
// type: 'line',
|
|
896
|
-
// shape: {
|
|
897
|
-
// x1: start[0],
|
|
898
|
-
// y1: start[1],
|
|
899
|
-
// x2: end[0],
|
|
900
|
-
// y2: end[1]
|
|
901
|
-
// },
|
|
902
|
-
// style: {
|
|
903
|
-
// lineWidth: 2,
|
|
904
|
-
// stroke: '#fff',
|
|
905
|
-
// opacity: 1
|
|
906
|
-
// }
|
|
907
|
-
// };
|
|
908
|
-
// }
|
|
909
|
-
// }
|
|
910
|
-
]
|
|
911
|
-
}
|
|
912
|
-
|
|
913
|
-
return (
|
|
914
|
-
<ReactECharts
|
|
915
|
-
ref={echartRef}
|
|
916
|
-
option={option}
|
|
917
|
-
style={{ height: h, width: "110%" ,marginTop:"-100px"}}
|
|
918
|
-
onEvents={onEvents}
|
|
919
|
-
/>
|
|
920
|
-
);
|
|
921
|
-
}
|
|
922
|
-
)
|
|
923
|
-
// 箱线图
|
|
924
|
-
function BoxplotEchart(props) {
|
|
925
|
-
const { h = '100px', x = [], yAxis, yArr = [] } = props
|
|
926
|
-
const echartRef = useRef(null);
|
|
927
|
-
const option = {
|
|
928
|
-
tooltip: {
|
|
929
|
-
trigger: 'item',
|
|
930
|
-
axisPointer: {
|
|
931
|
-
type: 'shadow'
|
|
932
|
-
}
|
|
933
|
-
},
|
|
934
|
-
grid: {
|
|
935
|
-
top: "30",
|
|
936
|
-
left: "40",
|
|
937
|
-
right: "40",
|
|
938
|
-
bottom: "20",
|
|
939
|
-
containLabel: true,
|
|
940
|
-
},
|
|
941
|
-
xAxis: {
|
|
942
|
-
type: 'category',
|
|
943
|
-
boundaryGap: true,
|
|
944
|
-
splitArea: {
|
|
945
|
-
show: false
|
|
946
|
-
},
|
|
947
|
-
splitLine: {
|
|
948
|
-
show: false
|
|
949
|
-
},
|
|
950
|
-
data: x,
|
|
951
|
-
},
|
|
952
|
-
yAxis: {
|
|
953
|
-
type: 'value',
|
|
954
|
-
max: 50,
|
|
955
|
-
min: -50,
|
|
956
|
-
name: yAxis || 'km/s minus 299,000',
|
|
957
|
-
splitLine: {
|
|
958
|
-
lineStyle: {
|
|
959
|
-
color: "rgba(130, 144, 157, 0.18)",
|
|
960
|
-
},
|
|
961
|
-
},
|
|
962
|
-
splitNumber: 3,
|
|
963
|
-
},
|
|
964
|
-
series: [
|
|
965
|
-
{
|
|
966
|
-
name: 'boxplot',
|
|
967
|
-
type: 'boxplot',
|
|
968
|
-
data: yArr,
|
|
969
|
-
tooltip: {
|
|
970
|
-
formatter: function (param) {
|
|
971
|
-
return [
|
|
972
|
-
'时间 ' + param.name,
|
|
973
|
-
'最大值: ' + param.data[5].toFixed(2) + '%',
|
|
974
|
-
'第三四分位数: ' + param.data[4].toFixed(2) + '%',
|
|
975
|
-
'中位数: ' + param.data[2].toFixed(2) + '%',
|
|
976
|
-
'第一四分位数: ' + param.data[3].toFixed(2) + '%',
|
|
977
|
-
'最小值: ' + param.data[1].toFixed(2) + '%'
|
|
978
|
-
].join('<br/>')
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
}
|
|
982
|
-
]
|
|
983
|
-
};
|
|
984
|
-
const onEvents = () => { }
|
|
985
|
-
return <ReactECharts
|
|
986
|
-
ref={echartRef}
|
|
987
|
-
option={option}
|
|
988
|
-
style={{ height: h, width: "100%" }}
|
|
989
|
-
onEvents={onEvents}
|
|
990
|
-
/>
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
function EchartJustOneLine(props) {
|
|
995
|
-
const {
|
|
996
|
-
x=[], y=[], h = '350px', styleObj = {},bottom,left="0%",isLine,w,top='0%'
|
|
997
|
-
} = props;
|
|
998
|
-
const option = {
|
|
999
|
-
grid: {
|
|
1000
|
-
left: left,
|
|
1001
|
-
right:'0',
|
|
1002
|
-
top: top,
|
|
1003
|
-
},
|
|
1004
|
-
xAxis: {
|
|
1005
|
-
type: 'category',
|
|
1006
|
-
data: x,
|
|
1007
|
-
show: isLine,
|
|
1008
|
-
axisLine: {
|
|
1009
|
-
show: isLine
|
|
1010
|
-
},
|
|
1011
|
-
},
|
|
1012
|
-
yAxis: {
|
|
1013
|
-
splitLine: {
|
|
1014
|
-
show: false
|
|
1015
|
-
},
|
|
1016
|
-
type: 'value'
|
|
1017
|
-
},
|
|
1018
|
-
series: [
|
|
1019
|
-
{
|
|
1020
|
-
data: y,
|
|
1021
|
-
type: 'line',
|
|
1022
|
-
smooth: true,
|
|
1023
|
-
name: "电价",
|
|
1024
|
-
symbol: 'none',
|
|
1025
|
-
lineStyle: {
|
|
1026
|
-
color: styleObj.lineColor
|
|
1027
|
-
},
|
|
1028
|
-
areaStyle: {
|
|
1029
|
-
color: {
|
|
1030
|
-
type: 'linear',
|
|
1031
|
-
x: 0,
|
|
1032
|
-
y: 0,
|
|
1033
|
-
x2: 0,
|
|
1034
|
-
y2: 1,
|
|
1035
|
-
colorStops: [{
|
|
1036
|
-
offset: 0, color: styleObj.areaStyle ? styleObj.areaStyle[0] : '', // 0% 处的颜色
|
|
1037
|
-
}, {
|
|
1038
|
-
offset: 1, color: styleObj.areaStyle ? styleObj.areaStyle[1] : '', // 100% 处的颜色
|
|
1039
|
-
}],
|
|
1040
|
-
global: false, // 缺省为 false
|
|
1041
|
-
|
|
1042
|
-
},
|
|
1043
|
-
},
|
|
1044
|
-
}
|
|
1045
|
-
]
|
|
1046
|
-
};
|
|
1047
|
-
if(bottom){
|
|
1048
|
-
option.grid.bottom=bottom
|
|
1049
|
-
}
|
|
1050
|
-
const echartRef=useRef()
|
|
1051
|
-
useEffect(() => {
|
|
1052
|
-
if (echartRef.current) {
|
|
1053
|
-
const ins = echartRef.current.getEchartsInstance();
|
|
1054
|
-
ins.setOption(
|
|
1055
|
-
option
|
|
1056
|
-
);
|
|
1057
|
-
}
|
|
1058
|
-
}, [props]);
|
|
1059
|
-
return (
|
|
1060
|
-
<ReactECharts ref={echartRef} option={option} style={{ height: h,width:w}} />
|
|
1061
|
-
);
|
|
1062
|
-
}
|
|
1063
|
-
|
|
1064
|
-
function TsingrocMonthPick(props){
|
|
1065
|
-
const {value,onChange:propsOnChange,dataType ='month',className,popupClassName}=props
|
|
1066
|
-
const [dateValue,setDateValue]=useState(value)
|
|
1067
|
-
const quickGo=(type)=>{
|
|
1068
|
-
let temp = dateValue.add(type, dataType)
|
|
1069
|
-
setDateValue(temp)
|
|
1070
|
-
propsOnChange && propsOnChange(temp)
|
|
1071
|
-
}
|
|
1072
|
-
const onChange=(value)=>{
|
|
1073
|
-
setDateValue(value)
|
|
1074
|
-
propsOnChange && propsOnChange(value)
|
|
1075
|
-
}
|
|
1076
|
-
return <div>
|
|
1077
|
-
<div onClick={() => { quickGo(-1) }} className={`quick-jump ${className}`} style={{borderRight: 'none', borderRadius: '2px 0 0 2px' }}>
|
|
1078
|
-
<LeftOutlined className="quick-icon" />
|
|
1079
|
-
</div>
|
|
1080
|
-
{
|
|
1081
|
-
dataType === 'day' && <DatePicker value={dateValue} onChange={onChange} />
|
|
1082
|
-
}
|
|
1083
|
-
{
|
|
1084
|
-
dataType === 'week' && <DatePicker value={dateValue} onChange={onChange} picker="week" />
|
|
1085
|
-
}
|
|
1086
|
-
{
|
|
1087
|
-
dataType === 'month' && <DatePicker popupClassName={popupClassName} className={className} value={dateValue} onChange={onChange} picker="month" />
|
|
1088
|
-
}
|
|
1089
|
-
<div onClick={() => { quickGo(1) }} className={`quick-jump ${className}`} style={{ borderLeft:'none', borderRadius: '0 2px 2px 0' }}>
|
|
1090
|
-
<RightOutlined className="quick-icon" />
|
|
1091
|
-
</div>
|
|
1092
|
-
|
|
1093
|
-
</div>
|
|
1094
|
-
}
|
|
1095
|
-
|
|
1096
|
-
function ImageBac(props){
|
|
1097
|
-
const {children, width='100%',height='100%',url="",style,}=props
|
|
1098
|
-
let relativeUrl=''
|
|
1099
|
-
if(url.startsWith('@')){
|
|
1100
|
-
relativeUrl=url.replace('@','../../../../..')
|
|
1101
|
-
}else{
|
|
1102
|
-
relativeUrl=url
|
|
1103
|
-
}
|
|
1104
|
-
return <div style={{...style,backgroundSize:'100% 100%',width:width,height:height,backgroundImage:`url('${relativeUrl}')`}}>
|
|
1105
|
-
{children}
|
|
1106
|
-
</div>
|
|
1107
|
-
}
|
|
1108
|
-
|
|
1109
|
-
export {
|
|
1110
|
-
ImageBac,
|
|
1111
|
-
EchartMult,
|
|
1112
|
-
RiskEchartMult,
|
|
1113
|
-
TsingrocDatePick,
|
|
1114
|
-
RadarEchart,
|
|
1115
|
-
TsingrocPie,
|
|
1116
|
-
CircularProgress,
|
|
1117
|
-
WindFlow,
|
|
1118
|
-
BoxplotEchart,
|
|
1119
|
-
EchartJustOneLine,
|
|
1120
|
-
TsingrocMonthPick
|
|
1121
|
-
}
|