st-comp 0.0.44 → 0.0.46

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 (31) hide show
  1. package/lib/bundle.js +134165 -135341
  2. package/lib/bundle.umd.cjs +62 -66
  3. package/lib/style.css +1 -1
  4. package/package.json +3 -3
  5. package/packages/Kline/index.vue +201 -7
  6. package/packages/Kline/option.ts +169 -8
  7. package/packages/Kline/type.d.ts +1 -0
  8. package/packages/KlineNew/components/KlineSlide/index.vue +150 -0
  9. package/packages/KlineNew/components/KlineSub/index.vue +320 -0
  10. package/packages/KlineNew/components/KlineTips/index.vue +61 -0
  11. package/packages/KlineNew/components/KlineUtils/index.vue +304 -0
  12. package/packages/KlineNew/components/Tips/index.vue +33 -0
  13. package/packages/KlineNew/index.ts +8 -2
  14. package/src/pages/Kline/api.ts +81 -39
  15. package/src/pages/Kline/components/SingleCycleSingleVariety.vue +155 -78
  16. package/src/pages/KlineNew/components/KlineAction/components/ContextMenu/index.vue +91 -0
  17. package/src/pages/KlineNew/components/KlineAction/components/YearChart/index.vue +532 -0
  18. package/src/pages/KlineNew/components/KlineAction/images/pen.png +0 -0
  19. package/src/pages/KlineNew/components/KlineAction/index.vue +716 -0
  20. package/src/pages/KlineNew/components/KlineAction/mockApi/index.js +13 -0
  21. package/src/pages/KlineNew/components/KlineAction/utils.js +571 -0
  22. package/src/pages/KlineNew/components/KlineBasic/index.vue +336 -0
  23. package/src/pages/KlineNew/components/KlineBasic/utils.js +33 -0
  24. package/src/pages/KlineNew/components/KlineSlide/index.vue +446 -0
  25. package/src/pages/KlineNew/components/KlineSlide/utils.js +78 -0
  26. package/src/pages/KlineNew/index.vue +73 -5
  27. package/vite.config.ts +1 -1
  28. package/vitePlugins/createExportFile.ts +2 -1
  29. package/packages/KlineNew/index.vue +0 -310
  30. package/packages/KlineNew/option.ts +0 -150
  31. package/packages/KlineNew/utils.ts +0 -13
