Skip to content

Commit 291af4e

Browse files
committed
改下波形发生器图表的option
1 parent ac9dd20 commit 291af4e

File tree

1 file changed

+87
-85
lines changed

1 file changed

+87
-85
lines changed

src/components/WaveGenChart.vue

Lines changed: 87 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -26,90 +26,7 @@ type EChartsOption = echarts.ComposeOption<
2626
var option: EChartsOption;
2727
var myChart: EChartsType;
2828
var chartDom: HTMLElement;
29-
option = {
30-
backgroundColor: '',
31-
animation: false,
32-
grid: {
33-
top: 40,
34-
left: 50,
35-
right: 40,
36-
bottom: 50
37-
},
38-
tooltip: {
39-
show: true,
40-
trigger: 'axis',
41-
axisPointer: {
42-
type: 'cross'
43-
}
44-
},
45-
toolbox: {
46-
show: true,
47-
feature: {
48-
dataZoom: {
49-
yAxisIndex: 'none'
50-
},
51-
dataView: {
52-
readOnly: false
53-
},
54-
magicType: {
55-
type: ['line', 'line']
56-
},
57-
restore: {},
58-
saveAsImage: {}
59-
}
60-
},
61-
xAxis: {
62-
name: '波形索引',
63-
min: 0,
64-
max: 256,
65-
minorTick: {
66-
show: true
67-
},
68-
minorSplitLine: {
69-
show: true
70-
}
71-
},
72-
yAxis: {
73-
name: '输出电压/V',
74-
min: -0.2,
75-
max: 3.5,
76-
minorTick: {
77-
show: true
78-
},
79-
minorSplitLine: {
80-
show: true
81-
}
82-
},
83-
dataZoom: [
84-
{
85-
show: true,
86-
type: 'inside',
87-
filterMode: 'none',
88-
xAxisIndex: [0],
89-
startValue: 0,
90-
endValue: 300,
91-
moveOnMouseWheel: 'alt'
92-
},
93-
{
94-
show: true,
95-
type: 'inside',
96-
// disabled: true,
97-
// zoomLock: true,
98-
filterMode: 'none',
99-
yAxisIndex: [0],
100-
startValue: -1,
101-
endValue: 5
102-
}
103-
],
104-
series: [
105-
{
106-
type: 'line',
107-
showSymbol: false,
108-
clip: true,
109-
data: []
110-
}
111-
]
112-
};
29+
11330
11431
// 绘制预览波形相关变量及函数
11532
var start = true;
@@ -200,6 +117,91 @@ function darkMode(isDark: boolean) {
200117
refreshData();
201118
}
202119
120+
option = {
121+
backgroundColor: '',
122+
animation: false,
123+
grid: {
124+
top: 40,
125+
left: 50,
126+
right: 40,
127+
bottom: 50
128+
},
129+
tooltip: {
130+
show: true,
131+
trigger: 'axis',
132+
axisPointer: {
133+
type: 'cross'
134+
}
135+
},
136+
toolbox: {
137+
show: true,
138+
feature: {
139+
dataZoom: {
140+
yAxisIndex: 'none'
141+
},
142+
dataView: {
143+
readOnly: false
144+
},
145+
magicType: {
146+
type: ['line', 'line']
147+
},
148+
restore: {},
149+
saveAsImage: {}
150+
}
151+
},
152+
xAxis: {
153+
name: '波形索引',
154+
min: 0,
155+
max: 256,
156+
minorTick: {
157+
show: true
158+
},
159+
minorSplitLine: {
160+
show: true
161+
}
162+
},
163+
yAxis: {
164+
name: '输出电压/V',
165+
min: -0.2,
166+
max: 3.5,
167+
minorTick: {
168+
show: true
169+
},
170+
minorSplitLine: {
171+
show: true
172+
}
173+
},
174+
dataZoom: [
175+
{
176+
show: true,
177+
type: 'inside',
178+
filterMode: 'none',
179+
xAxisIndex: [0],
180+
startValue: 0,
181+
endValue: 300,
182+
moveOnMouseWheel: 'alt'
183+
},
184+
{
185+
show: true,
186+
type: 'inside',
187+
// disabled: true,
188+
// zoomLock: true,
189+
filterMode: 'none',
190+
yAxisIndex: [0],
191+
startValue: -1,
192+
endValue: 5
193+
}
194+
],
195+
series: [
196+
{
197+
type: 'line',
198+
showSymbol: false,
199+
clip: true,
200+
data: generateData()
201+
}
202+
]
203+
};
204+
203205
export default {
204206
name: "WaveGenChart",
205207
option,
@@ -258,7 +260,7 @@ onMounted(() => {
258260
wave_gen(1);
259261
chartDom = document.getElementById(props.container) as HTMLElement
260262
myChart = echarts.init(chartDom);
261-
option.series[0].data = generateData(); // 搞不明白为啥报错,但能用
263+
//option.series[0].data = generateData(); // 搞不明白为啥报错,但能用
262264
option && myChart.setOption(option);
263265
});
264266
</script>

0 commit comments

Comments
 (0)