<?php   
$conexion=mysql_connect("localhost","root","movilnet2012");
mysql_select_db("datos");
$consulta="SELECT * FROM valores WHERE Critical";
$queEmp = mysql_query($consulta, $conexion);
while($Emp=mysql_fetch_assoc($queEmp)){
 /* pChart library inclusions */
 include("class/pData.class.php");
 include("class/pDraw.class.php");
 include("class/pImage.class.php");
 /* Create and populate the pData object */
 $MyData = new pData();  
 $MyData->addPoints(array($Emp['Critical'],$Emp['Critical'],$Emp['Critical'],$Emp['Critical'],$Emp['Critical'],5,3,12,15,8,5,5,3,12,15,8,5,5,3,12,15,8,5,5),"Major");
 $MyData->addPoints(array(5,3,5,12,8,3,3,10,5,12,8,3,3,10,5,12,8,3,3,10,5,12,8,3),"Critical");
 $MyData->addPoints(array(2,7,5,18,19,22,2,7,5,18,19,22,2,7,5,18,19,22,2,7,5,18,19,22),"Minor");
 $MyData->setSerieTicks("Probe 2",4);
 $MyData->setSerieWeight("Probe 3",2);
 $MyData->setAxisName(0,"Alarmas");
 $MyData->addPoints(array("00:00","01:00","02:00","03:00","04:00","05:00","06:00","07:00","08:00","09:00","10:00","11:00","12:00","13:00","14:00","15:00","16:00","17:00","18:00","19:00","20:00","21:00","22:00","23:00"),"Labels");
 $MyData->setSerieDescription("Labels","Horas");
 $MyData->setAbscissa("Labels");
 
 /* Create the pChart object */
 $myPicture = new pImage(980,230,$MyData);
 /* Turn of Antialiasing */
 $myPicture->Antialias = FALSE;
 /* Add a border to the picture */
 $myPicture->drawRectangle(0,0,980,229,array("R"=>0,"O"=>0,"B"=>0));
 
 /* Write the chart title */ 
 $myPicture->setFontProperties(array("FontName"=>"class/fonts/Forgotte.ttf","FontSize"=>11));
 $myPicture->drawText(150,35,"Estadisticas Alarmas Movilnet",array("FontSize"=>20,"Align"=>TEXT_ALIGN_BOTTOMMIDDLE));
 /* Set the default font */
 $myPicture->setFontProperties(array("FontName"=>"class/fonts/pf_arma_five.ttf","FontSize"=>6));
 /* Define the chart area */
 $myPicture->setGraphArea(60,40,980,200);
 /* Draw the scale */
 $scaleSettings = array("XMargin"=>10,"YMargin"=>10,"Floating"=>TRUE,"GridR"=>200,"GridO"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE);
 $myPicture->drawScale($scaleSettings);
 /* Turn on Antialiasing */
 $myPicture->Antialias = TRUE;
 /* Draw the line chart */
 $myPicture->drawLineChart();
 /* Write the chart legend */
 $myPicture->drawLegend(540,20,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
 /* Render the picture (choose the best way) */
 $myPicture->autoOutput("pictures/example.drawLineChart.simple.png");
   }
?>