Skip to content

Commit

Permalink
update y-axis array data check
Browse files Browse the repository at this point in the history
the y-axis array data is updated after to ensure
that all arrays have the same length

Signed-off-by: ianmuchyri <[email protected]>
  • Loading branch information
ianmuchyri committed Mar 18, 2024
1 parent 748fc80 commit 17e3df8
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions ui/web/static/js/charts.js
Original file line number Diff line number Diff line change
Expand Up @@ -921,15 +921,30 @@ class TimeSeriesLineChart extends Echart {
}
}
xAxisArray.push(xAxis);
// Remove the previous element in the array
xAxisArray.shift();
yAxisArray.push(yAxis);
} else {
// Handle errors
console.error("HTTP request failed with status:", response.status);
}
}
for (i =1; i< xAxisArray.length; i++) {
const missingData = findMissingValuesIndices(xAxisArray[i], xAxisArray[xAxisArray.length-1]);
missingData.forEach((value, index) => {
yAxisArray[i-1].splice(value,0,"-");
});
}
function findMissingValuesIndices(array1, array2) {
const missingIndices = [];
array2.forEach((item, index) => {
if (!array1.includes(item)) {
missingIndices.push(index);
}
});
return missingIndices;
}
const xAxisData=[];
xAxisArray[xAxisArray.length-1].forEach((element) => {
const date = new Date(element);
Expand Down

0 comments on commit 17e3df8

Please sign in to comment.