How can add borderColor and borderWidth to Column type - highchart?

不羁岁月 提交于 2019-12-25 10:05:06

问题


I have tried to add border for selected series. Please adivise

    series: [{
        showInLegend: false,
        name: 'Twitter Trending',
        colorByPoint: true,
        data: dataArr,
        select: {
            borderWidth: 4,
            borderColor: '#e4b0b2'
        },
        allowPointSelect: true
    }]

Reference Screenshot


回答1:


In order to get desired result, plotoptions will be

plotOptions: {
    series: {
      allowPointSelect: true,
      states: {
        select: {
          borderWidth: 4,
          borderColor: '#e4b0b2'
        }
      }
    }
  },

Highcharts.chart('container', {
  chart: {
    type: 'column'
  },
  title: {
    text: 'Stacked bar chart'
  },
  xAxis: {
    categories: ['Apples', 'Oranges', 'Pears', 'Grapes', 'Bananas']
  },
  yAxis: {
    min: 0,
    title: {
      text: 'Total fruit consumption'
    }
  },
  legend: {
    reversed: true
  },
  plotOptions: {
    series: {
      allowPointSelect: true,
      states: {
        select: {
          borderWidth: 4,
          borderColor: '#e4b0b2'
        }
      }
    }
  },
  series: [{
    name: 'John',
    data: [3, 4, 4, 2, 5],
    showInLegend: false,
    name: 'Twitter Trending',
    colorByPoint: true,
  }]
});
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>

<div id="container" style="min-width: 310px; max-width: 800px; height: 400px; margin: 0 auto"></div>


来源:https://stackoverflow.com/questions/47647145/how-can-add-bordercolor-and-borderwidth-to-column-type-highchart

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!