php - pChart a graph for each row -
i'm new @ using pchart. take data database construct graph.
i have random number of rows , graph each row. (one row -> 1 graph). possible?
so far can graph rows in same graph.
here code:
<?php include("pchart/class/pdata.class.php"); include("pchart/class/pdraw.class.php"); include("pchart/class/pimage.class.php"); include("pchart/class/ppie.class.php"); $mydata = new pdata(); $requete = "select * `day`"; $result = mysql_query($requete, $db); while($row = mysql_fetch_array($result)){ $hour = explode(" ", $row["g1"]); $nb = $row["numb"] * 2; for($i = 0; $i < $nb; $i++){ if ($i%2 == 1){ $time[$i] = ($hour[$i])/ 60; $mydata->addpoints($time[$i],"year"); }else{ if ($hour[$i] == "00"){ $name[$i] = "on"; }elseif ($hour[$i] == "02"){ $name[$i] = "off"; } $mydata->addpoints($name[$i],"name"); } } } $mydata->setabscissa("name"); $mydata->setseriedescription("year","application a"); $mypicture = new pimage(600,300,$mydata); $mypicture->setfontproperties(array("fontname"=>"pchart/fonts/tahoma.ttf","fontsize"=>16)); $piechart = new ppie($mypicture,$mydata); $piechart->draw3dpie(340,125,array("drawlabels"=>true,"border"=>true)); $mypicture->autooutput("images/example.png"); ?>
if understand question want picture every row ? in case think have include lower part of code (starting $mydata $mypicture )in while lus.
Comments
Post a Comment