<?php
include("views/class/pData.class.php");
include("views/class/pDraw.class.php");
include("views/class/pImage.class.php");
$MyData = new pData();
$res=luDigi::get('col');
$ser=luDigi::get('n');
if ($res > 0) {
/* Create and populate the pData object */
$T1e=array();
$T1=array();
while($row = mysql_fetch_array($res))
{
//$Sample_Number = $row["Sample_Number"]; //Not using this data
//$myData->addPoints($Sample_Number,"Sample_Number");
$T1e[] = $row[0];
$T1[] = $row[1];
}
}
$MyData->addPoints($T1,"countoff");
$MyData->setAxisName(0,"countoff");
$MyData->setSerieDescription("countoff","count");
$MyData->addPoints($T1e,"name");
$MyData->setAbscissa("name");
/* Create the pChart object */
$myPicture = new pImage(700,230,$MyData);
/* Turn of Antialiasing */
$myPicture->Antialias = FALSE;
/* Add a border to the picture */
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_VERTICAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>100));
$myPicture->drawGradientArea(0,0,700,230,DIRECTION_HORIZONTAL,array("StartR"=>240,"StartG"=>240,"StartB"=>240,"EndR"=>180,"EndG"=>180,"EndB"=>180,"Alpha"=>20));
$myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));
/* Set the default font */
$myPicture->setFontProperties(array("FontName"=>"views/fonts/pf_arma_five.ttf","FontSize"=>6));
/* Define the chart area */
$myPicture->setGraphArea(60,40,650,200);
/* Draw the scale */
$scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200,"DrawSubTicks"=>TRUE,"CycleBackground"=>TRUE);
$myPicture->drawScale($scaleSettings);
/* Write the chart legend */
$myPicture->drawLegend(580,12,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
/* Turn on shadow computing */
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
/* Draw the chart */
$myPicture->setShadow(TRUE,array("X"=>1,"Y"=>1,"R"=>0,"G"=>0,"B"=>0,"Alpha"=>10));
$settings = array("Surrounding"=>-30,"InnerSurrounding"=>30,"Interleave"=>0);
$myPicture->drawBarChart($settings);
/* Render the picture (choose the best way) */
//header ("Content-type: image/png" );
$myPicture->render("pictures/spacing.png");
?>
<img src="../pictures/spacing.png" />
那是一个工作程序,在这个程序中,我使用我的函数从数据库中获取数据并将其转换为 BAR-SPACING 图表。它是一个非常简单的程序。获取数据后,我使用 PCHART 函数创建条形图