实现指南针的数据更新
parent
e8bbe58d7c
commit
bad94bd96e
|
@ -132,9 +132,9 @@ const option = reactive({
|
||||||
const update = (dateTime: Date) => {
|
const update = (dateTime: Date) => {
|
||||||
if (!dateTime) return
|
if (!dateTime) return
|
||||||
|
|
||||||
const seconds = dateTime.getSeconds()
|
const seconds = dateTime.getSeconds()
|
||||||
const minutes = dateTime.getMinutes()
|
const minutes = dateTime.getMinutes()
|
||||||
const hours = dateTime.getHours()
|
const hours = dateTime.getHours()
|
||||||
|
|
||||||
const second_data = seconds
|
const second_data = seconds
|
||||||
const minute_data = second_data / 60 + minutes
|
const minute_data = second_data / 60 + minutes
|
||||||
|
|
|
@ -9,7 +9,7 @@ import { TitleComponent } from "echarts/components";
|
||||||
import { GaugeChart } from "echarts/charts";
|
import { GaugeChart } from "echarts/charts";
|
||||||
|
|
||||||
import VChart from "vue-echarts";
|
import VChart from "vue-echarts";
|
||||||
import { ref } from "vue";
|
import { reactive } from "vue";
|
||||||
|
|
||||||
use([
|
use([
|
||||||
CanvasRenderer,
|
CanvasRenderer,
|
||||||
|
@ -17,7 +17,7 @@ use([
|
||||||
GaugeChart
|
GaugeChart
|
||||||
]);
|
]);
|
||||||
|
|
||||||
const option = ref({
|
const option = reactive({
|
||||||
title: {
|
title: {
|
||||||
text: '航向',
|
text: '航向',
|
||||||
left: 'center'
|
left: 'center'
|
||||||
|
@ -71,12 +71,28 @@ const option = ref({
|
||||||
detail: {
|
detail: {
|
||||||
show:false
|
show:false
|
||||||
},
|
},
|
||||||
data: [{ value: 330 }]
|
data: [{ value: 0 }]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
const update = console.log
|
const update = (variation: number, variationPole: string) => {
|
||||||
|
switch (variationPole) {
|
||||||
|
case 'N':
|
||||||
|
break;
|
||||||
|
case 'E':
|
||||||
|
variation += 90
|
||||||
|
break;
|
||||||
|
case 'S':
|
||||||
|
variation += 180
|
||||||
|
break;
|
||||||
|
case 'W':
|
||||||
|
variation += 270
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
option.series[0].data[0].value = variation
|
||||||
|
}
|
||||||
|
|
||||||
defineExpose({ update })
|
defineExpose({ update })
|
||||||
</script>
|
</script>
|
|
@ -50,7 +50,7 @@ const update = (nmeaStr: string) => {
|
||||||
const { dateTime, longitude, latitude, alt, variation, variationPole, numSat } = data
|
const { dateTime, longitude, latitude, alt, variation, variationPole, numSat } = data
|
||||||
digitalFlopContainer.value.update(dateTime, longitude, latitude, alt, numSat)
|
digitalFlopContainer.value.update(dateTime, longitude, latitude, alt, numSat)
|
||||||
clock.value.update(dateTime)
|
clock.value.update(dateTime)
|
||||||
// compass.value.update(variation, variationPole)
|
compass.value.update(variation, variationPole)
|
||||||
// waterLevel.value.update(alt)
|
// waterLevel.value.update(alt)
|
||||||
// map.value.update(lon, lonPole, lat, latPole)
|
// map.value.update(lon, lonPole, lat, latPole)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue