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.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);//创建图表
}
},

View File

@@ -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);
}
});