I thought I add some code, which is above the code given above.
$dataPoints = array();
$y = 40;
for($i = $sy; $i <= $ey; $i++){
$y += rand(0, 10) - 5;
array_push($dataPoints, array("x" => $i, "y" => $_SESSION["{$var}"][$i-$sy]));
}
if ($var=="bd")
{
$dataPoints = array();
$y = 40;
for($i = $sy; $i <= $ey; $i++){
$y += rand(0, 10) - 5;
array_push($dataPoints, array("x" => $i, "y" => $_SESSION["{$br}"][$i-$sy]));
}
$dataPoints2 = array();
$y = 40;
for($i = $sy; $i <= $ey; $i++){
$y += rand(0, 10) - 5;
array_push($dataPoints2, array("x" => $i, "y" => $_SESSION["{$dr}"][$i-$sy]));
}
}
?>
Here I fill dataPoints2. As mentioned in the OP, the code works fine for one line graphs (so if var is NOT “bd”).
-
This reply was modified 7 years, 6 months ago by pieter.