Change color of highstock navigator to be identic to first series

微笑、不失礼 提交于 2019-12-12 02:43:26

问题


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.

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?


回答1:


Grzegorz Blachliński comment above did the job. I ended up with

myChart.series[1].update({color:"#55FF00" });

Thanks.



来源:https://stackoverflow.com/questions/39265877/change-color-of-highstock-navigator-to-be-identic-to-first-series

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!