echarts柱状图实现倾斜纹效果

echarts yekong

echarts在渲染柱状图的时候,为了增加效果多元化,这里增加了一个倾斜纹的效果,也就是echarts的无障碍花纹效果。这里通过aria来进行设置。

echarts柱状图实现倾斜纹效果

echarts版本

"echarts": "^5.4.0",

实例代码

drawLine() {
  var that = this
  window.addEventListener('resize', this.drawLine)
  let myChart = echarts.init(this.$refs.echarts)
  var option = {
    aria: {
      enabled: true,
      decal: {
        show: true,
        decals: {
          color: '#0c4583',
          dashArrayX: [0, 0],
          dashArrayY: [0.5, 1],
          symbolSize: 1,
          rotation: Math.PI / 6
        }
      }
    },
    textStyle: {
      color: '#c0c3cd',
      fontSize: 14,
    },
    legend: {
      show: false,
      top: 10,
      itemWidth: 8,
      itemHeight: 8,
      icon: 'circle',
      left: 'center',
      padding: 0,
      textStyle: {
        color: '#c0c3cd',
        fontSize: 14,
        padding: [2, 0, 0, 0],
      },
    },
    color: ['#00D7E9', 'rgba(0, 215, 233, 0.9)'],
    grid: {
      containLabel: true,
      left: 10,
      right: 10,
      bottom: 10,
      top: 40,
    },
    xAxis: {
      nameTextStyle: {
        color: '#c0c3cd',
        padding: [0, 0, -10, 0],
        fontSize: FontChart(14),
      },
      axisLabel: {
        color: 'rgba(215, 231, 255, 1)',
        fontSize: 12,
        interval: 0,
        lineHeight: 20,
      },
      axisTick: {
        show: false,
        lineStyle: {
          color: '#384267',
          width: 1,
        },
      },
      splitLine: {
        show: false,
      },
      axisLine: {
        lineStyle: {
          color: '#335971',
        },
        show: true,
      },
      data: this.list.map(obj => obj.City),
      type: 'category',
    },
    yAxis: {
      max: 100,
      minInterval: 10,
      axisLabel: {
        color: 'rgba(181, 217, 255, 1)',
        fontSize: FontChart(14),
        interval: 0,
        fontFamily: 'DIN_Bold',
        // 使用 formatter 函数自定义标签格式
        formatter: function (value) {
          // 返回标签值后追加「分」
          return value + '分';
        }
      },
      axisTick: {
        lineStyle: {
          color: '#668092',
          width: 0,
        },
        show: true,
      },
      splitLine: {
        show: true,
        lineStyle: {
          color: '#335971',
          "type": "dashed"
        },
      },
      axisLine: {
        lineStyle: {
          color: 'rgba(8, 46, 124, 1.00)',
          width: 1,
          type: "dashed"
        },
        show: false,
      }
    },
    series: [{
      type: 'bar',
      data: this.list.map(obj => obj.Score),
      barWidth: '30px',
      itemStyle: {
        normal: {
          color: function (params) {
            var colorList = ['rgba(63, 190, 226, 1)', 'rgba(63, 190, 226, 1)', 'rgba(63, 190, 226, 1)', 'rgba(63, 190, 226, 1)'];
            return colorList[params.dataIndex];
          },
        },
      },
      label: {
        normal: {
          show: false,
          fontSize: 18,
          fontWeight: 'bold',
          color: '#333',
          position: 'top',
        }
      }
    }],
    tooltip: {
      show: true,
      trigger: 'axis',
      formatter: '{b}:{c0}',
    },
  };
  myChart.clear()
  myChart.resize()
  myChart.setOption(option)
},

其他花纹效果

其他花纹效果

花纹代码

