st-comp 0.0.22 → 0.0.23

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "st-comp",
3
3
  "public": true,
4
- "version": "0.0.22",
4
+ "version": "0.0.23",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",
@@ -11,15 +11,22 @@
11
11
  import type { EChartsType } from 'echarts'
12
12
 
13
13
  const defaultConfig = {
14
- tooltipFormatter: null
14
+ tooltipFormatter: null,
15
+ dataZoom: null,
16
+ grid: {
17
+ left: '60px',
18
+ bottom: '20px',
19
+ right: '0',
20
+ top: 0
21
+ }
15
22
  }
16
23
  let chart: EChartsType
17
24
  let resizeRo: any
18
25
 
19
26
  const props = defineProps({
20
27
  data: {
21
- type: Array,
22
- default: () => ([]),
28
+ type: Object,
29
+ default: () => ({}),
23
30
  }, // 数据
24
31
  config: {
25
32
  type: Object,
@@ -61,257 +68,54 @@
61
68
  })
62
69
 
63
70
  const draw = () => {
64
- const xAxisData = [
65
- "2015-07-09 09:00:00",
66
- "2015-07-10 09:00:00",
67
- "2015-07-11 09:00:00",
68
- "2015-07-12 09:00:00",
69
- "2015-07-13 09:00:00",
70
- "2015-07-14 09:00:00",
71
- "2015-07-15 09:00:00",
72
- "2015-07-16 09:00:00",
73
- "2015-07-17 09:00:00",
74
- "2015-07-18 09:00:00",
75
- "2015-07-19 09:00:00",
76
- "2015-07-20 09:00:00",
77
- "2015-07-21 09:00:00",
78
- "2015-07-22 09:00:00",
79
- "2015-07-23 09:00:00",
80
- "2015-07-24 09:00:00",
81
- "2015-07-25 09:00:00",
82
- "2015-07-26 09:00:00",
83
- "2015-07-27 09:00:00",
84
- "2015-07-28 09:00:00",
85
- "2015-07-29 09:00:00",
86
- "2015-07-30 09:00:00",
87
- "2015-07-31 09:00:00",
88
- "2015-08-01 09:00:00",
89
- ];
90
- const yAxisData = ["平安银行", "万科A", "国华网安", "ST星源", "中国宝安", "神州数码", "华联控股"];
91
- const seriesData = [
92
- [0, 0, 5],
93
- [0, 1, 1],
94
- [0, 2, 0],
95
- [0, 3, 0],
96
- [0, 4, 0],
97
- [0, 5, 0],
98
- [0, 6, 0],
99
- [0, 7, 0],
100
- [0, 8, 0],
101
- [0, 9, 0],
102
- [0, 10, 0],
103
- [0, 11, 2],
104
- [0, 12, 4],
105
- [0, 13, 1],
106
- [0, 14, 1],
107
- [0, 15, 3],
108
- [0, 16, 4],
109
- [0, 17, 6],
110
- [0, 18, 4],
111
- [0, 19, 4],
112
- [0, 20, 3],
113
- [0, 21, 3],
114
- [0, 22, 2],
115
- [0, 23, 5],
116
- [1, 0, 7],
117
- [1, 1, 0],
118
- [1, 2, 0],
119
- [1, 3, 0],
120
- [1, 4, 0],
121
- [1, 5, 0],
122
- [1, 6, 0],
123
- [1, 7, 0],
124
- [1, 8, 0],
125
- [1, 9, 0],
126
- [1, 10, 5],
127
- [1, 11, 2],
128
- [1, 12, 2],
129
- [1, 13, 6],
130
- [1, 14, 9],
131
- [1, 15, 11],
132
- [1, 16, 6],
133
- [1, 17, 7],
134
- [1, 18, 8],
135
- [1, 19, 12],
136
- [1, 20, 5],
137
- [1, 21, 5],
138
- [1, 22, 7],
139
- [1, 23, 2],
140
- [2, 0, 1],
141
- [2, 1, 1],
142
- [2, 2, 0],
143
- [2, 3, 0],
144
- [2, 4, 0],
145
- [2, 5, 0],
146
- [2, 6, 0],
147
- [2, 7, 0],
148
- [2, 8, 0],
149
- [2, 9, 0],
150
- [2, 10, 3],
151
- [2, 11, 2],
152
- [2, 12, 1],
153
- [2, 13, 9],
154
- [2, 14, 8],
155
- [2, 15, 10],
156
- [2, 16, 6],
157
- [2, 17, 5],
158
- [2, 18, 5],
159
- [2, 19, 5],
160
- [2, 20, 7],
161
- [2, 21, 4],
162
- [2, 22, 2],
163
- [2, 23, 4],
164
- [3, 0, 7],
165
- [3, 1, 3],
166
- [3, 2, 0],
167
- [3, 3, 0],
168
- [3, 4, 0],
169
- [3, 5, 0],
170
- [3, 6, 0],
171
- [3, 7, 0],
172
- [3, 8, 1],
173
- [3, 9, 0],
174
- [3, 10, 5],
175
- [3, 11, 4],
176
- [3, 12, 7],
177
- [3, 13, 14],
178
- [3, 14, 13],
179
- [3, 15, 12],
180
- [3, 16, 9],
181
- [3, 17, 5],
182
- [3, 18, 5],
183
- [3, 19, 10],
184
- [3, 20, 6],
185
- [3, 21, 4],
186
- [3, 22, 4],
187
- [3, 23, 1],
188
- [4, 0, 1],
189
- [4, 1, 3],
190
- [4, 2, 0],
191
- [4, 3, 0],
192
- [4, 4, 0],
193
- [4, 5, 1],
194
- [4, 6, 0],
195
- [4, 7, 0],
196
- [4, 8, 0],
197
- [4, 9, 2],
198
- [4, 10, 4],
199
- [4, 11, 4],
200
- [4, 12, 2],
201
- [4, 13, 4],
202
- [4, 14, 4],
203
- [4, 15, 14],
204
- [4, 16, 12],
205
- [4, 17, 1],
206
- [4, 18, 8],
207
- [4, 19, 5],
208
- [4, 20, 3],
209
- [4, 21, 7],
210
- [4, 22, 3],
211
- [4, 23, 0],
212
- [5, 0, 2],
213
- [5, 1, 1],
214
- [5, 2, 0],
215
- [5, 3, 3],
216
- [5, 4, 0],
217
- [5, 5, 0],
218
- [5, 6, 0],
219
- [5, 7, 0],
220
- [5, 8, 2],
221
- [5, 9, 0],
222
- [5, 10, 4],
223
- [5, 11, 1],
224
- [5, 12, 5],
225
- [5, 13, 10],
226
- [5, 14, 5],
227
- [5, 15, 7],
228
- [5, 16, 11],
229
- [5, 17, 6],
230
- [5, 18, 0],
231
- [5, 19, 5],
232
- [5, 20, 3],
233
- [5, 21, 4],
234
- [5, 22, 2],
235
- [5, 23, 0],
236
- [6, 0, 1],
237
- [6, 1, 0],
238
- [6, 2, 0],
239
- [6, 3, 0],
240
- [6, 4, 0],
241
- [6, 5, 0],
242
- [6, 6, 0],
243
- [6, 7, 0],
244
- [6, 8, 0],
245
- [6, 9, 0],
246
- [6, 10, 1],
247
- [6, 11, 0],
248
- [6, 12, 2],
249
- [6, 13, 1],
250
- [6, 14, 3],
251
- [6, 15, 4],
252
- [6, 16, 0],
253
- [6, 17, 0],
254
- [6, 18, 0],
255
- [6, 19, 0],
256
- [6, 20, 1],
257
- [6, 21, 2],
258
- [6, 22, 2],
259
- [6, 23, 6],
260
- ].map(function (item) {
261
- // 三维数组[X轴位置,Y轴位置,值]
262
- return [item[1], item[0], item[2] || "-"];
263
- });
264
71
  chart.setOption(
265
72
  {
266
73
  tooltip: {
267
- position: "top",
268
- },
269
- grid: {
270
- left: '60px',
271
- bottom: '20px',
272
- right: 0,
273
- top: '40px'
74
+ confine: true,
75
+ formatter: mergeConfig.value.tooltipFormatter
274
76
  },
77
+ grid: mergeConfig.value.grid,
275
78
  xAxis: {
276
79
  type: "category",
277
- data: xAxisData,
80
+ data: props.data.date,
278
81
  },
279
82
  yAxis: {
280
83
  type: "category",
281
- data: yAxisData,
84
+ inverse: true,
85
+ data: props.data.data.map((i: any) => i.name),
282
86
  },
283
87
  visualMap: {
284
88
  type: 'piecewise', // 类型: 分段式[piecewise] | 连续形[continuous]
285
- min: 1, // 最小值
286
- max: 5, // 最大值
287
- calculable: true, // 是否显示拖拽用的手柄
288
- orient: "horizontal", // 放置visualMap组件: 水平[horizontal] | 垂直[vertical]
289
- pieces: [
290
- {value:1,label:'-1颜色',color:'#00ff99'},
291
- {value:2,label:'-2颜色',color:'#33cc33'},
292
- {value:3,label:'-3颜色',color:'#520101'},
293
- {value:4,label:'-4颜色',color:'#8b011c'},
294
- {value:5,label:'-5颜色',color:'#ff0000'},
295
- ],
296
- // inRange: ['#00ff99','#33cc33','#520101','#8b011c','#ff0000'],
297
- top:0,
298
- right: 0,
89
+ show: false,
90
+ inRange: [],
299
91
  },
92
+ dataZoom: mergeConfig.value.dataZoom,
300
93
  series: [
301
94
  {
302
95
  name: "热力图",
303
96
  type: "heatmap",
304
- data: seriesData,
97
+ data: props.data.data.reduce((res: any[], item: any, index: number) => {
98
+ return [
99
+ ...res,
100
+ ...item.data.reduce((res: any[], i: any, iIndex: number) => {
101
+ if (i === null) {
102
+ return res
103
+ }
104
+ return [
105
+ ...res,
106
+ {
107
+ value: [iIndex, index, i.value],
108
+ itemStyle: {
109
+ color: i.color
110
+ },
111
+ }
112
+ ]
113
+ }, [])
114
+ ]
115
+ }, []),
305
116
  label: {
306
117
  show: false, // 是否展示方块格上的数字
307
118
  },
308
- // 高亮状态的图形样式
309
- emphasis: {
310
- itemStyle: {
311
- shadowBlur: 10,
312
- shadowColor: "rgba(0, 0, 0, 0.5)",
313
- },
314
- },
315
119
  },
316
120
  ],
317
121
  }