ECharts2.0橫向顯示柱狀圖

            // 柱狀圖right
            HistogramR:function(HistogramData){  
               // 圖表釋放-------------------
               ec.init(document.getElementById(HistogramData.id)).dispose();
           //  柱狀圖
           var orname = HistogramData.legendData
           var ecHistogramR = ec.init(document.getElementById(HistogramData.id));           
ecHistogramR.setOption({
   tooltip : {
       trigger: 'axis',
       axisPointer : {type : 'line'},
       show:false
   },
   grid:{borderWidth:0,x:'2',y:'0',x2:'0',y2:'0',},
   legend: {data:[""]},
   xAxis : [{type : 'value',show:false,}],
   yAxis : [{
           type : 'category',       
           axisTick:{show:false},
           axisLine:{show:false,},   // y 軸線  
           splitLine:{show: false},//去除網格線
           data :HistogramData.yAxisData,
           show:'false'
      }],
   series : [{
           name:'',
           type:'bar',
           barWidth : 40,
           barGap:30,            
           itemStyle : {normal: {color:'#4ad2ff',barBorderRadius:[0, 20, 20, 0],label : {show: true, position: 'right'}},emphasis:{ barBorderColor:'rgba(0,0,0,0)',color:'rgba(0,0,0,0)'}},
           data:HistogramData.seriesData            
      }],
   noDataLoadingOption:this.noDataLoadingOption
});            
            },
            // 柱狀圖left
            HistogramL:function(HistogramData){  
               // 圖表釋放-------------------
               ec.init(document.getElementById(HistogramData.id)).dispose();
           //  柱狀圖
           var orname = HistogramData.legendData
           var ecHistogramL = ec.init(document.getElementById(HistogramData.id));           
ecHistogramL.setOption({
   tooltip : {
       trigger: 'axis',
       axisPointer : {type : 'line'},
       show:false
   },
   grid:{borderWidth:0,x:'0',y:'0',x2:'0',y2:'0'},
   legend: {data:[""]},
   xAxis : [{type : 'value',inverse:'true',show:false,}],
   yAxis : [{
           type : 'category',       
           axisTick:{show:false},  
           axisLine:{show:false,},  // y 軸線   
           splitLine:{show: false},//去除網格線
           data :HistogramData.yAxisData,
           show:'false'
      }],
   series : [{
           name:'',
           type:'bar',
           barWidth : 40,
           barGap:30,
           itemStyle : {normal:{color:'red',barBorderRadius:[20, 0, 0, 20],label : {show: true, position: 'left',formatter:function(v){return Math.abs(v.data)}}},emphasis:{ barBorderColor:'rgba(0,0,0,0)',color:'rgba(0,0,0,0)'}},
           data:HistogramData.seriesData            
      }],
   noDataLoadingOption:this.noDataLoadingOption
});            

            },



   // 柱狀圖right
   echar.HistogramR({
    id:'box-two',
    legendData:['宮保雞丁','酸辣土豆絲','聯盟廣告','大盤雞','小炒肉','燴麪'],
    yAxisData: ['1','2','3','4','5','6'],
    seriesData:[320, 332, 301, 334, 390, 330,]
   })  
   // 柱狀圖left
   echar.HistogramL({
    id:'box-one',
    legendData:['宮保雞丁','酸辣土豆絲','聯盟廣告','大盤雞','小炒肉','燴麪'],
    yAxisData: ['1','2','3','4','5','6'],
    seriesData:[-320, -332, -301, -334, -390, -330]
   }) 




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章