st-comp 0.0.21 → 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/components.d.ts +13 -0
- package/lib/bundle.js +29468 -22496
- package/lib/bundle.umd.cjs +79 -50
- package/lib/style.css +1 -1
- package/package.json +1 -1
- package/packages/HeatMap/index.vue +133 -4
- package/packages/Kline/index.vue +611 -414
- package/packages/Kline/option.ts +4 -2
- package/packages/Kline/type.d.ts +1 -0
- package/packages/Kline/utils.ts +4 -4
- package/packages/LinearLegend/index.ts +8 -0
- package/packages/LinearLegend/index.vue +269 -0
- package/packages/Map/index.vue +59 -22
- package/packages/Pie/index.vue +61 -23
- package/packages/TreeMap/index.ts +8 -0
- package/packages/TreeMap/index.vue +182 -0
- package/packages/VarSeach/components/ModalQuery/index.ts +730 -0
- package/packages/VarSeach/components/ModalQuery/index.vue +449 -0
- package/packages/VarSeach/components/ModalScreenv/index.vue +306 -0
- package/packages/VarSeach/index.ts +8 -0
- package/packages/VarSeach/index.vue +121 -0
- package/packages/index.ts +6 -0
- package/src/pages/HeatMap/index.vue +120 -278
- package/src/pages/Kline/components/MultiCycleSingleVariety.vue +553 -563
- package/src/pages/Kline/components/SingleCycleSingleVariety.vue +567 -530
- package/src/pages/LinearLegend/index.vue +92 -0
- package/src/pages/Map/index.vue +62 -50
- package/src/pages/Pie/index.vue +32 -19
- package/src/pages/TreeMap/index.vue +542 -0
- package/src/pages/VarSeach/index.vue +571 -0
- package/src/router/routes.ts +15 -0
package/package.json
CHANGED
|
@@ -1,9 +1,138 @@
|
|
|
1
|
-
<script setup lang="ts"></script>
|
|
2
|
-
|
|
3
1
|
<template>
|
|
4
|
-
|
|
2
|
+
<div
|
|
3
|
+
ref="chartRef"
|
|
4
|
+
class="chart"
|
|
5
|
+
></div>
|
|
5
6
|
</template>
|
|
6
7
|
|
|
7
|
-
<
|
|
8
|
+
<script setup lang="ts">
|
|
9
|
+
import { ref, onMounted, onUnmounted, computed, watch } from "vue"
|
|
10
|
+
import * as echarts from 'echarts'
|
|
11
|
+
import type { EChartsType } from 'echarts'
|
|
12
|
+
|
|
13
|
+
const defaultConfig = {
|
|
14
|
+
tooltipFormatter: null,
|
|
15
|
+
dataZoom: null,
|
|
16
|
+
grid: {
|
|
17
|
+
left: '60px',
|
|
18
|
+
bottom: '20px',
|
|
19
|
+
right: '0',
|
|
20
|
+
top: 0
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
let chart: EChartsType
|
|
24
|
+
let resizeRo: any
|
|
25
|
+
|
|
26
|
+
const props = defineProps({
|
|
27
|
+
data: {
|
|
28
|
+
type: Object,
|
|
29
|
+
default: () => ({}),
|
|
30
|
+
}, // 数据
|
|
31
|
+
config: {
|
|
32
|
+
type: Object,
|
|
33
|
+
default: () => ({})
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
const chartRef = ref<HTMLElement>()
|
|
38
|
+
|
|
39
|
+
const mergeConfig = computed(() => ({ ...defaultConfig, ...props.config }))
|
|
8
40
|
|
|
41
|
+
watch(
|
|
42
|
+
() => [props.data],
|
|
43
|
+
() => {
|
|
44
|
+
draw()
|
|
45
|
+
},
|
|
46
|
+
{ deep: true }
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
onMounted(() => {
|
|
50
|
+
chart = echarts.init(chartRef.value)
|
|
51
|
+
draw()
|
|
52
|
+
// 绑定resize事件
|
|
53
|
+
let isFirst: boolean | null = true
|
|
54
|
+
resizeRo = new ResizeObserver(() => {
|
|
55
|
+
if (isFirst) {
|
|
56
|
+
isFirst = null
|
|
57
|
+
return
|
|
58
|
+
}
|
|
59
|
+
chart.resize()
|
|
60
|
+
})
|
|
61
|
+
resizeRo.observe(chartRef.value)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
onUnmounted(() => {
|
|
65
|
+
chart.dispose()
|
|
66
|
+
resizeRo.disconnect()
|
|
67
|
+
resizeRo = null
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
const draw = () => {
|
|
71
|
+
chart.setOption(
|
|
72
|
+
{
|
|
73
|
+
tooltip: {
|
|
74
|
+
confine: true,
|
|
75
|
+
formatter: mergeConfig.value.tooltipFormatter
|
|
76
|
+
},
|
|
77
|
+
grid: mergeConfig.value.grid,
|
|
78
|
+
xAxis: {
|
|
79
|
+
type: "category",
|
|
80
|
+
data: props.data.date,
|
|
81
|
+
},
|
|
82
|
+
yAxis: {
|
|
83
|
+
type: "category",
|
|
84
|
+
inverse: true,
|
|
85
|
+
data: props.data.data.map((i: any) => i.name),
|
|
86
|
+
},
|
|
87
|
+
visualMap: {
|
|
88
|
+
type: 'piecewise', // 类型: 分段式[piecewise] | 连续形[continuous]
|
|
89
|
+
show: false,
|
|
90
|
+
inRange: [],
|
|
91
|
+
},
|
|
92
|
+
dataZoom: mergeConfig.value.dataZoom,
|
|
93
|
+
series: [
|
|
94
|
+
{
|
|
95
|
+
name: "热力图",
|
|
96
|
+
type: "heatmap",
|
|
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
|
+
}, []),
|
|
116
|
+
label: {
|
|
117
|
+
show: false, // 是否展示方块格上的数字
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
],
|
|
121
|
+
}
|
|
122
|
+
)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
defineExpose({
|
|
126
|
+
reset: () => {
|
|
127
|
+
draw()
|
|
128
|
+
}, // 重置
|
|
129
|
+
})
|
|
130
|
+
</script>
|
|
131
|
+
|
|
132
|
+
<style lang="scss" scoped>
|
|
133
|
+
.chart {
|
|
134
|
+
width: 100%;
|
|
135
|
+
height: 100%;
|
|
136
|
+
overflow: hidden;
|
|
137
|
+
}
|
|
9
138
|
</style>
|