feat:添加渐变色

This commit is contained in:
zhangyu
2020-10-13 16:23:33 +08:00
parent 86fa0b63cb
commit e9e30ecedc
2 changed files with 20 additions and 14 deletions

View File

@@ -467,6 +467,7 @@
this.panelIdInner = panelId; this.panelIdInner = panelId;
this.data = chartItem; this.data = chartItem;
console.log(detail);
this.detail = detail; this.detail = detail;
if (this.detail[0] && this.detail[0].type && this.detail[0].type == "endpointInfo") { //endpointInfo的小图表 if (this.detail[0] && this.detail[0].type && this.detail[0].type == "endpointInfo") { //endpointInfo的小图表
this.$nextTick(() => { this.$nextTick(() => {
@@ -481,17 +482,19 @@
initChart(series) { initChart(series) {
series.forEach((item)=>{ series.forEach((item)=>{
item.areaStyle={ item.areaStyle={
// color: { color: {
// type: 'linear', type: 'linear',
// x: 0, x: 0,
// y: 0, y: 0,
// colorStops: [{ x2: 0,
// offset: 0, color: 'rgb(255, 158, 68)' // 0% 处的颜色 y2: 1,
// }, { colorStops: [{
// offset: 1, color: 'rgb(255, 70, 131)' // 100% 处的颜色 offset: 0, color: 'rgb(35,191,154)' // 0% 处的颜色
// }], }, {
// global: false offset: 1, color: 'rgb(255, 255, 255)' // 100% 处的颜色
// } }],
global: false
}
} }
}); });
let option = { let option = {
@@ -549,6 +552,9 @@
series: series series: series
}; };
let chart = echarts.init(document.querySelector("#littleChart")); let chart = echarts.init(document.querySelector("#littleChart"));
option.series.forEach((item)=>{
item.lineStyle.color='rgb(35,191,154)';
})
chart.setOption(option);//创建图表 chart.setOption(option);//创建图表
} }
}, },

View File

@@ -1225,7 +1225,7 @@
} }
}, },
getEndpointInfoChartData(chartInfo) { getEndpointInfoChartData(chartInfo) {
let detail = []; let detail = [null,null];
this.$refs['editChart'+chartInfo.id][0].showLoad(); this.$refs['editChart'+chartInfo.id][0].showLoad();
chartInfo.title = this.$t("project.chart.endpointInfo"); chartInfo.title = this.$t("project.chart.endpointInfo");
@@ -1274,7 +1274,7 @@
}); });
basicInfo.stateSeries = [series]; basicInfo.stateSeries = [series];
basicInfo.state = ""; 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); 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); resolve(true);
} }
}); });