How can I reset the styles given to series in Highcharts?

前端 未结 4 1177
执笔经年
执笔经年 2021-01-18 07:31

I am using Highcharts to render some graphs to my website. Sometimes, I need to remove all series from the chart and add some new series to the chart, because I requested so

4条回答
  •  庸人自扰
    2021-01-18 07:48

    Use the colors options:

    $('#container').highcharts({
        colors: ['#2f7ed8', 
            '#0d233a', 
            '#8bbc21'],
        series: …
    

    Live example: http://jsfiddle.net/juuQs/3/

    Or use a static color for each series, like this:

    chart.addSeries({
            data: [144.0, 176.0, 29.9, 71.5, 106.4, 129.2, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4],
            color: '#2f7ed8'
        });
    

提交回复
热议问题