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

histogram and drawFilledStepChart
http://wiki.pchart.net/forum/viewtopic.php?f=1&t=29397
Page 1 of 1

Author:  psychogol [ Thu Jun 21, 2012 12:27 pm ]
Post subject:  histogram and drawFilledStepChart

Hello

I Determined the 10 intervals and have calculated values for each interval. The problem is that the labels that are the beginnings of the intervals are in the middle instead of left. This is shown in the attached image. I will be grateful for your help.

Attachments:
File comment: histogram using drawFilledStepChart
chart_problem.jpg
chart_problem.jpg [ 17.38 KiB | Viewed 6222 times ]

Author:  chartbreaker [ Thu Jun 21, 2012 10:13 pm ]
Post subject:  Re: histogram and drawFilledStepChart

without any code it is not possible to help you
perhaps causes the LabelRotation the shifting
the axis origin and the abscissa origin are not congruent (the shifting matches exact the distance between the zeros)

Author:  psychogol [ Fri Jun 22, 2012 11:38 am ]
Post subject:  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);    
   }


Attachments:
File comment: Chart I get
wykres1.jpg
wykres1.jpg [ 29.6 KiB | Viewed 6203 times ]
File comment: Chart I need
wykres2.jpg
wykres2.jpg [ 23.08 KiB | Viewed 6203 times ]

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