2016-05-13 81 views
2

我想在酒吧的右側給出5px的影子。可能嗎?Highcharts中的陰影條形圖

I want to give 5 px shadow in right side o

+1

檢查文檔:http://api.highcharts.com/highcharts#plotOptions.column.shadow – jlbriggs

+0

這是一個盒子的影子,但我需要在內部的陰影您可以在圖像中看到的酒吧。 – ali

回答

2

您應該使用它允許在圖表中添加自定義路徑渲染。知道這一點,捕捉負載事件並迭代每個序列點,在右側添加行。

chart: { 
    type: 'column', 
    events: { 
    load: function() { 
     var chart = this, 
     series = chart.series, 
     each = Highcharts.each, 
     r = chart.renderer, 
     borderWidth = 2, 
     x,y; 

     each(series, function(s, i) { 
     each(s.data, function(p, j) { 
         x = p.plotX + chart.plotLeft + (p.pointWidth/2); 
         y = p.plotY + chart.plotTop + borderWidth; 

      r.path(['M', x, y, 'L', x, y + p.shapeArgs.height]) 
      .attr({ 
      zIndex: 10, 
      'stroke-width': borderWidth, 
      'stroke': 'gray' 
      }) 
      .add() 
     }); 
     }); 
    } 
    } 
}, 

實施例: - http://jsfiddle.net/2reombm7/

+0

太棒了。非常感謝。你能否把這個問題標記爲有用的,有人將其標記爲:( – ali

+0

當然,upvoted;) –