I am trying to plot a scatter plot using highcharts.
Javascript code:
<script type='text/javascript'>
\$(function () {
var chart;
\$(document).ready(function() {
chart = new Highcharts.Chart({
chart: {
renderTo: '$div_id',
type: 'scatter',
zoomType: 'xy',
marginRight: 450,
marginBottom: 75
},
...
...
series: [{
name: 'name1',
data: $data
}]
});
});
});
</script>";
My php code:
$data_array4 = mysql_query("SELECT * from table", $link);
$ret1 = array();
while($item = mysql_fetch_array($data_array4)) {
$La = $item['L'];
$Ge = $item['G'];
$ret1[] = array($La,$Ge);
}
$data = json_encode($ret1);
My data looks like:
data: [["0.457","0.02"],["0.464","0.02"],["0.469","0.01"],["0.469","0.01"]]
The chart didn't show up because the double quotes. How can I remove them without using $data = json_encode($ret1,JSON_NUMERIC_CHECK), I am on PHP 5.2, cannot use that parameter.
Thanks!