将highstock导航器的颜色更改为与第一个系列相同 [英] Change color of highstock navigator to be identic to first series
问题描述
我有一张高库存图表,当用户选择不同的复选框时,将一个接一个地添加和删除系列.每个系列都有其自己的预定义颜色,对于每个系列,我还将使用
I have a highstock chart and will add and remove series one by one as the user selects different checkboxes. Each series has it's own pre-defined color and for each series I will also add a series to the navigator with the same color using code inspired from https://highcharts.uservoice.com/forums/55896-highcharts-javascript-api/suggestions/2361925-allow-navigator-to-have-multiple-data-series.
highstock只会自动处理第一个导航器系列(其余的我将以编程方式处理),一旦绘制出与用户选择的系列相同的颜色,我想更改其颜色.我尝试了几种方法,但没有一种起作用: http://jsfiddle.net/ezoeetvf/2/
Only the first navigator series is automatically handled by highstock (the rest I handle programmatically) and I'd like to change its color once it is drawn to be identic to the color of the user-selected series. I tried several things but non of them work: http://jsfiddle.net/ezoeetvf/2/
myChart.addSeries({
name : 'AAPL',
color: "#ff3300",
data : data,
tooltip: {
valueDecimals: 2
}
}, true);
// series 1 is the auto-added navigator
console.log(myChart.series[1].name);
// trying set it's color in various ways
myChart.series[1].color = "#ff3300";
myChart.series[1].options.color = "#ff3300";
myChart.series[1].options.lineColor = "#ff3300";
如何使导航器系列与我动态添加的第一个系列的颜色相同?
How can I have the navigator series to be the same color as the first series, which I am adding dynamically?
推荐答案
上面的GrzegorzBlachliński评论完成了这项工作.我结束了
Grzegorz Blachliński comment above did the job. I ended up with
myChart.series[1].update({color:"#55FF00" });
谢谢.
这篇关于将highstock导航器的颜色更改为与第一个系列相同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!