Echarts 设置圆角样式

5 min read

文档

圆角半径,单位px,支持传入数组分别指定 4 个圆角半径。 如:

borderRadius: 5, // 统一设置四个角的圆角大小
borderRadius: [5, 5, 0, 0] //(顺时针左上,右上,右下,左下)

案例

 series: [{
    name: '合格率',
    type: 'bar',
    barWidth: '20%',
    xAxisIndex: 0,
    yAxisIndex: 0,
    itemStyle: {
      color: '#49B4F2',
      borderRadius: [10, 10, 10, 10],
    },
    data: Array.from({length: 11}, () => Math.floor(1000+Math.random() * 3000)),
    zlevel: 11
  },
    {
      name: '背景',
      type: 'bar',
      barWidth: '20%',
      xAxisIndex: 0,
      yAxisIndex: 1,
      barGap: '-105%',
      data: Array.from({length: 11}, () => 4000),
      itemStyle: {
        color: '#DEDFF2',
        borderRadius: [10, 10, 10, 10],
      },
      zlevel: 9
    },

  ]