3
votes

I´m trying to update my highchart serie appending new data.

My series look like:

series: [{
        name: 'Serie1',
        data:[
            {
                x: 0,
                low: Date.UTC(2013, 07, 03, 0, 00, 00),
                high: Date.UTC(2013, 07, 03, 4, 0, 0),
                cliente:[{nombre:'Pepe',
                    Partida:'11111',
                    Bandejas:'35'},
                    {nombre:'Pepe1',
                    Partida:'222',
                    Bandejas:'50'}]
            },
            {
                x: 0,
                low: Date.UTC(2013, 07, 03, 5, 0, 0),
                high: Date.UTC(2013, 07, 03, 9, 0, 0)
            },
                            {
                x: 0,
                low: Date.UTC(2013, 07, 03, 18, 0, 0),
                high: Date.UTC(2013, 07, 03, 24, 0, 0)
            }
      ]
    },
        {
        name: 'Serie2',
        data:[
            {
                x: 2,
                low: Date.UTC(2013, 07, 03, 4, 0, 0),
                high: Date.UTC(2013, 07, 03, 10, 0, 0)
            },
                            {
                x: 2,
                low: Date.UTC(2013, 07, 03, 18, 0, 0),
                high: Date.UTC(2013, 07, 03, 24, 0, 0)
            },
                            {
                x: 2,
                low: Date.UTC(2013, 07, 03, 0, 0, 0),
                high: Date.UTC(2013, 07, 03, 2, 0, 0)
            },
                            {
                x: 2,
                low: Date.UTC(2013, 07, 03, 11, 0, 0),
                high: Date.UTC(2013, 07, 03, 18, 0, 0)
            }
      ]
    }          
            ]

When I click a button I want to append new data inside "Serie 1".

I´ve tried chart.series[pos].setData(newdata); and it works, but delete all the previous data. I´ve also tried using chart.series[pos-1].data.push(newdata); but it doesn´t work.

Any solution?

1

1 Answers

4
votes

You can use addPoint function which allows to add new data.