Highcharts Gauge(车速表)如何指向。更新PHP值

时间:2015-01-06 00:46:25

标签: javascript php highcharts parsefloat

我正在尝试使用var point更新PHP recourd数据字段。这是我的PHP代码:

  $query_Recordset1 = "SELECT * FROM table";
  $Recordset1 = mysql_query($query_Recordset1, $egrid) or die(mysql_error());
  $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($Recordset1);
  $Peak = mysql_result($Recordset1 ,0,"Peak");
  print $Peak;

PHP脚本确实有效,但是当我尝试将其插入我的.js文档时,没有任何反应。这是我的javascript:

    series: [{
        name: 'Peak Average',
        data: [18000],  //interval update in Add some life
        tooltip: {
            valueSuffix: ' Peak'
        }
    }]

},
 // Add some life
 function(chart) {
  setInterval(
     function() {
        var point = chart.series[0].points[0], newVal;
        $.get("peak.php", function(newVal) {
                console.log(newVal, typeof newVal);
                point.update(parseFloat(newVal));
        });
     }    
  ,5000);
 });

我甚至尝试根据字符串与数字进行调整:

  point.update(newVal);

请帮助。

0 个答案:

没有答案