View unanswered posts | View active topics It is currently Fri Mar 29, 2024 5:20 am



Reply to topic  [ 1 post ] 
REQ HELP: MYSQL and VOID values 
Author Message
New pChart user
New pChart user

Joined: Sat Mar 24, 2012 11:13 am
Posts: 1
Post REQ HELP: MYSQL and VOID values
Hi all,

I have a SQL connection with pchart. In the array are values entered as VOID. The problem is that the chart doesn't ignore the VOID values but displays them which screws up my graphs. Do you have any tips for my code?

$Requete = "SELECT * FROM `circuits` WHERE race < 20";
$Result = mysql_query($Requete,$db);
while($row = mysql_fetch_array($Result))
{
/* Save the data in the pData array */
$myData->addPoints($row["t1_puntc1_g"],"Coureur 1");
$myData->addPoints($row["t1_puntc2_g"],"Coureur 2");
$myData->addPoints($row["t1_puntchassis_g"],"Chassis");
$myData->addPoints($row["t1_puntmotor_g"],"Motor");
}
//$myData->setSerieTicks("Probe 2",4);
//$myData->setSerieWeight("Probe 3",2);
$myData->addPoints(array("1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20"),"Labels");
$myData->setSerieDescription("Labels","Months");
$myData->setAbscissa("Labels");

/* First Y axis will be dedicated to the temperatures */
$myData->setAxisName(0,"Punten");
$myData->setAxisUnit(0,"");

/* Create the pChart object */
$myPicture = new pImage(500,230,$myData);

/* Draw the background */
$Settings = array("R"=>204,"G"=>204,"B"=>204,"Alpha"=>40);
$myPicture->drawFilledRectangle(0,0,500,230,$Settings);

/* Turn of Antialiasing */
$myPicture->Antialias = false;

/* Add a border to the picture */
$myPicture->drawRectangle(0,0,499,229,array("R"=>0,"G"=>0,"B"=>0));

/* Write the chart title */
$myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>11));
$myPicture->drawText(25,20,"Teamname",array("FontSize"=>12,"Align"=>TEXT_ALIGN_MIDDLELEFT));

/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>"fonts/verdana.ttf","FontSize"=>6));

/* Define the chart area */
$myPicture->setGraphArea(40,40,475,200);

/* Draw the scale */
$myPicture->drawScale();

/* Turn on Antialiasing */
$myPicture->Antialias = TRUE;

/* Draw the line chart */
$myPicture->drawLineChart(array("DisplayValues"=>TRUE));

/* Write the chart legend */
$myPicture->drawLegend(280,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));


/* Render the picture (choose the best way) */
$myPicture->autoOutput("test.png");

?>


Sat Mar 24, 2012 11:16 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 1 post ] 

Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron