From 2e113df17bee526e4aae17c95f5f183f224d352c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E6=B4=AA=E6=B4=AA?= <2498601771@qq.com> Date: Thu, 28 Dec 2023 17:27:02 +0800 Subject: [PATCH] =?UTF-8?q?fix:=201=E3=80=81=E4=BF=AE=E5=A4=8Ddetection?= =?UTF-8?q?=E9=A1=B6=E9=83=A8=E6=9F=B1=E7=8A=B6=E5=9B=BE=E6=97=A0=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E7=9A=84=E5=9C=B0=E6=96=B9=E9=BC=A0=E6=A0=87=E7=A7=BB?= =?UTF-8?q?=E4=B8=8A=E5=8E=BB=E4=BC=9A=E6=98=BE=E7=A4=BA=E4=B8=8A=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E6=88=96=E4=B8=8B=E4=B8=80=E4=B8=AA=E6=9F=B1=E5=AD=90?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=EF=BC=9B2=E3=80=81x=E8=BD=B4?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E7=9A=84=E6=97=B6=E9=97=B4=E5=B9=B6=E9=9D=9E?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=80=89=E6=8B=A9=E5=99=A8=E7=9A=84=E8=B5=B7?= =?UTF-8?q?=E5=A7=8B=E6=97=B6=E9=97=B4=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/detections/Index.vue | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/views/detections/Index.vue b/src/views/detections/Index.vue index cf3c8ba2..87717355 100644 --- a/src/views/detections/Index.vue +++ b/src/views/detections/Index.vue @@ -325,6 +325,21 @@ export default { const chartDom = document.getElementById(`eventSeverityTrendBar${this.pageType}`) const eventSeverityTrendOption = this.$_.cloneDeep(multipleBarOption) + const key = changeI18nOfSeverity(data[0].severity) + const len = dataMap.get(key).length + // 将时间转为毫秒,并分为100个间隔值,如有100条数据,则不分割,如48不满100,按52分割,保证有数据的时间点不受无数据时间点影响 + const diffTime = ((params.endTime - params.startTime) * 1000) / (len > 100 ? 100 : (100 - len)) + const timeList = [] + for (let i = (params.startTime * 1000); i < (params.endTime * 1000);) { + i = i + diffTime + timeList.push([parseInt(i.toFixed(0)), 0]) + } + // 将100个时间间隔与柱状图数据合并并排序 + dataMap.forEach(function (value, index) { + value = value.concat(timeList) + value.sort((a, b) => a[0] - b[0]) + dataMap.set(index, value) + }) const xData = [] dataMap.forEach(function (value) { // eventSeverityTrendOption.series[Number(getSeriesIndex(key))].data = value.map(v => Number(v[1]))