highCharts 标志 - 从系列标志中删除线

highCharts flags - drop line from flag on series

我需要从 highStock 图表上的标志中删除线到系列,但我不知道我该怎么做。

我检查了 highCharts flags 并且我知道它具有数据的 Y 属性但这不是我需要的,首先因为 Y 只是标志数量的一个并且因为 Y 值本身与Y轴刻度.

我也检查了 xAxis.plotLines 但是那些到 xAxis 或 yAxis 的线,我需要这些线像屏幕截图一样停在系列上。

这是系列和标志的代码:

series: [{
type: 'area',
name: seriesName,
data: seriesData,
id: 'dataseries'
},
{
    type: 'flags',
    data: chartFlags,
    stackDistance: 20,
    width: 16,
    "shape": "url(http://www.highcharts.com/demo/gfx/sun.png)"
}]

有什么建议吗?

你看过plotOptions.flags.onSeries了吗?这似乎可以解决问题。

onSeries: String The id of the series that the flags should be drawn on. If no id is given, the flags are drawn on the x axis. Defaults to undefined. Defaults to undefined.

示例用法:

series: [{
type: 'area',
name: seriesName,
data: seriesData,
id: 'dataseries'
},
{
    type: 'flags',
    data: chartFlags,
    onSeries: seriesName,
    stackDistance: 20,
    width: 16,
    "shape": "url(http://www.highcharts.com/demo/gfx/sun.png)"
}]

您还可以使用 renderer 添加自定义形状。

HighCharts 标志不支持这一点,因为 highCharts 标志中的 Y 不代表 y 轴值,它的默认值为 -30。为了解决这个问题,我从标志值创建了不可见的系列,并将这些标志放在这个系列上。