score:1

Accepted answer

See my changes for you here: http://jsfiddle.net/KXpF7/3/

First, your data format is wrong since it's one dimension only, cannot be used to present (x,y)

data: [[3,11,0,3,4,40,2,11,1,5,40,12,11,40,1,40,12,2,3,2,1,12,1,0,1,15,1,4,12,0,4,5,4,12,15,12,1,2,12,2,3,10,4,15,5,4,12,11,0,15,4,40,4,15,1,4,4,40,12,15,1,0,0,5,11,12,15,0,2,4,11]]; // wrong format

You can have an array to put all of your historical data in a [x,y] format, which you can use in both categories in xAxis and series declaration.

var historicalData = [['2013-11-20 15:00:00',3],['2013-11-20 16:00:00',11],['2013-11-20 17:00:00',0],['2013-11-20 18:00:00',3],['2013-11-20 19:00:00',4],['2013-11-20 20:00:00',40],['2013-11-20 21:00:00',2],['2013-11-20 22:00:00',11],['2013-11-20 23:00:00',1],['2013-11-21 00:00:00',5],['2013-11-21 01:00:00',40]]; // finish the rest data by yourself

In the beginning you show the first N data points of historicalData. (modify var defaultDataNum = 5; according to your need)

        series: [{
            name: 'Real data',
            data: (function() {
                var data = [];
                // display the first defaultDataNum points in the beginning
                for (var i = 0; i < defaultDataNum; i++) {
                    data.push(historicalData[i]);
                }
                return data;
            })()
        }]

And get one more point from historicalData to display every 1 second afterwards.

        var intervalId = setInterval(function() {
            series.addPoint(historicalData[currentDataPos], true, true);
            currentDataPos++;
            // stop update when finish display all data
            if(currentDataPos == historicalData.length)
               clearInterval(intervalId);
        }, 1000);

That's the basic idea, please refer to my jsfiddle for all the details.


Related Query

More Query from same tag