Home Forums Chart Support How to create a line Graph with two lines Reply To: How to create a line Graph with two lines

#15497

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 6 years, 8 months ago by pieter.