'".$datelimite."-01-01' order by date"); while($hp = $result->fetch_object()) { $date = $hp->date; $prix = $hp->prix; //while(list($date, $prix) = mysql_fetch_row($result)) { array_push($x, "$prix"); $date = transform_to_french_date($date); array_push($dates, "$date"); } @mysqli_free_result($result); @mysqli_close($link); if (count($x) > 0) { $graph = new Graph(600, 300); $graph->setAntiAliasing(TRUE); $plot = new LinePlot($x); // Change component padding $plot->setPadding(10, NULL, NULL, NULL); // Change component space $plot->setSpace(5, 5, 5, 5); // Set a background color $plot->setBackgroundColor( new Color(237, 243, 251) ); // Change grid background color $plot->grid->setBackgroundColor( new Color(187, 208, 240, 216) ); // Hide grid $plot->grid->hide(TRUE); // Hide labels on Y axis $plot->yAxis->label->hide(TRUE); $plot->xAxis->setLabelText($dates); $plot->label->set($x); $plot->label->setFormat('%.1f'); $plot->label->setBackgroundColor(new Color(240, 240, 240, 15)); $plot->label->border->setColor(new Color(255, 0, 0, 15)); $plot->label->setPadding(5, 3, 1, 1); $plot->xAxis->label->move(0, 5); $plot->xAxis->label->setBackgroundColor(new Color(240, 240, 240, 15)); $plot->xAxis->label->border->setColor(new Color(0, 150, 0, 15)); $plot->xAxis->label->setPadding(5, 3, 1, 1); $graph->add($plot); $graph->draw(); }else{ header("Content-type: image/gif"); readfile('/home/sous-la-mer/public_html/imagec.gif'); } function transform_to_french_date($echeance){ $year= substr($echeance,0,4); $monthString=substr($echeance,5,2); $dayString=substr($echeance,8,2); $date_fin = "$dayString/$monthString/$year"; return $date_fin; } ?>