Echarts
作者:互联网
<div class="charts rightTopEcharts">
<script>
mounted () {
this.rightTopFun()
},
methods: {
// 右上
rightTopFun () {
// 基于准备好的dom,初始化echarts实例
var myChart = this.$echarts.init(document.querySelector('.rightTopEcharts'))
// 配置项
var option = {
tooltip: {
trigger: 'axis',
axisPointer: {
type: 'shadow'
}
},
grid: {
left: '5%',
right: '5%',
bottom: '5%',
top: '5%',
containLabel: true
},
xAxis: {
type: 'value',
boundaryGap: [0, 0.01]
},
yAxis: {
type: 'category',
data: ['PM浓度(mg/Nm³)', 'NOx浓度(mg/Nm³)', 'SO₂浓度(mg/Nm³)']
},
series: [
{
name: '实时排放浓度',
type: 'bar',
// 设置不同的柱状图的颜色
itemStyle: {
normal: {
color: function (params) {
var colorList = ['orange', 'skyblue', 'green']
return colorList[params.dataIndex]
}
}
},
// 显示柱状图上面的数字位置 insideRight 内部右侧
label: {
show: true,
position: 'insideRight'
},
// 设置 柱状图的柱状宽度
barWidth: 25,
data: [6.5, 9, 10.85]
}
]
}
myChart.setOption(option)
},
</script>
标签:mg,Nm,var,柱状图,5%,type,Echarts 来源: https://www.cnblogs.com/zxg-code/p/13963176.html