简体   繁体   中英

Shadow in Highcharts bar chart

I want to give 5 px shadow in right side of the bar. 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.

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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