dynamically update pointStart series attribute in line chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

dynamically update pointStart series attribute in line chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.7.1.js"></script> 
      <script type="text/javascript">
$(function () {//  www  . jav a  2 s  .c o  m
    startDate = Date.UTC(2010, 0, 1);
    createData = function(beginDate){
        someData = [];
        for (var i = 0; i < 11; i++){
         someData.push([beginDate + (3600 * 1000 * 24 * i), Math.random() * 100]);
        }
        return someData;
    }
    Highcharts.setOptions({
        global: {
            useUTC: false
        }
    });
    chart = new Highcharts.Chart({
        chart: {
            renderTo: 'container'
        },
        xAxis: {
            type: 'datetime'
        },
        series: [{
            data: createData()
        }]
    });
    nextDay = function(){
        startDate += 3600 * 1000 * 24;
        chart.series[0].setData(createData(startDate), true);
        setTimeout(nextDay, 2000);
    };
    setTimeout(nextDay, 2000);
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px"></div>  
   </body>
</html>

Related Tutorials