Ellie Zhu
Ellie Zhu

Reputation: 83

High charts update data series

I am trying to update the data series with Series.update() So, if you click on the Allocation Funds, the lines should change. However, only the first set of data are being updated, the rest are not. Can you help me with why and how can I fix it? Thank you! http://jsfiddle.net/5cur7gg4/1/

chart2.series[0].update({
    data:[-3.49 , 9.21 , 9.21 , 4.36 , 17.74 , null],
    color: '#588c7e',
    name:"A"
},{
    data:[-1.47 , 6.89 , 6.89 , 7.06  , 12.95 , 12.45],
    color: '#f2e394',
    name:"B"
},{
    data:[-2.57 , 7.46, 7.46, 3.00, 19.45, null],
    color: '#f2ae72',
    name:"C"
},{
    data:[-2.42 , 8.46, 8.46, 16.50, 21.27, null],
    color: '#d96459',
    name:"D"
},
{
    data:[-1.23, 6.31, 6.31, 5.49, 15.48, 14.81],
    color: '#8c4646',
    name:"E"
});

Upvotes: 1

Views: 115

Answers (1)

Guanxi
Guanxi

Reputation: 3131

You need to update individual series like this.

chart2.series[0].update({
        data:[-3.49 , 9.21 , 9.21 , 4.36 , 17.74 , null],
        color: '#588c7e',
        name:"A"
    },false);
    chart2.series[1].update({
        data:[-1.47 , 6.89 , 6.89 , 7.06  , 12.95 , 12.45],
        color: '#f2e394',
        name:"B"
    }, false);
    chart2.series[2].update({
        data:[-2.57 , 7.46, 7.46, 3.00, 19.45, null],
        color: '#f2ae72',
        name:"C"
    }, false);
    chart2.series[3].update({
        data:[-3.42 , 8.46, 8.46, 16.50, 21.27, null],
        color: '#d96459',
        name:"D"
    }, false);
    chart2.series[4].update({
        data:[-4.23, 6.31, 6.31, 5.49, 15.48, 14.81],
        color: '#8c4646',
        name:"E"
    }, true);

Upvotes: 1

Related Questions