Skip to content

Commit

Permalink
修复zoom比例丢失问题
Browse files Browse the repository at this point in the history
  • Loading branch information
aoliaoaoaojiao committed Oct 13, 2024
1 parent 7771b91 commit a4274ec
Showing 1 changed file with 69 additions and 21 deletions.
90 changes: 69 additions & 21 deletions src/components/AndroidPerfChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ function getTimeStr(timestamp) {
return `${hour}:${minute}:${second}`;
}
let signZoomStart = 30;
let signZoomEnd = 100;
const printSingleCpu = () => {
let chart = echarts.getInstanceByDom(
document.getElementById(
Expand Down Expand Up @@ -115,14 +117,18 @@ const printSingleCpu = () => {
{
show: true,
realtime: true,
start: 30,
end: 100,
start: signZoomStart,
end: signZoomEnd,
xAxisIndex: [0, 1],
},
],
yAxis: [{name: `${$t('perf.singleCpu')}(%)`, min: 0}],
series: sysCpuData.SingleCpuData,
};
chart.on('dataZoom', (event) => {
signZoomEnd = event.end
signZoomStart = event.start
})
chart.setOption(option);
};
Expand All @@ -132,6 +138,8 @@ let sysCpuData = {
CpuDataLegend: [],
SingleCpuData: [],
SingleCpuDataLegend: [],
zoomStart:30,
zoomEnd:100,
}
const pushSysCpuData = (obj) => {
Expand Down Expand Up @@ -225,14 +233,18 @@ const printCpu = () => {
{
show: true,
realtime: true,
start: 30,
end: 100,
start: sysCpuData.zoomStart,
end: sysCpuData.zoomEnd,
xAxisIndex: [0, 1],
},
],
yAxis: [{name: `${$t('perf.totalCpu')}(%)`, min: 0}],
series: sysCpuData.seriesData,
};
chart.on('dataZoom', (event) => {
sysCpuData.zoomEnd = event.end
sysCpuData.zoomStart = event.start
})
chart.setOption(option);
};
Expand All @@ -244,6 +256,8 @@ let sysMemData = {
memTotal: [],
swapFree: [],
swapTotal: [],
zoomStart:30,
zoomEnd:100,
}
const pushSysMemData = (obj) => {
Expand Down Expand Up @@ -314,8 +328,8 @@ const printMem = () => {
{
show: true,
realtime: true,
start: 30,
end: 100,
start: sysMemData.zoomStart,
end: sysMemData.zoomEnd,
xAxisIndex: [0, 1],
},
],
Expand Down Expand Up @@ -365,12 +379,18 @@ const printMem = () => {
},
],
};
chart.on('dataZoom', (event) => {
sysMemData.zoomEnd = event.end
sysMemData.zoomStart = event.start
})
chart.setOption(option);
};
let procFPSData = {
xAxisData: [],
seriesData: []
seriesData: [],
zoomStart:30,
zoomEnd:100,
}
const pushProcFPSData = (obj) => {
procFPSData.xAxisData.push(getTimeStr(obj.timeStamp))
Expand Down Expand Up @@ -416,8 +436,8 @@ const printProcFps = () => {
{
show: true,
realtime: true,
start: 30,
end: 100,
start: procFPSData.zoomStart,
end: procFPSData.zoomEnd,
xAxisIndex: [0, 1],
},
],
Expand All @@ -430,12 +450,18 @@ const printProcFps = () => {
},
],
};
chart.on('dataZoom', (event) => {
procFPSData.zoomEnd = event.end
procFPSData.zoomStart = event.start
})
chart.setOption(option);
};
let procThreadData = {
xAxisData: [],
seriesData: []
seriesData: [],
zoomStart:30,
zoomEnd:100,
}
const pushProcThreadData = (obj) => {
console.log(obj)
Expand Down Expand Up @@ -484,8 +510,8 @@ const printProcThread = () => {
{
show: true,
realtime: true,
start: 30,
end: 100,
start: procThreadData.zoomStart,
end: procThreadData.zoomEnd,
xAxisIndex: [0, 1],
},
],
Expand All @@ -498,13 +524,19 @@ const printProcThread = () => {
},
],
};
chart.on('dataZoom', (event) => {
procThreadData.zoomEnd = event.end
procThreadData.zoomStart = event.start
})
chart.setOption(option);
};
let sysNetworkData = {
xAxisData: [],
seriesData: [],
legendData:[]
legendData:[],
zoomStart:30,
zoomEnd:100,
}
const pushSysNetworkData = (obj) => {
Expand Down Expand Up @@ -592,20 +624,26 @@ const printNetwork = () => {
{
show: true,
realtime: true,
start: 30,
end: 100,
start: sysNetworkData.zoomStart,
end: sysNetworkData.zoomEnd,
xAxisIndex: [0, 1],
},
],
yAxis: [{name: `${$t('perf.network')}(b)`, min: 0}],
series: sysNetworkData.seriesData,
};
chart.on('dataZoom', (event) => {
sysNetworkData.zoomEnd = event.end
sysNetworkData.zoomStart = event.start
})
chart.setOption(option);
};
let procCpuData = {
xAxisData: [],
seriesData: []
seriesData: [],
zoomStart:30,
zoomEnd:100,
}
const pushProcCpuData = (obj) => {
procCpuData.xAxisData.push(getTimeStr(obj.timeStamp))
Expand Down Expand Up @@ -653,8 +691,8 @@ const printPerfCpu = () => {
{
show: true,
realtime: true,
start: 30,
end: 100,
start: procCpuData.zoomStart,
end: procCpuData.zoomEnd,
xAxisIndex: [0, 1],
},
],
Expand All @@ -669,14 +707,20 @@ const printPerfCpu = () => {
},
],
};
chart.on('dataZoom', (event) => {
procCpuData.zoomEnd = event.end
procCpuData.zoomStart = event.start
})
chart.setOption(option);
};
let procMemData = {
xAxisData: [],
pssData: [],
phyData: [],
vmData: []
vmData: [],
zoomStart:30,
zoomEnd:100
}
const pushProcMemData = (obj) => {
procMemData.xAxisData.push(getTimeStr(obj.timeStamp))
Expand Down Expand Up @@ -726,8 +770,8 @@ const printPerfMem = () => {
{
show: true,
realtime: true,
start: 30,
end: 100,
start: procMemData.zoomStart,
end: procMemData.zoomEnd,
xAxisIndex: [0, 1],
},
],
Expand Down Expand Up @@ -760,6 +804,10 @@ const printPerfMem = () => {
},
],
};
chart.on('dataZoom', (event) => {
procMemData.zoomEnd = event.end
procMemData.zoomStart = event.start
})
chart.setOption(option);
};
Expand Down

0 comments on commit a4274ec

Please sign in to comment.