var decalColor = 'rgba(0, 0, 0, 0.8)';
var svg =
  'M136.71078,90.7149424 C135.038663,90.084817 133.319214,89.8204828 131.637995,89.8987366 C131.93792,88.5693311 132.022117,87.2371959 131.901965,85.9319035 C131.475516,81.1970909 128.414369,76.8944942 123.681104,75.0882862 C118.812669,73.2488659 113.532803,74.556888 110.072058,78.0014222 C111.44425,78.0132512 112.836467,78.2716709 114.184082,78.7876003 C120.385569,81.1311211 123.498145,88.0593162 121.156545,94.2582038 C120.289538,96.5421242 118.80038,98.4052027 116.960324,99.7405227 C113.796773,102.011704 109.591905,102.714169 105.683776,101.228711 C99.4827445,98.8915594 96.3669821,91.9606345 98.7113134,85.7581072 C99.0176102,84.9537305 99.4044636,84.2007647 99.8609505,83.4869258 L99.8545788,83.4869258 C99.8545788,83.4869258 99.8545788,83.4869258 99.8545788,83.4932953 C101.850742,80.3754255 103.561544,76.9968612 104.927364,73.3990041 C115.528966,45.4164295 101.427934,14.127175 73.4261234,3.52605368 C45.4215819,-7.07142797 14.1333382,7.02472855 3.52900521,35.0104878 C0.629425582,42.6470623 -0.42099504,50.523403 0.149272308,58.1686218 C0.16110547,58.4206719 0.185226914,58.6786366 0.209348358,58.9366014 C2.47266801,84.9182432 19.2184117,108.595036 45.2413538,118.442737 C71.7121355,128.45559 100.448968,121.413198 119.352898,102.762395 C122.585626,99.6263266 127.465895,98.4657129 131.950208,100.160455 C137.34704,102.203699 140.39954,107.712861 139.559386,113.191995 C141.579216,111.769777 143.215378,109.750646 144.163851,107.256987 C146.676122,100.628613 143.33553,93.2204304 136.71078,90.7149424 ZZ';
var base64 =
  'image://data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJ8AAAClCAYAAABC+i8rAAAAAXNSR0IArs4c6QAAAERlWElmTU0AKgAAAAgAAYdpAAQAAAABAAAAGgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAAn6ADAAQAAAABAAAApQAAAACQfA6rAAAc5klEQVR4Ae1dC3xcRb2eObtJNiUJ0EKBgtAUUFDE9u6m5WkLWqAlm/em5aLcSkGrCApeHipqfHERQbCUIvSCD1Dp5p3UalFsoUBvmgQBxYtUkhZKqy2l2FceuzvjN9vs9uwme/ac3bOPszvn90t2zpz//Oc/33xnXmcelOTQtXbO1WUH/PvOJZTORLLKKeFTOSEncM6nUkLh5mWUUkY4CRCKv+AvH4XsDkLodsrJdk75dkqUt7mNvupZMOt12tTEcgiirEoKzSprDBrT5qo9x098C0Cc8wjhM0GmcpDNvDRRsg+k7QV5NyuU9tgU+/N1m9v3GDRTisdAwLyMihGBmd7rLvv0Ufvee/+TINhC/C0gnH/ATP3xdFFK/OD2s/htU1hBe31/2854YeTz2AhYgnwts6tcjPHrkYyrUAqVxk5O+p4AOI4ydhPndHWpvexnC3t+uS99sedGTFlLPu88Twk9OHwNyHY950S04bL2QjtyP0rhxwuI/cHa/o43s9bQLDMs68jX7XRPGqL8BpQot6FwOS7L8IpjDmWU8jVUsd3r2dy5MY5w3j/OGvKtn7fEsevAns8jR25HKXKC1XMG7cIuu1JwKzoob1g9LamyPyvI11xRVccZW45OxMmpSmhm9FIfhntWksLi7zRuan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bonur+JrQ5enrvmHC4P1rgt6ixGp2uTuRsnDHAu9iQuQT1TiwewSKvxKKE9gtRkl6Z/2LbdtCfun4PX73UQW72JCwJbELxY86t8ERvJ+2B5T6zd1rcNOemNbxodDbjRjnKyywiV4o2kNmXPTdKZNmPWOGJi0dbefVng24zlXLgES/Vt/HcqOpEVX1kpleV9WHYslr+dNCx/1o+4VnnYg2Iwaow2TUCpvNz9ARXSHOlcMLjaGR0uJr8IsSKtmL+hyMBL95hjTV/l/HVqw7uALV+z9Cfgn/omFv9DTrROLy+/zhjsJY+L1sevE6PbpmkBOfhlzEy4aDZaL16VFFUJK+gy8ZES8zcmtpt9N9nC4FWSiETsaqxt6uLwnTgsMIjRuaD+Co9Fq08+pQP2MiF90qikajtiPMOnd/97vR4Rr7OjZPcpR9GG/xd6D/BTSU9kXL6LkPNezF6T7Q1RP6Q9jwOJkePUIGtr4eCi9+8Z30yHgciezl4sVs0zuo6+p/1Cfk1XagNEyIfEIHxifuga0jsHFU/MHLjuOOTF0opLbVbLfgEfAYBOIdsP9iT/+az+I+yK1/Awz+VK7/QH61AAAAAElFTkSuQmCC';
