Highcharts 条形图中的阴影

ali*_*ali 5 javascript highcharts highcharts-ng

我想在栏的右侧提供 5 像素的阴影。是否可以?

我想在右侧 o 上给出 5 px 的阴影

Seb*_*han 4

您应该使用允许在图表中添加自定义路径的渲染器。知道这一点后,捕获加载事件并迭代每个系列点,在右侧添加行。

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()
        });
      });
    }
  }
},
Run Code Online (Sandbox Code Playgroud)

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