html - PHP data to plot -
i have 2 arrays representing x , y values don't seem in right format. want convert this:
into this:
the code used first 1 is:
$dataset2[] = array(floatval($row["x"]),intval($row["y"]));
and second 1 is:
$dataset2[] = array(($x),($y));
in second case have x , y arrays of numbers , in first case mode of obtaining them bit different, , nope, unfortunately can't values in first case in second one.
to convert use:
var dataset1 = <?php echo json_encode($dataset2); ?>;
in both cases. thanks!
try ..
var = floatval($row["x"]); var b = intval($row["y"]); for(var = 0; < a.length; i++){ $dataset2[] = array(a[i],b[i]); }
Comments
Post a Comment