var decals = [
  {
    color: decalColor,
    dashArrayX: [1, 0],
    dashArrayY: [2, 5],
    symbolSize: 1,
    rotation: Math.PI / 6
  },
  {
    color: decalColor,
    symbol: 'circle',
    dashArrayX: [
      [8, 8],
      [0, 8, 8, 0]
    ],
    dashArrayY: [6, 0],
    symbolSize: 0.8
  },
  {
    color: decalColor,
    dashArrayX: [1, 0],
    dashArrayY: [2, 3],
    rotation: -Math.PI / 4
  },
  {
    color: decalColor,
    dashArrayX: [
      [6, 6],
      [0, 6, 6, 0]
    ],
    dashArrayY: [6, 0]
  },
  {
    color: decalColor,
    dashArrayX: [
      [1, 0],
      [1, 6]
    ],
    dashArrayY: [1, 0, 3, 0],
    rotation: Math.PI / 4
  },
  {
    color: decalColor,
    symbol: 'triangle',
    dashArrayX: [
      [9, 9],
      [0, 9, 9, 0]
    ],
    dashArrayY: [7, 2],
    symbolSize: 0.75
  },
  {
    color: decalColor,
    dashArrayX: [1, 0],
    dashArrayY: 10,
    rotation: 0
  },
  {
    color: decalColor,
    dashArrayX: [10, 10],
    dashArrayY: [1, 0],
    rotation: 0
  },
  {
    color: decalColor,
    dashArrayX: [10, 5, 20, 5],
    dashArrayY: 10,
    rotation: 0
  },
  {
    color: decalColor,
    dashArrayX: [
      [10, 5, 20, 5],
      [20, 5]
    ],
    dashArrayY: [10, 5],
    rotation: 0
  },
  {
    symbol: 'rect',
    dashArrayX: [
      [8, 8],
      [0, 8, 8, 0]
    ],
    dashArrayY: [8, 0],
    symbolSize: 0.8,
    rotation: Math.PI / 4,
    color: 'black'
  },
  {
    color: decalColor,
    dashArrayX: [
      [30, 30],
      [0, 30, 30, 0]
    ],
    dashArrayY: [15, 0],
    symbol: 'path://' + svg
    // }, {
    //     color: decalColor,
    //     dashArrayX: [[30, 30], [0, 30, 30, 0]],
    //     dashArrayY: [30, 0],
    //     symbol: base64,
    //     symbolSize: 0.8
  }
];
var columns = 6;
var rows = Math.floor(decals.length / columns) + 1;
function renderItem(params, api) {
  var paletteColor = api.visual('color');
  var paletteDecal = api.visual('decal');
  return {
    type: 'group',
    x: (api.value(0) % columns) * 120 + 50,
    y: Math.floor(api.value(0) / columns) * 120 + 50,
    children: [
      {
        type: 'rect',
        shape: { x: 0, y: 0, width: 100, height: 100 },
        style: { fill: paletteColor, decal: paletteDecal }
      }
    ]
  };
}
option = {
  xAxis: {
    type: 'value',
    max: 1,
    show: false
  },
  yAxis: {
    type: 'value',
    show: false
  },
  series: (function () {
    var series = [];
    for (var i = 0; i < decals.length; ++i) {
      series.push({
        type: 'custom',
        data: [[i]],
        renderItem: renderItem
      });
    }
    return series;
  })(),
  aria: {
    enabled: true,
    decal: {
      show: true,
      decals: decals
    }
  },
  color: ['#ddd']
};

更多柱状图效果实例

echarts 柱状图效果实例汇总

项目应用

营商环境智能监控中心

喜欢