text: (function () {
      var myChart = echarts.init(document.querySelector('.bar'));
  
      var data = [];
      for (let i = 0; i < 5; ++i) {
          data.push(Math.round(Math.random() * 200));
      }
  
      option = {
          xAxis: {
              max: 'dataMax',
              splitLine: {
                  show: false
              }
          },
          yAxis: {
              type: 'category',
              data: ['A', 'B', 'C', 'D', 'E'],
              inverse: true,
              animationDuration: 300,
              animationDurationUpdate: 300,
              max: 3, // only the largest 3 bars will be displayed
              axisLine: {
                  show: false
              },
              axisTick: {
                  show: false
              },
          },
          series: [{
              barWidth: 8,
              realtimeSort: true,
              name: 'ranking',
              type: 'bar',
              data: data,
              label: {
                  show: true,
                  position: 'right',
                  valueAnimation: true,
                  color: '#fff'
              },
              itemStyle: {
                  normal: {
                      barBorderRadius: [0, 8, 8, 0],
                      color: new echarts.graphic.LinearGradient(0, 0, 1, 1, [{
                              offset: 0,
                              color: 'lightgreen'
                          },
                          {
                              offset: 0.5,
                              color: 'skyblue'
                          },
                          {
                              offset: 1,
                              color: 'lightyellow'
                          }
                      ])
                  },
                  emphasis: {
                      focus: 'series'
                  }, //hover样式: 其他柱体隐藏
              },
          }],
          legend: {
              show: true,
              icon: 'circle',
              textStyle: {
                  color: "#fff",
                  fontSize: 13,
              },
          },
          animationDuration: 3000,
          animationDurationUpdate: 3000,
          animationEasing: 'linear',
          animationEasingUpdate: 'linear'
      };
  
      function update() {
          var data = option.series[0].data;
          for (var i = 0; i < data.length; ++i) {
              if (Math.random() > 0.9) {
                  data[i] += Math.round(Math.random() * 2000);
              } else {
                  data[i] += Math.round(Math.random() * 200);
              }
          }
          myChart.setOption(option);
          
      }
  
      setInterval(function () {
          update();
      }, 3000);
  
      
  })();