Max image width?

TeeChart for PHP
Post Reply
rustydiver
Newbie
Newbie
Posts: 22
Joined: Tue Apr 30, 2013 12:00 am

Max image width?

Post by rustydiver » Sun May 05, 2013 5:58 pm

It seems that specifying an image width greater than 5800px results in GD memory crash. Wide images are necessary for scrolling very long line graphs with thousands of data points and an x axis running from zero to over 40,000 (feet).

a) Is TeeChart restricting image width?
b) If so, can that be increased?

Yeray
Site Admin
Site Admin
Posts: 8738
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Max image width?

Post by Yeray » Thu May 09, 2013 9:53 am

Hello,

Please, try to arrange a simple example project we can run as-is to reproduce the problem here.
Also, pleas specify what exact TeeChart build are you using.

Thanks in advance.
rustydiver wrote:a) Is TeeChart restricting image width?
b) If so, can that be increased?
We could increase the memory allocate but we'd like to study alternatives if we could get the example mentioned above.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

rustydiver
Newbie
Newbie
Posts: 22
Joined: Tue Apr 30, 2013 12:00 am

Re: Max image width?

Post by rustydiver » Thu May 09, 2013 1:49 pm

This is the version..
==========================================================

Release Notes Notes 16th Nov 2012
Build 2012.10.08.001
----------------------------------------------------------


Code below is straight from your examples at demos/Features Chart Styles>Standard>Line 2D. I can make the image up to about 6050x600 px, at 6100x600 px it will error out with this..

Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 24400 bytes) in C:\xampp\htdocs\CPDT\CPDT\charts\sources\GraphicsGD.php on line 587

Code: Select all

$chart = new TChart(6100,600);
$chart->getAspect()->setView3D(false);
$chart->getHeader()->setText("2D Line Chart");

$chart->getAxes()->getLeft()->setMinimumOffset(10);
$chart->getAxes()->getLeft()->setMaximumOffset(10);

$chart->getAxes()->getBottom()->setMinimumOffset(10);
$chart->getAxes()->getBottom()->setMaximumOffset(10);

$line1=new Line($chart->getChart());  
$data = Array(10,50,25,175,125,200,175);
$line1->addArray($data);

$line2=new Line($chart->getChart());  
$line2->addXY(0,10);
$line2->addXY(1,15);
$line2->addXY(2,20);
$line2->addXY(3,25);                                       
$line2->addXY(10,30);

/* You can also use one of the following methods , in the case you want to 
specify a text or color for each point :

$line2->addXYColor(x,y,color)
$line2->addXYText(x,y,text)
$line2->addXYTextColor(x,y,text,color)
*/


$line3=new Line($chart->getChart());  
$data = Array(200,175,175,100,65,110,90);
$line3->addArray($data);

foreach ($chart->getSeries() as $serie) {
  $pointer = $serie->getPointer();
  $pointer->setVisible(true);
  $pointer->getPen()->setVisible(false);
  $pointer->setHorizSize(3);
  $pointer->setVertSize(3);  
  
  $marks = $serie->getMarks();
  $marks->setVisible(true);
  $marks->setArrowLength(5);
  $marks->getArrow()->setVisible(false);
  $marks->setTransparent(true);  
}

$line1->getPointer()->setStyle(PointerStyle::$CIRCLE);
$line2->getPointer()->setStyle(PointerStyle::$TRIANGLE);

$line2->getLinePen()->setStyle(DashStyle::$DASH);

$chart->render("chart1.png");
$rand=rand();
print '<font face="Verdana" size="2">Line 2D Style<p>';
print '<img src="chart1.png?rand='.$rand.'">';
My actual code has more information and much greater y and x values, but the image size restriction is still pretty close to the same as your simple example chart. So it is not an issue of stretching the x axis or anything. As stated previously, if you have an x axis in feet running 8 miles or more and y values every 5 feet or so, you need a good image width to scroll for any detail or you are just looking at a scrunched accordian.

If you change the class file from imagecreatetruecolor to just imagecreate, you can get a little bit wider, but other things like color in any band coloring may go to gray, etc.

rustydiver
Newbie
Newbie
Posts: 22
Joined: Tue Apr 30, 2013 12:00 am

Re: Max image width?

Post by rustydiver » Fri May 10, 2013 4:52 am

An increase to 128M in TChart.php will yield 10,000x600 px (far as I tested to because that is about what I need). I'll let you know if it catches fire.

Pep
Site Admin
Site Admin
Posts: 3169
Joined: Fri Nov 14, 2003 5:00 am
Contact:

Re: Max image width?

Post by Pep » Thu May 23, 2013 2:55 pm

Hello,

related with the other post. I'll back with fixed sources.

Post Reply