fix:修改新增图表 每次的随机色都是一样的问题

This commit is contained in:
zhangyu
2021-12-09 10:39:16 +08:00
parent 2e7316272a
commit 282ba512b6
2 changed files with 2 additions and 1 deletions

View File

@@ -80,7 +80,7 @@ export default {
initChart (chartOption) { initChart (chartOption) {
const self = this const self = this
this.legends = [] this.legends = []
chartOption.series = this.initPieData(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends chartOption.series = this.initBarData(this.chartInfo, chartOption.series[0], this.chartData) // 生成series和legends
chartOption.xAxis.data = chartOption.series.data.map(item => item.name) chartOption.xAxis.data = chartOption.series.data.map(item => item.name)
chartOption.axisLabel = { chartOption.axisLabel = {
margin: 8, margin: 8,

View File

@@ -361,6 +361,7 @@ export default {
/* 图表相关操作--start */ /* 图表相关操作--start */
addChart () { addChart () {
this.chart = this.newChart() this.chart = this.newChart()
this.chart.param.thresholds = [{ value: undefined, color: randomcolor() }]
this.chart.panelId = this.showPanel.id this.chart.panelId = this.showPanel.id
this.chart.panelName = this.showPanel.name this.chart.panelName = this.showPanel.name
}, },