修复软件长时间运行后3D饼图消失的bug

master
qubiaobiao 2024-04-25 14:02:13 +08:00
parent 00d45b0ee3
commit 78c39e3780
6 changed files with 20 additions and 5 deletions

View File

@ -95,6 +95,7 @@ function createWindow(page: string, display: any) {
win.webContents.openDevTools() win.webContents.openDevTools()
} else { } else {
win.loadFile(`dist/render/${page}.html`) win.loadFile(`dist/render/${page}.html`)
// win.webContents.openDevTools()
} }
windows.push(win); windows.push(win);

View File

@ -43,7 +43,7 @@ export function getNMEAObj(nmeaStr) {
export function getGSV (nmeaStr) { export function getGSV (nmeaStr) {
const nmeaObj = getNMEAObj(nmeaStr) const nmeaObj = getNMEAObj(nmeaStr)
console.log(nmeaObj, '================') // console.log(nmeaObj, '================')
if (!nmeaObj || !nmeaObj.GSV) return null if (!nmeaObj || !nmeaObj.GSV) return null
const { GSV } = nmeaObj const { GSV } = nmeaObj

View File

@ -1,5 +1,5 @@
<template> <template>
<v-chart ref="ring" :option="option" /> <v-chart v-if="refresh" ref="ring" :option="option" />
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
@ -17,6 +17,8 @@ use([CanvasRenderer, LegendComponent, PieChart]);
const emit = defineEmits(['changeColor']); const emit = defineEmits(['changeColor']);
const ring = ref(null); const ring = ref(null);
const nowtime = ref(new Date().getTime());
const refresh = ref(true);
// series-surface.parametricEquation // series-surface.parametricEquation
const getParametricEquation = ( const getParametricEquation = (
@ -28,6 +30,11 @@ const getParametricEquation = (
height, height,
size size
) => { ) => {
if(new Date().getTime() > nowtime.value){
refresh.value = false;
// console.log(new Date()+' getParametricEquation Log: '+startRatio+', '+endRatio+', '+isSelected+', '+isHovered+', '+k+', '+height+', '+size);
nowtime.value = new Date().getTime() + 600000;
}
// //
let midRatio = (startRatio + endRatio) / 2; let midRatio = (startRatio + endRatio) / 2;
@ -282,6 +289,9 @@ const option = reactive({
}); });
const getPie3D = (sumValue, pieValue, internalDiameterRatio, height, size) => { const getPie3D = (sumValue, pieValue, internalDiameterRatio, height, size) => {
// if(new Date().getTime() > nowtime.value){
// console.log(new Date()+' getPie3D Log: '+sumValue+', '+pieValue+', '+internalDiameterRatio+', '+height+', '+size);
// }
let startValue = 0; let startValue = 0;
let endValue = 0; let endValue = 0;
// internalDiameterRatio0~1/ 1/2 // internalDiameterRatio0~1/ 1/2
@ -345,6 +355,10 @@ onMounted(() => {
}); });
const update = (bd_val: number, gp_val: number, gl_val: number, ga_val: number) => { const update = (bd_val: number, gp_val: number, gl_val: number, ga_val: number) => {
if(!refresh.value){
// console.log('refresh');
refresh.value = true;
}
option.series[0].pieData.value = bd_val; option.series[0].pieData.value = bd_val;
option.series[1].pieData.value = gp_val; option.series[1].pieData.value = gp_val;
option.series[2].pieData.value = gl_val; option.series[2].pieData.value = gl_val;

View File

@ -74,7 +74,7 @@ const getDate = (date, timestamp) => {
const getMonitoringData = (nmeaStr: string) => { const getMonitoringData = (nmeaStr: string) => {
const nmeaObj: any = getNMEAObj(nmeaStr); const nmeaObj: any = getNMEAObj(nmeaStr);
console.log(nmeaObj, "================"); // console.log(nmeaObj, "================");
if (!nmeaObj || !nmeaObj.RMC || !nmeaObj.GGA) return null; if (!nmeaObj || !nmeaObj.RMC || !nmeaObj.GGA) return null;
const { RMC, GGA } = nmeaObj; const { RMC, GGA } = nmeaObj;

View File

@ -76,7 +76,7 @@ const getSatelliteCount = (GSVArr: Array<any>) => {
const getMonitoringData = (nmeaStr: string) => { const getMonitoringData = (nmeaStr: string) => {
const nmeaObj: any = getNMEAObj(nmeaStr) const nmeaObj: any = getNMEAObj(nmeaStr)
console.log(nmeaObj, '================') // console.log(nmeaObj, '================')
if (!nmeaObj || !nmeaObj.GSV || !nmeaObj.GSA) return null if (!nmeaObj || !nmeaObj.GSV || !nmeaObj.GSA) return null
const { GSV, GSA } = nmeaObj const { GSV, GSA } = nmeaObj

View File

@ -54,7 +54,7 @@ onMounted(() => {
const getMonitoringData = (nmeaStr: string) => { const getMonitoringData = (nmeaStr: string) => {
const nmeaObj: any = getNMEAObj(nmeaStr) const nmeaObj: any = getNMEAObj(nmeaStr)
console.log(nmeaObj, '================') // console.log(nmeaObj, '================')
if (!nmeaObj || !nmeaObj.GSV || !nmeaObj.GSA) return null if (!nmeaObj || !nmeaObj.GSV || !nmeaObj.GSA) return null
const { GSV, GSA } = nmeaObj const { GSV, GSA } = nmeaObj