From 5a4301e3aa8dd46cb1a9b913ff13f907a6507d7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com> Date: Sun, 8 Oct 2023 14:53:44 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=9E=E4=BD=93=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E6=9B=B2=E7=BA=BF=E5=9B=BE=E5=8E=BB=E6=8E=89=E5=B0=BE=E9=83=A8?= =?UTF-8?q?=E6=9C=80=E5=A4=9A4=E4=B8=AA0=E5=80=BC=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../charts/entityDetail/EntityDetailLine.vue | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/views/charts2/charts/entityDetail/EntityDetailLine.vue b/src/views/charts2/charts/entityDetail/EntityDetailLine.vue index 6c5578f1..c4238184 100644 --- a/src/views/charts2/charts/entityDetail/EntityDetailLine.vue +++ b/src/views/charts2/charts/entityDetail/EntityDetailLine.vue @@ -497,7 +497,7 @@ export default { }) } - if (data !== undefined && data.length > 0) { + if (data && data.length > 0) { newData.forEach((item) => { item.type = getLineType(item.type) if (item.type === val) { @@ -510,6 +510,24 @@ export default { }) } lineData.splice(0, 1) + // TODO 下面的逻辑是判断total曲线的尾部数据,从尾往前数0值的个数,若个数大于0,所有曲线都从尾部去掉相同数量的点,最多4个 + const totalData = lineData[0] + if (_.get(totalData, 'values', []).length > 4) { + let count = 0 + for (let i = totalData.values.length - 1; i >= totalData.values.length - 4; i--) { + if (totalData.values[i].length > 1 && totalData.values[i][1] === 0) { + count++ + } else { + break + } + } + if (count > 0) { + lineData.forEach(l => { + l.values.splice(l.values.length - count, count) + }) + } + } + if (val === 'Sessions/s') { const tabs = _.cloneDeep(this.tabsTemplate) lineData.forEach((d, i) => {