php - highcharts JSON google earth -
i show pie chart (using highcharts library) inside placemark's popup box (google earth desktop) data taken mysql database residing on live server.
the chart intended dynamic , realtime.
from research found can using json formatted data taken php script in server , sent html file pre-processed.
i put html code (highcharts.html) inside placemark popup , refers retrieve_data.php file residing in server .
the php file fetching dummy data (if access address of php script referenced inside html code can see them) seems json encoding done.
the thing how send them @ google earth placemark (or google earth placemark fetch them)....
am missing in communication server or wrong??
note: first contact json data transfer!
below files use.
thank in advance help
<!doctype html> <html lang="en">     <head>     <meta charset="utf-8" />  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>          <script>         $(document).ready(function() {             var options = {                 chart: {                     renderto: 'container',                     plotbackgroundcolor: null,                     plotborderwidth: null,                     plotshadow: false                 },                 title: {                     text: 'gjcgjcgjcgjj'                 },                 tooltip: {                     formatter: function() {                         return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';                     }                 },                 plotoptions: {                     pie: {                         allowpointselect: true,                         cursor: 'pointer',                         datalabels: {                             enabled: true,                             color: '#000000',                             connectorcolor: '#000000',                             formatter: function() {                                 return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';                             }                         }                     }                 },                 series: [{                     type: 'pie',                     name: 'browser share',                     data: []                 }]             }  <!-- maybe correct file address http://diss.web44.net/retrieve_data.php -->                 $.getjson("http://diss.web44.net/home/a1964573/public_html/retrieve_data.php", function(json) {                 options.series[0].data = json;                 chart = new highcharts.chart(options);             });            });            </script>           <script src="http://code.highcharts.com/highcharts.js"></script>         <script src="http://code.highcharts.com/modules/exporting.js"></script>     </head>      <body>         <div id="container" style="min-width: 400px; height: 400px; margin: 0 auto"></div>     </body>  </html>   ------------and php file---------
<?php  $hostname = "host"; $username = "user"; $pass     = "pass"; $db       = "awesomedb";  $connection = mysql_connect($hostname,$username,$pass);  if (!$connection)  {   die('could not connect: ' . mysql_error()); }  mysql_select_db($db, $connection);  $result = mysql_query("select sensorid,temp ccdata");  $rows = array(); while($r = mysql_fetch_array($result)) {     $row[0] = $r[0];     $row[1] = $r[1];     array_push($rows,$row); }  print json_encode($rows, json_numeric_check);  mysql_close($connection); ?>      
the problem url proper 1 (at least me): http://diss.web44.net/retrieve_data.php
and json has numbers strings, example: ["direct sales","20.00"] -> 20.00 string, while should nuber. change numbers , work fine.
Comments
Post a Comment