在Highchart的蜱应用自定义样式(Applying custom style on ticks

2019-10-19 05:03发布

我想申请自定义样式的X a是蜱Highcharts的。 我想样式蜱圈而不线的形式。 像ticks.chart.renderer.cirlce();

没能找到一种方法来完成它。

Answer 1:

你可以用getMatkPath功能,呈现另一种刻度,请参阅: http://jsfiddle.net/Yrygy/83/

Highcharts.wrap(Highcharts.Tick.prototype, 'getMarkPath', function (prev, x, y, tickLength, tickWidth, horiz, renderer) {
    return renderer.circle(x, y, tickLength);
});

编辑:

当使用变焦/从Highcharts或Highstock摇摄等,则需要返回的数据从getMarkPath是路径的阵列( d为SVG)。

例如: http://jsfiddle.net/AVhaL/1/

更新:(2016年1月28日):

在Highcharts需要4.2.x版的新方法(我们应该为对勾标记,不渲染的对象返回路径):

Highcharts.wrap(Highcharts.Tick.prototype, 'getMarkPath', function(prev, x, y, tickLength, tickWidth, horiz, renderer) {
  return renderer.symbol('circle', x - tickLength / 2, y - tickLength / 2, tickLength, tickLength);
});


文章来源: Applying custom style on ticks of Highchart