echarts坐標軸線、坐標軸刻度線、網格線控制顯示隱藏以及柱狀圖顏色設置


x軸設置如下、y軸同理

     xAxis: {
        name: ' ',
        axisTick: {
          show: true  //坐標軸刻度線
        },
        axisLine: { //軸線
          show: false
        },
        splitLine:{ //網格線
          show:true
        },
        axisLabel: { //坐標軸樣式
          textStyle: {
            color: '#636363'
          }
        }},

效果圖:-------》》

 

 

順便來一下,柱狀圖顏色設置

series: [
        {
          type: 'bar',
          encode: {
            // Map the "amount" column to X axis.
            x: 'amount',
            // Map the "product" column to Y axis
            y: 'product'
          },
          itemStyle: {
            normal: {
              //這里是重點
              color: function(params) {
                //注意,如果顏色太少的話,后面顏色不會自動循環,最好多定義幾個顏色
                var colorList = ['#c23531','#2f4554', '#61a0a8', '#d48265', '#91c7ae','#749f83', '#ca8622'];
                return colorList[params.dataIndex]
              }
            }
          }
        }
      ]

  

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM