小编Raj*_*har的帖子

如何在echarts条形图中手动强调系列?

我有一个包含一系列数据的echarts条形图。单击某个栏时,会对其应用强调。有没有一种方法可以以编程方式选择条形图中的系列之一以在图表加载时强调?

强调前 单击时强调

我的条形图选项代码:

  options = {
    markPoint: { data: ['Q1'] },
    color: ['#3398DB'],
    tooltip: {
      trigger: 'axis',
      axisPointer: {
        type: 'shadow'
      }
    },
    grid: {
      left: '3%',
      right: '4%',
      bottom: '3%',
      containLabel: true
    },
    xAxis: [
      {
        type: 'category',
        data: ['Q1', 'Q2', 'Q3', 'Q4'],
        axisTick: {
          alignWithLabel: true,
        }
      }
    ],
    yAxis: [{
      type: 'value'
    }],
    series: [{
      name: 'Counters',
      type: 'bar',
      barWidth: '50%',
      data: [3,8,12,5],
      itemStyle: {
        //highlight
        emphasis: {
          barBorderColor: 'red',
          barBorderWidth: 2
        }

      }
    }]
  };
Run Code Online (Sandbox Code Playgroud)

谢谢。

echarts angular

1
推荐指数
1
解决办法
8439
查看次数

标签 统计

angular ×1

echarts ×1