2015-09-30 43 views
0

我正在繪製使用highcharts的多邊形系列,但我無法爲其添加邊框。我試圖使用plotOptions.series.borderWidth但沒有效果。如何在多邊形圖中添加邊框?

代碼:

$(function() { 

    $('#container').highcharts({ 
     title: { 
      text: 'Height vs Weight' 
     }, 
     subtitle: { 
      text: 'Polygon series in Highcharts' 
     }, 
     xAxis: { 
      gridLineWidth: 1, 
      title: { 
       enabled: true, 
       text: 'Height (cm)' 
      }, 
      startOnTick: true, 
      endOnTick: true, 
      showLastLabel: true 
     }, 
     yAxis: { 
      title: { 
       text: 'Weight (kg)' 
      } 
     }, 
     legend: { 
      layout: 'vertical', 
      align: 'right', 
      verticalAlign: 'middle' 
     }, 
     series: [{ 
      name: 'Target', 
      type: 'polygon', 
      data: [[153, 42], [149, 46], [149, 55], [152, 60], [159, 70], [170, 77], [180, 70], 
       [180, 60], [173, 52], [166, 45]], 
      color: Highcharts.Color(Highcharts.getOptions().colors[0]).setOpacity(0.5).get(), 
      enableMouseTracking: false 

     }], 
     tooltip: { 
      headerFormat: '<b>{series.name}</b><br>', 
      pointFormat: '{point.x} cm, {point.y} kg' 
     } 
    }); 
}); 

我如何添加情節多邊形系列?

回答

1

您可以設置線寬使用顯示圍繞多邊形的邊界:

plotOptions: { 
     series: { 
      lineWidth: 3 //whatever width you want 
     } 
    } 

看到Fiddle with your code here

如果要設置不同的顏色在多邊形使用的邊界:

plotOptions: { 
     series: { 
      lineWidth: 3, 
      lineColor:'#ff9634' // whatever border color you want 
     } 
    } 

看到不同的邊框顏色 your code Here