jquery - highchart data from mysql using ajax -


i want create line chart shows data database live.

i put new data database every 100 microseconds.

i use ajax check new data.

this code:

<html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script> <script src="http://code.highcharts.com/highcharts.js"></script>  <script type="text/javascript"> $(function () {     var chart = new highcharts.chart({         chart: {             renderto: 'container'         },         xaxis: {             type: 'datetime',             tickpixelinterval: 150,             maxzoom: 20 * 1000         },          series: [{             name: 'random data',             data: []         }]     });      $('#button').click(function() {         $.get('data.php', function(data) {         chart.series[0].setdata(data);         });     }); }); </script>   </head>    <body>     <div id="container" style="width: 100%; height: 400px"></div>     <button id="button">set new data</button>   </body> </html> 

the data.php returns following:

[ [date.utc(0000, 00, 00, 11, 11, 47, 7), 144], [date.utc(0000, 00, 00, 11, 11, 47, 17), 143], [date.utc(0000, 00, 00, 11, 11, 47, 29), 142], [date.utc(0000, 00, 00, 11, 11, 47, 39), 141], ] 

but doesn't show in chart.

can me make work?

it works. dont know issues facing. thing see time interval between data in milliseconds , have provided larger tick interval.

i removed tick interval (so highcharts plots them automatically) maxzoomperiod.

check here. http://jsfiddle.net/pluza/

ps: embedded data data field in series option. how result remain same when use ajax.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -