File tree Expand file tree Collapse file tree 4 files changed +18
-56
lines changed
Expand file tree Collapse file tree 4 files changed +18
-56
lines changed Original file line number Diff line number Diff line change 3131 </el-row >
3232 </div >
3333</template >
34- <style >
35- .LeftMain {
36- width : 100% ;
37- height : auto ;
38- }
39-
40- .el-row {
41- margin-bottom : 0px ;
42- }
43- </style >
4434
4535<script lang="ts">
46-
4736export default {
4837 name: ' App' ,
4938 components: {
@@ -53,23 +42,14 @@ export default {
5342 OSChart ,
5443 }
5544}
56-
5745 </script >
58-
5946<script setup lang="ts">
6047import { ref } from ' vue'
6148import { onMounted } from ' vue'
6249import WaveGen from ' ./components/WaveGen.vue'
6350import WaveGenChart from ' ./components/WaveGenChart.vue'
6451import OSChart from ' ./components/OSChart.vue'
6552import socket from ' ./script/websocket'
66- // import {
67- // ElNotification,
68- // ElRow,
69- // ElCol,
70- // ElSwitch,
71- // ElFormItem
72- // } from 'element-plus'
7353
7454// 自动切换暗黑模式
7555import { useDark , useToggle } from ' @vueuse/core'
@@ -96,7 +76,7 @@ function receiveMessage(message: any) {
9676 if (message .data [0 ] == ' {' && message .data [2 ] == ' a' ) {
9777 var data = JSON .parse (message .data );
9878 OSChart .refreshData (data );
99- } else if (message .data [0 ] == ' {' && message .data [2 ] == ' p' ){
79+ } else if (message .data [0 ] == ' {' && message .data [2 ] == ' p' ) {
10080 var data = JSON .parse (message .data );
10181 console .log (data .param );
10282 WaveGen .changeParam (data .param );
@@ -111,5 +91,15 @@ onMounted(() => {
11191 UseDarkMode ();
11292 switchVal .value = isDark .value ;
11393});
114-
11594 </script >
95+
96+ <style >
97+ .LeftMain {
98+ width : 100% ;
99+ height : auto ;
100+ }
101+
102+ .el-row {
103+ margin-bottom : 0px ;
104+ }
105+ </style >
Original file line number Diff line number Diff line change @@ -41,7 +41,6 @@ function OSCStop() {
4141 isRun = false ;
4242 sendData (" CF" );
4343};
44-
4544function generateData() {
4645 let data = [];
4746 if (OSCData .length < 10 ) {
@@ -56,7 +55,6 @@ function generateData() {
5655 }
5756 return data ;
5857}
59-
6058option = {
6159 backgroundColor: ' ' ,
6260 animation: false ,
@@ -154,7 +152,6 @@ function darkMode(isDark: boolean) {
154152 ]
155153 });
156154}
157-
158155const sendData = (data : string ) => {
159156 if (socket .socket_open ) {
160157 socket .send (data );
@@ -195,10 +192,7 @@ export default {
195192 option: Object
196193 }
197194}
198-
199195 </script >
200-
201-
202196<script lang="ts" setup>
203197import * as echarts from ' echarts/core' ;
204198import {
@@ -218,7 +212,6 @@ import { onMounted } from 'vue';
218212import { EChartsType } from ' echarts/core' ;
219213import socket from ' ../script/websocket'
220214
221-
222215import {
223216 // ElFormItem,
224217 // ElInputNumber,
@@ -236,7 +229,6 @@ echarts.use([
236229 UniversalTransition
237230]);
238231
239-
240232// 2.定义传入的参数
241233const props = defineProps ({
242234 width: {
@@ -259,8 +251,6 @@ const props = defineProps({
259251 },
260252});
261253
262-
263-
264254onMounted (() => {
265255 chartDom = document .getElementById (props .container ) as HTMLElement
266256 myChart = echarts .init (chartDom );
@@ -269,7 +259,6 @@ onMounted(() => {
269259
270260 </script >
271261
272-
273262<style >
274263.OSChart {
275264 margin : 0 auto ;
Original file line number Diff line number Diff line change 3939import { ref } from " vue" ;
4040const formSize = ref (' large' )
4141const labelPosition = ref (' right' )
42-
4342const waveType = ref (" 1" )
4443const freq = ref (100 )
4544const duty = ref (50 )
@@ -97,15 +96,16 @@ const freqChange = (value: number) => {
9796const dutyChange = (value : number ) => {
9897 console .log (value );
9998 form .duty = value ;
100- sendData (" D" + value );
99+ sendData (" D" + value );
101100}
102101const uMaxValueChange = (value : number ) => {
103102 console .log (value );
104- sendData (" U" + value );
103+ form .uMaxValue = value ;
104+ sendData (" U" + value );
105105}
106106const biasChange = (value : number ) => {
107107 console .log (value );
108- sendData (" B" + value );
108+ sendData (" B" + value );
109109}
110110export default {
111111 name: " WaveGen" ,
@@ -121,18 +121,7 @@ export default {
121121}
122122 </script >
123123<script setup lang="ts">
124- import {
125- // ElForm,
126- // ElFormItem,
127- // ElButton,
128- // ElOption,
129- // ElInputNumber,
130- ElMessage ,
131- // ElSelect,
132- // ElSlider,
133- // ElSwitch,
134- } from ' element-plus'
135-
124+ import { ElMessage } from ' element-plus'
136125import { reactive } from ' vue'
137126import WaveGenChart from ' ./WaveGenChart.vue'
138127import socket from ' ../script/websocket'
@@ -141,8 +130,6 @@ defineProps<{ msg: string }>();
141130
142131 </script >
143132
144-
145-
146133<style >
147134.waveGen {
148135 width : 55% ;
Original file line number Diff line number Diff line change @@ -26,16 +26,14 @@ type EChartsOption = echarts.ComposeOption<
2626var option: EChartsOption ;
2727var myChart: EChartsType ;
2828var chartDom: HTMLElement ;
29-
30-
3129// 绘制预览波形相关变量及函数
3230var start = true ;
3331let uMaxValue = 3.3 ; // 峰峰值
3432let offSetValue = 1.65 // 偏置电压
3533let duty = 50 ; // 占空比%(方波)
3634let wave = 1 ; // 波形种类
3735let samplePerCycle = 256 ;
38- // 定义板载8位DAC输出的对应值
36+ // 定义波形预览数组
3937var waveTab1 = new Array ();
4038var waveTab = new Array ();
4139
@@ -205,7 +203,6 @@ option = {
205203export default {
206204 name: " WaveGenChart" ,
207205 option ,
208- // myChart,
209206 uMaxValue ,
210207 offSetValue ,
211208 duty ,
@@ -260,7 +257,6 @@ onMounted(() => {
260257 wave_gen (1 );
261258 chartDom = document .getElementById (props .container ) as HTMLElement
262259 myChart = echarts .init (chartDom );
263- // option.series[0].data = generateData(); // 搞不明白为啥报错,但能用
264260 option && myChart .setOption (option );
265261});
266262 </script >
You can’t perform that action at this time.
0 commit comments