Highcharts - 根据某些条件动态地将点添加到具有不同颜色的图表

Highcharts - Add Point to chart with different color based on some condition dynamically

各位!我正在处理 Highchart,它每 5 秒将值附加到图表中。我要这样加分,

series.addPoint([(new Date()).getTime(), xnum(n.PointValue)], true, true);

添加点时,我想添加基于其他 属性 的不同颜色 (RED) 的点。谁能帮我添加不同颜色的点?谢谢

添加新点时可以直接传色。尝试使用带有 属性 'color'.

的对象而不是数组
series.addPoint({
y:(new Date()).getTime(), 
x:xnum(n.PointValue), 
color:some_condition?'red': 'blue'},
true, true);

示例笔 https://codepen.io/samuellawrentz/pen/XYVBjR?editors=1010