Skip to content

Commit

Permalink
fix(overview): when the statistics array is too long, the last two hu…
Browse files Browse the repository at this point in the history
…ndred are taken
  • Loading branch information
Kinplemelon authored and kerry-emqx committed Dec 15, 2021
1 parent 5578809 commit 9830034
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/views/Dashboard/components/PolylineCards.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,14 @@ const _formatTime = (time: number) => {
const loadMetricsLogData = () => {
let maxLen = 200;
dataTypeList.forEach(async (typeName) => {
const data = await loadMetricsLog(typeName).catch(() => {});
let data = await loadMetricsLog(typeName).catch(() => {});
metricLog[typeName] = chartDataFill(1);
const currentData = metricLog[typeName][0];
if (data) {
if (data.length > maxLen) {
data = data.slice(-maxLen);
}
data.forEach((item, key) => {
if (key > maxLen) return;
currentData.xData.push(_formatTime(item.timestamp));
Expand Down

0 comments on commit 9830034

Please sign in to comment.