From e9e30ecedcb35d9206c0e5618425533fba311312 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Tue, 13 Oct 2020 16:23:33 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E6=B7=BB=E5=8A=A0=E6=B8=90?= =?UTF-8?q?=E5=8F=98=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/charts/chart-detail.vue | 28 +++++++++++-------- .../src/components/charts/chart-list.vue | 6 ++-- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/nezha-fronted/src/components/charts/chart-detail.vue b/nezha-fronted/src/components/charts/chart-detail.vue index 3e2d29edc..b7f67cb39 100644 --- a/nezha-fronted/src/components/charts/chart-detail.vue +++ b/nezha-fronted/src/components/charts/chart-detail.vue @@ -467,6 +467,7 @@ this.panelIdInner = panelId; this.data = chartItem; + console.log(detail); this.detail = detail; if (this.detail[0] && this.detail[0].type && this.detail[0].type == "endpointInfo") { //endpointInfo的小图表 this.$nextTick(() => { @@ -481,17 +482,19 @@ initChart(series) { series.forEach((item)=>{ item.areaStyle={ - // color: { - // type: 'linear', - // x: 0, - // y: 0, - // colorStops: [{ - // offset: 0, color: 'rgb(255, 158, 68)' // 0% 处的颜色 - // }, { - // offset: 1, color: 'rgb(255, 70, 131)' // 100% 处的颜色 - // }], - // global: false - // } + color: { + type: 'linear', + x: 0, + y: 0, + x2: 0, + y2: 1, + colorStops: [{ + offset: 0, color: 'rgb(35,191,154)' // 0% 处的颜色 + }, { + offset: 1, color: 'rgb(255, 255, 255)' // 100% 处的颜色 + }], + global: false + } } }); let option = { @@ -549,6 +552,9 @@ series: series }; let chart = echarts.init(document.querySelector("#littleChart")); + option.series.forEach((item)=>{ + item.lineStyle.color='rgb(35,191,154)'; + }) chart.setOption(option);//创建图表 } }, diff --git a/nezha-fronted/src/components/charts/chart-list.vue b/nezha-fronted/src/components/charts/chart-list.vue index 1e2f7c1f4..63521452e 100644 --- a/nezha-fronted/src/components/charts/chart-list.vue +++ b/nezha-fronted/src/components/charts/chart-list.vue @@ -1225,7 +1225,7 @@ } }, getEndpointInfoChartData(chartInfo) { - let detail = []; + let detail = [null,null]; this.$refs['editChart'+chartInfo.id][0].showLoad(); chartInfo.title = this.$t("project.chart.endpointInfo"); @@ -1274,7 +1274,7 @@ }); basicInfo.stateSeries = [series]; basicInfo.state = ""; - detail.push({title: this.$t("project.chart.basicTitle"), data: basicInfo, type: "endpointInfo"}); + detail[0]={title: this.$t("project.chart.basicTitle"), data: basicInfo, type: "endpointInfo"}; resolve(true); } } @@ -1303,7 +1303,7 @@ } }); }(); - detail.push({title: this.$t("overall.alert"), data: alerts}); + detail[1]={title: this.$t("overall.alert"), data: alerts}; resolve(true); } });