Hello people i got an issue with my chart, it seems that it receives the data and all, but not displaying it as it should.
this is my code for the chart..
Thank you in advance for any solution.Code:<html> <head> <title>Online Users</title> <link href="css/style.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js1/jquery-1.7.1.min.js" ></script> <script type="text/javascript" src="js1/highcharts.js" ></script> <script type="text/javascript" src="js1/themes/gray.js"></script> <script type="text/javascript"> var chart; $(document).ready(function() { var options = { chart: { renderTo: 'container', defaultSeriesType: 'line', marginRight: 130, marginBottom: 25 }, title: { text: 'Hourly Visits', x: -20 //center }, subtitle: { text: '', x: -20 }, xAxis: { type: 'timestamp', tickInterval: 3600 * 1000, // one hour tickWidth: 0, gridLineWidth: 1, labels: { align: 'center', x: -3, y: 20, formatter: function() { return Highcharts.dateFormat('%l%p', this.value); } } }, yAxis: { title: { text: 'Visits' }, plotLines: [{ value: 0, width: 1, color: '#808080' }] }, tooltip: { formatter: function() { return Highcharts.dateFormat('%l%p', this.x-(1000*3600)) +'-'+ Highcharts.dateFormat('%l%p', this.x) +': <b>'+ this.y + '</b>'; } }, legend: { layout: 'vertical', align: 'right', verticalAlign: 'top', x: -10, y: 100, borderWidth: 0 }, series: [{ name: 'Users Online' }] } jQuery.get('onlinedata.php', null, function(tsv) { var lines = []; var t = []; var d = []; traffic = []; try { // split the data return into lines and parse them tsv = tsv.split(/\n/g); jQuery.each(tsv, function(i, line) { line = line.split(/\t/); t = 'timestamp'.split(/[- :]/); d = new Date(t[0], t[1], t[2], t[3], t[4], t[5]); date = Date.parse(line[d]); traffic.push([ date, parseInt(line[1]) ]); }); } catch (e) { } options.series[0].data = traffic; chart = new Highcharts.Chart(options); }); }); </script> </head> <body> <div id="top"> <center><img src = "images/l2worl10.jpg"></center> </div> <div id="right"> <center>Administration Panel</center><br> <a href="admin_panel.php">Back to Panel</a> </div> <div id="middle"> <center><h1> Online Data </h1></center> <div id="container" style="width: 100%; height: 300px; margin: 0 auto"></div> </div> </body> </html>


Reply With Quote

Bookmarks