@@ -0,0 +1,532 @@
1
+ <!-- 价差周期性图 -->
2
+ <script setup name="YearChart">
3
+ import * as echarts from "echarts";
4
+ import { ref, onMounted, onUnmounted, watch } from "vue";
5
+
6
+ const props = defineProps({
7
+ // 接口数据
8
+ data: {
9
+ type: Array,
10
+ default: () => [],
11
+ },
12
+ });
13
+
14
+ const chartRef = ref(null);
15
+ const chartOption = ref({});
16
+ let chart = null;
17
+ let chartObserver = null;
18
+
19
+ // 颜色配置
20
+ const colorList = [
21
+ "#FFFFFF",
22
+ "#FFDD00",
23
+ "#FF00FF",
24
+ "#00FF00",
25
+ "#FF6000",
26
+ "#1677FF",
27
+ "#7C3CC9",
28
+ "#FF0000",
29
+ "#FB9A0E",
30
+ "#00B7FF",
31
+ ];
32
+
33
+ // 格式化图表配置项
34
+ const handleOption = () => {
35
+ // 图例数据
36
+ const legendData = props.data.map((item) => item.year + "");
37
+ // X轴数据
38
+ const xAxisData = [
39
+ "01-01",
40
+ "01-02",
41
+ "01-03",
42
+ "01-04",
43
+ "01-05",
44
+ "01-06",
45
+ "01-07",
46
+ "01-08",
47
+ "01-09",
48
+ "01-10",
49
+ "01-11",
50
+ "01-12",
51
+ "01-13",
52
+ "01-14",
53
+ "01-15",
54
+ "01-16",
55
+ "01-17",
56
+ "01-18",
57
+ "01-19",
58
+ "01-20",
59
+ "01-21",
60
+ "01-22",
61
+ "01-23",
62
+ "01-24",
63
+ "01-25",
64
+ "01-26",
65
+ "01-27",
66
+ "01-28",
67
+ "01-29",
68
+ "01-30",
69
+ "01-31",
70
+ "02-01",
71
+ "02-02",
72
+ "02-03",
73
+ "02-04",
74
+ "02-05",
75
+ "02-06",
76
+ "02-07",
77
+ "02-08",
78
+ "02-09",
79
+ "02-10",
80
+ "02-11",
81
+ "02-12",
82
+ "02-13",
83
+ "02-14",
84
+ "02-15",
85
+ "02-16",
86
+ "02-17",
87
+ "02-18",
88
+ "02-19",
89
+ "02-20",
90
+ "02-21",
91
+ "02-22",
92
+ "02-23",
93
+ "02-24",
94
+ "02-25",
95
+ "02-26",
96
+ "02-27",
97
+ "02-28",
98
+ "02-29",
99
+ "03-01",
100
+ "03-02",
101
+ "03-03",
102
+ "03-04",
103
+ "03-05",
104
+ "03-06",
105
+ "03-07",
106
+ "03-08",
107
+ "03-09",
108
+ "03-10",
109
+ "03-11",
110
+ "03-12",
111
+ "03-13",
112
+ "03-14",
113
+ "03-15",
114
+ "03-16",
115
+ "03-17",
116
+ "03-18",
117
+ "03-19",
118
+ "03-20",
119
+ "03-21",
120
+ "03-22",
121
+ "03-23",
122
+ "03-24",
123
+ "03-25",
124
+ "03-26",
125
+ "03-27",
126
+ "03-28",
127
+ "03-29",
128
+ "03-30",
129
+ "03-31",
130
+ "04-01",
131
+ "04-02",
132
+ "04-03",
133
+ "04-04",
134
+ "04-05",
135
+ "04-06",
136
+ "04-07",
137
+ "04-08",
138
+ "04-09",
139
+ "04-10",
140
+ "04-11",
141
+ "04-12",
142
+ "04-13",
143
+ "04-14",
144
+ "04-15",
145
+ "04-16",
146
+ "04-17",
147
+ "04-18",
148
+ "04-19",
149
+ "04-20",
150
+ "04-21",
151
+ "04-22",
152
+ "04-23",
153
+ "04-24",
154
+ "04-25",
155
+ "04-26",
156
+ "04-27",
157
+ "04-28",
158
+ "04-29",
159
+ "04-30",
160
+ "05-01",
161
+ "05-02",
162
+ "05-03",
163
+ "05-04",
164
+ "05-05",
165
+ "05-06",
166
+ "05-07",
167
+ "05-08",
168
+ "05-09",
169
+ "05-10",
170
+ "05-11",
171
+ "05-12",
172
+ "05-13",
173
+ "05-14",
174
+ "05-15",
175
+ "05-16",
176
+ "05-17",
177
+ "05-18",
178
+ "05-19",
179
+ "05-20",
180
+ "05-21",
181
+ "05-22",
182
+ "05-23",
183
+ "05-24",
184
+ "05-25",
185
+ "05-26",
186
+ "05-27",
187
+ "05-28",
188
+ "05-29",
189
+ "05-30",
190
+ "05-31",
191
+ "06-01",
192
+ "06-02",
193
+ "06-03",
194
+ "06-04",
195
+ "06-05",
196
+ "06-06",
197
+ "06-07",
198
+ "06-08",
199
+ "06-09",
200
+ "06-10",
201
+ "06-11",
202
+ "06-12",
203
+ "06-13",
204
+ "06-14",
205
+ "06-15",
206
+ "06-16",
207
+ "06-17",
208
+ "06-18",
209
+ "06-19",
210
+ "06-20",
211
+ "06-21",
212
+ "06-22",
213
+ "06-23",
214
+ "06-24",
215
+ "06-25",
216
+ "06-26",
217
+ "06-27",
218
+ "06-28",
219
+ "06-29",
220
+ "06-30",
221
+ "07-01",
222
+ "07-02",
223
+ "07-03",
224
+ "07-04",
225
+ "07-05",
226
+ "07-06",
227
+ "07-07",
228
+ "07-08",
229
+ "07-09",
230
+ "07-10",
231
+ "07-11",
232
+ "07-12",
233
+ "07-13",
234
+ "07-14",
235
+ "07-15",
236
+ "07-16",
237
+ "07-17",
238
+ "07-18",
239
+ "07-19",
240
+ "07-20",
241
+ "07-21",
242
+ "07-22",
243
+ "07-23",
244
+ "07-24",
245
+ "07-25",
246
+ "07-26",
247
+ "07-27",
248
+ "07-28",
249
+ "07-29",
250
+ "07-30",
251
+ "07-31",
252
+ "08-01",
253
+ "08-02",
254
+ "08-03",
255
+ "08-04",
256
+ "08-05",
257
+ "08-06",
258
+ "08-07",
259
+ "08-08",
260
+ "08-09",
261
+ "08-10",
262
+ "08-11",
263
+ "08-12",
264
+ "08-13",
265
+ "08-14",
266
+ "08-15",
267
+ "08-16",
268
+ "08-17",
269
+ "08-18",
270
+ "08-19",
271
+ "08-20",
272
+ "08-21",
273
+ "08-22",
274
+ "08-23",
275
+ "08-24",
276
+ "08-25",
277
+ "08-26",
278
+ "08-27",
279
+ "08-28",
280
+ "08-29",
281
+ "08-30",
282
+ "08-31",
283
+ "09-01",
284
+ "09-02",
285
+ "09-03",
286
+ "09-04",
287
+ "09-05",
288
+ "09-06",
289
+ "09-07",
290
+ "09-08",
291
+ "09-09",
292
+ "09-10",
293
+ "09-11",
294
+ "09-12",
295
+ "09-13",
296
+ "09-14",
297
+ "09-15",
298
+ "09-16",
299
+ "09-17",
300
+ "09-18",
301
+ "09-19",
302
+ "09-20",
303
+ "09-21",
304
+ "09-22",
305
+ "09-23",
306
+ "09-24",
307
+ "09-25",
308
+ "09-26",
309
+ "09-27",
310
+ "09-28",
311
+ "09-29",
312
+ "09-30",
313
+ "10-01",
314
+ "10-02",
315
+ "10-03",
316
+ "10-04",
317
+ "10-05",
318
+ "10-06",
319
+ "10-07",
320
+ "10-08",
321
+ "10-09",
322
+ "10-10",
323
+ "10-11",
324
+ "10-12",
325
+ "10-13",
326
+ "10-14",
327
+ "10-15",
328
+ "10-16",
329
+ "10-17",
330
+ "10-18",
331
+ "10-19",
332
+ "10-20",
333
+ "10-21",
334
+ "10-22",
335
+ "10-23",
336
+ "10-24",
337
+ "10-25",
338
+ "10-26",
339
+ "10-27",
340
+ "10-28",
341
+ "10-29",
342
+ "10-30",
343
+ "10-31",
344
+ "11-01",
345
+ "11-02",
346
+ "11-03",
347
+ "11-04",
348
+ "11-05",
349
+ "11-06",
350
+ "11-07",
351
+ "11-08",
352
+ "11-09",
353
+ "11-10",
354
+ "11-11",
355
+ "11-12",
356
+ "11-13",
357
+ "11-14",
358
+ "11-15",
359
+ "11-16",
360
+ "11-17",
361
+ "11-18",
362
+ "11-19",
363
+ "11-20",
364
+ "11-21",
365
+ "11-22",
366
+ "11-23",
367
+ "11-24",
368
+ "11-25",
369
+ "11-26",
370
+ "11-27",
371
+ "11-28",
372
+ "11-29",
373
+ "11-30",
374
+ "12-01",
375
+ "12-02",
376
+ "12-03",
377
+ "12-04",
378
+ "12-05",
379
+ "12-06",
380
+ "12-07",
381
+ "12-08",
382
+ "12-09",
383
+ "12-10",
384
+ "12-11",
385
+ "12-12",
386
+ "12-13",
387
+ "12-14",
388
+ "12-15",
389
+ "12-16",
390
+ "12-17",
391
+ "12-18",
392
+ "12-19",
393
+ "12-20",
394
+ "12-21",
395
+ "12-22",
396
+ "12-23",
397
+ "12-24",
398
+ "12-25",
399
+ "12-26",
400
+ "12-27",
401
+ "12-28",
402
+ "12-29",
403
+ "12-30",
404
+ "12-31",
405
+ ];
406
+ // 线条数据
407
+ const series = props.data.map((item, index) => {
408
+ return {
409
+ name: item.year,
410
+ type: "line",
411
+ data: item.infos.map((info) => {
412
+ return [info.genTime, info.close];
413
+ }),
414
+ symbol: "none",
415
+ itemStyle: {
416
+ color: colorList[index],
417
+ },
418
+ lineStyle: {
419
+ width: 1,
420
+ },
421
+ connectNulls: false,
422
+ };
423
+ });
424
+ chartOption.value = {
425
+ legend: {
426
+ right: "60px",
427
+ itemWidth: 14,
428
+ itemHeight: 14,
429
+ textStyle: {
430
+ color: "#FFF",
431
+ padding: [2, 0, 0, 0],
432
+ rich: {},
433
+ },
434
+ icon: "roundRect",
435
+ align: "right",
436
+ data: legendData,
437
+ },
438
+ tooltip: {
439
+ show: false,
440
+ trigger: "axis",
441
+ textStyle: {
442
+ color: "#fff",
443
+ },
444
+ formatter: (params) => {
445
+ const title = `<span style="font-size: 12px;">${params[0].axisValueLabel}</span>`;
446
+ const content = params.reduce((result, item) => {
447
+ const icon = `<span style="background-color:${item.color};width: 10px;height: 10px;margin-right: 5px;display: inline-block;"></span>`;
448
+ const name = `<span style="margin-right: 10px;display: inline-block;font-size: 12px;">${item.seriesName}:</span>`;
449
+ const value = `<span style="font-size: 12px;">${item.value}</span>`;
450
+ return result + icon + name + value + "<br/>";
451
+ }, "");
452
+ return title + "<br/>" + content;
453
+ },
454
+ backgroundColor: "rgb(0,0,0,0.5)",
455
+ },
456
+ grid: {
457
+ left: "60px",
458
+ top: "0px",
459
+ right: "60px",
460
+ bottom: "30px",
461
+ },
462
+ xAxis: {
463
+ type: "category",
464
+ boundaryGap: false,
465
+ data: xAxisData,
466
+ axisLabel: {
467
+ interval: (index, value) => {
468
+ if (value.split("-")[1] === "01") {
469
+ return true;
470
+ } else {
471
+ return false;
472
+ }
473
+ },
474
+ },
475
+ },
476
+ yAxis: {
477
+ type: "value",
478
+ splitLine: {
479
+ show: true,
480
+ lineStyle: {
481
+ type: "dotted",
482
+ color: "#333",
483
+ },
484
+ },
485
+ axisLine: {
486
+ show: true,
487
+ },
488
+ axisLabel: {
489
+ formatter: (value) => value,
490
+ showMaxLabel: false,
491
+ },
492
+ },
493
+ series,
494
+ };
495
+ };
496
+
497
+ onMounted(async () => {
498
+ chart = echarts.init(chartRef.value);
499
+ handleOption();
500
+ chart.setOption(chartOption.value, true);
501
+ chartObserver = new ResizeObserver(() => {
502
+ chart.resize();
503
+ });
504
+ chartObserver.observe(chartRef.value);
505
+ });
506
+
507
+ watch(
508
+ () => props.data,
509
+ async () => {
510
+ handleOption();
511
+ chart.setOption(chartOption.value, true);
512
+ }
513
+ );
514
+
515
+ onUnmounted(() => {
516
+ chart.dispose();
517
+ chartObserver.disconnect();
518
+ chartObserver = null;
519
+ });
520
+ </script>
521
+
522
+ <template>
523
+ <div id="yearChart" ref="chartRef"></div>
524
+ </template>
525
+
526
+ <style lang="scss" scoped>
527
+ #yearChart {
528
+ height: 100px;
529
+ width: 100%;
530
+ overflow-x: hidden;
531
+ }
532
+ </style>