Adding new HighChart Series

后端 未结 2 632
谎友^
谎友^ 2020-12-15 11:54

At this code javascrip give an error

$.each(JSON, function(i, array) {                        
    chart.series[i].name = array.teamName;
    chart.series[i]         


        
相关标签:
2条回答
  • 2020-12-15 12:23

    You too can specify as second option of addSeries a boolean value, that indicates if it redraws or not

    0 讨论(0)
  • 2020-12-15 12:24

    You need to looka at the "Methods and Properties" part of the API. See http://api.highcharts.com/highcharts#Chart (There is an jsFiddle on the documentation page as well).

    var chart = new Highcharts.Chart(options);
    chart.addSeries({                        
        name: array.teamName,
        data: array.teamPowher
    });
    

    If you are going to add several series you should set the redraw flag to false and then call redraw manually after as that will be much faster.

    var chart = new Highcharts.Chart(options);
    chart.addSeries({                        
        name: array.teamName,
        data: array.teamPower
    }, false);
    chart.addSeries({                        
        name: array.teamName,
        data: array.teamPower
    }, false);
    chart.redraw();
    
    0 讨论(0)
提交回复
热议问题