码迷,mamicode.com
首页 > 其他好文 > 详细

Echarts

时间:2020-11-18 12:25:34      阅读:7      评论:0      收藏:0      [点我收藏+]

标签:etop   type   code   初始   method   ado   doc   set   index   

  <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/Nm3)‘, ‘NOx浓度(mg/Nm3)‘, ‘SO?浓度(mg/Nm3)‘]
        },
        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>

Echarts

标签:etop   type   code   初始   method   ado   doc   set   index   

原文地址:https://www.cnblogs.com/zxg-code/p/13963176.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!