pChart 2.x forum
http://wiki.pchart.net/forum/

REQ HELP: MYSQL and VOID values
http://wiki.pchart.net/forum/viewtopic.php?f=1&t=2540
Page 1 of 1

Author:  vbec [ Sat Mar 24, 2012 11:16 am ]
Post subject:  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");

?>

Page 1 of 1 All times are UTC
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/