本文介绍了如何将borderColor和borderWidth添加到列类型 - highchart?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图为所选系列添加边框。请注意

 系列:[{
showInLegend:false,
名称:'Twitter Trending',
colorByPoint:true,
data:dataArr,
select:{
borderWidth:4,
borderColor:'#e4b0b2'
},
allowPointSelect:true
}]

为了得到想要的结果,plotoptions将是

  plotOptions:{
series:{
allowPointSelect:true,
国家:{
选择:{
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 =containerstyle =min-width:310px;最大宽度:800px; height:400px; margin:0 auto>< / div>


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

解决方案

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>

这篇关于如何将borderColor和borderWidth添加到列类型 - highchart?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-26 22:48