0

Possible Duplicate:
Will setInterval cause browsers to hang?

i implement Highstock JS v1.1.4 chart for represent data

chart code :

chart = new Highcharts.StockChart({
    chart: {
        renderTo: 'highchartviewpanel',
        events:{

            load:function(){
                setIntervalForhighchartdata();
            }
            }

    },
    rangeSelector: {
        buttons: [{
            count: 1,
            type: 'minute',
            text: '1M'
        },{
            count: 5,
            type: 'minute',
            text: '5M'
        },
        {
            count: 15,
            type: 'minute',
            text: '15M'
        }],
        selected:0,
        inputEnabled: false
    },
    navigator: {
    height: 40,
    xAxis: {

     valueDecimals: 1
       }
     },

    title: {
        text: 'payment analysis',
        floating: true,
        align: 'right',
        x: -20,
        top: 20
    },
    xAxis: {
        type: 'datetime',
        dateTimeLabelFormats: {
            second : '%H:%M:%S',
            minute : '%H:%M',
            hour: '%H',
            day : '%b,%d',
            week : 'b,%d',
            month : '%Y,%b',
            year : '%Y'
        },
    valueDecimals: 0
    },
    yAxis: [
    {
        title: {
            text: 'item1'
        },
        height: 50,
        lineWidth: 2
    }, {
        title: {
            text: 'item2'
        },
        top: 90,
        height: 50,
        offset: 0,
        lineWidth: 2
    },{
        title: {
            text: 'item3'
        },
        top: 150,
        height: 50,
        offset: 0,
        lineWidth: 2
    }],
    series: [{
        name: 'item1',
        data: item1data,
        color:'blue'
       }, 
       {
        name: 'item2',
         yAxis: 1,
        data: item2data,
        color:'black'

    },{         
        name: 'item3',
        yAxis: 2,
        data: item3data,
        color:'red'

    }]
});

}

setIntervalForhighchartdata() is function which update graph every 10 sec and my data value is base on time interval xdata is datetime and ydata is data point of 1,2,3 ....

its hang browser some time when graph update

Community
  • 1
  • 1
jayesh
  • 2,422
  • 7
  • 44
  • 78

1 Answers1

1

The function your calling probably doesn't complete itself before you call it again.I assume you're using setInterval(). If so, I'd suggest using it combined with setTimeout().

For more info check out this thread - Will setInterval cause browsers to hang?

Community
  • 1
  • 1
Pankucins
  • 1,690
  • 1
  • 16
  • 25