简体   繁体   English

Highcharts条形图中的阴影

[英]Shadow in Highcharts bar chart

I want to give 5 px shadow in right side of the bar. 我想在酒吧的右侧给5个px阴影。 Is it possible? 可能吗?

我想在右侧给5个px阴影o

You should use the Renderer which allows to add custom paths in chart. 您应该使用允许在图表中添加自定义路径的渲染器。 Knowing that, catch the load event and iterate on each series point, adding line in right side. 知道这一点,捕获load事件并迭代每个系列点,在右侧添加线。

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()
        });
      });
    }
  }
},

Example: - http://jsfiddle.net/2reombm7/ 示例: - http://jsfiddle.net/2reombm7/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM