| | |
| | | showLabel: { |
| | | type: Boolean, |
| | | default: true, |
| | | }, |
| | | maxColor: { |
| | | type: String, |
| | | default: 'green', |
| | | }, |
| | | minColor: { |
| | | type: String, |
| | | default: 'red', |
| | | } |
| | | }, |
| | | methods:{ |
| | |
| | | if(max == -Infinity) { |
| | | max = 1; |
| | | } |
| | | return Math.ceil(max*1.01); |
| | | return Number((max+max*0.2).toFixed(2)); |
| | | } |
| | | } |
| | | ], |
| | |
| | | if(!opt || !opt.series) { |
| | | return []; |
| | | } |
| | | let minColor = this.minColor; |
| | | let maxColor = this.maxColor; |
| | | // 设置配置项 |
| | | let series = opt.series.map(item=>{ |
| | | let max = this.getMax(item.data); |
| | |
| | | color: function(value) { |
| | | let val = value.value[1]; |
| | | if(val == max) { |
| | | return 'green'; |
| | | return maxColor; |
| | | }else if(val == min) { |
| | | return 'red'; |
| | | return minColor; |
| | | } |
| | | } |
| | | }; |