echarts x軸 增加捲軸__web

來源:互聯網
上載者:User
          最近blog裡面大家都問 x軸類目顯示不全問題 如何增加捲軸  下面把我項目中用到的跟大家分享出來  其中
dataZoom 
的代碼就是增加捲軸用到的
                                function (ec) {              var myChart = ec.init(document.getElementById('line'));                                     var option = {                      title : {                       text: '商品排名分析',                      subtext:'橫向:商品名稱, 縱向:金額'               },                      tooltip: {                          show: true,                          trigger: 'axis'                      },                      legend: {                          data:['銷售重量','訂單金額']                      },                      toolbox: {                  show : true,                  feature : {                      mark : {show: true},                      dataView : {show: true, readOnly: false},                      magicType : {show: true, type: ['bar','line']},                      restore : {show: true},                      saveAsImage : {show: true}                  }              },            grid:{                                          y2:150                      },                      xAxis : [                          {                              type : 'category',                              boundaryGap : true,                              data : proNameArr,                              axisLabel:{                                            interval:0 ,                                          formatter:function(val){                                              return val.split("").join("\n");                                            }                                        }                            }                      ],                      yAxis : [                          {                              type : 'value'                          }                      ],<span style="color:#ff0000;">   <span style="color:#FF0000;">                   dataZoom : {                          show : true,                          realtime : true,                          start : 0,                          end : 100                      }</span>,</span>                      series : [                          {                              "name":"銷售重量",                              "type":"line",                              "data":normWeightArr                           },                          {                              "name":"訂單金額",                              "type":"line",                              "data":orderMoneyArr                           }                       ]                                          };                  // 為echarts對象載入資料                   myChart.setOption(option);              }

這是效果   



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.