How to load data from JSON to Highchart?

后端 未结 4 1084
广开言路
广开言路 2021-01-15 06:35

my Json looks like this:

[{\"1332879360000.0\": 300.0, \"1332797760000.0\": 353.0,

\"1332799320000.0\": 358.0, \"1332         


        
4条回答
  •  天涯浪人
    2021-01-15 07:31

    try this

    }
    // Set the JSON header
    header("Content-type: text/json");
    
    // The x value is the current JavaScript time, which is the Unix time multiplied by       1000.
    $x = time() * 1000;
    $y = rand(0,100) ; 
    mysql_query("INSERT INTO `apak`.`mach_1` (`id`, `temp`, `date_time`) VALUES           (NULL,'".$y."', CURRENT_TIMESTAMP);") ; 
    
    
    // Create a PHP array and echo it as JSON
    $ret = array($x, $y);
    echo json_encode($ret);
    ?>
    

    now the the highchart script

    
      <  /head>
    
    

提交回复
热议问题