Search code examples
phpmysqljpgraph

JPGraph - PHP - MySQL - 0 value


I would like to show 2 lines in the same graph that contains datas from MySQL database. I've got FAIL and DONE results in every half an hour and I would like to show the last day results.

data_time >= now() - INTERVAL 1 DAY";

Sometimes there are NO FAILs and that's why the graph can't show the right results, because it shows datas continously and don't care about the x axis.

How can I add the x variable (where no FAIL in that time period), that show 0 in these cases ? Or how can I combine the two x axis values (hours) on the same graph ?

Thanks for your help


Solution

  • for ($i = 0; $i <= count($data)-1; $i++) {
    $k = 0;
    for ($j = 0; $j <= count($data2)-1; $j++) {
    
        if($leg[$i] == $leg2[$j]){$data3[$i] = $data2[$j]; $k++;}
        if($k==0){$data3[$i] = 'x';}
    
    }
    }