![Post Post](./styles/avalon/imageset/icon_topic_latest.gif)
Re: histogram and drawFilledStepChart
ok, this is my simplified code:
Code:
public static function test()
{
$MyData = new pData();
//data for intervals 0-10,10-20,20-30 ... 100-x
$MyData->addPoints(array(0,0,10,12,9,6,4,1,0,0,VOID),"Data");
$MyData->setAxisName(0,"Data");
$MyData->addPoints(array('0','10','20','30','40','50','60','70','80','90','100'),"Intervals1");
$MyData->setSerieDescription("Intervals1","Intervals");
$MyData->setAbscissa("Intervals1");
$MyData->setAbscissaName("Intervals");
/* Create the pChart object */
$myPicture = new pImage(700,230,$MyData);
/* Turn of AAliasing */
$myPicture->Antialias = FALSE;
/* Draw the border */
$myPicture->drawRectangle(0,0,699,229,array("R"=>0,"G"=>0,"B"=>0));
$myPicture->setFontProperties(array("FontName"=> sfConfig::get('sf_lib_dir')."/pchart/fonts/".self::$fontname,"FontSize"=>10));
/* Define the chart area */
$myPicture->setGraphArea(60,30,650,190);
/* Draw the scale */
$scaleSettings = array("XMargin"=>0,"YMargin"=>0, "Mode" => SCALE_MODE_START0);
$myPicture->drawScale($scaleSettings);
/* Draw the step chart */
$myPicture->drawFilledStepChart();
/* Render the picture (choose the best way) */
$filename = 'histogram'.time().'.png';
$myPicture->render(self::getUploadsDir('/').$filename);
self::echoImageTag($filename, 700, 230);
}