CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
SVG::TT::Graph::Line;

 



artperl
Novice

Apr 20, 2015, 8:27 AM

Post #1 of 6 (2405 views)
SVG::TT::Graph::Line; Can't Post

hello gurus,
i was trying to plot a trend line chart using the subject module.
everything is working except when i have more than 1000 data to plot, im getting:
Template error: undef error - WHILE loop terminated (> 1000 iterations)
i wonder if this is a limitation or if there is any workaround for me to be able to still generate the line chart with more than 1K data.


Zhris
Enthusiast

Apr 21, 2015, 5:39 PM

Post #2 of 6 (2326 views)
Re: [artperl] SVG::TT::Graph::Line; [In reply to] Can't Post

Hi,

From the template toolkit documentation:

http://www.template-toolkit.org/docs/manual/Directives.html#section_WHILE


Quote
The Template Toolkit uses a failsafe counter to prevent runaway WHILE loops which would otherwise never terminate. If the loop exceeds 1000 iterations then an undef exception will be thrown, reporting the error:

WHILE loop terminated (> 1000 iterations)

The $Template::Directive::WHILE_MAX variable controls this behaviour and can be set to a higher value if necessary.


Chris


artperl
Novice

Apr 22, 2015, 1:56 AM

Post #3 of 6 (2311 views)
Re: [Zhris] SVG::TT::Graph::Line; [In reply to] Can't Post

thanks Chris... got it!... thanks as usual for your advise.

Another question:
How do I change the color of the line graph in GD::Graph::Lines?
I tried to add black RGB(0,0,0) but can't figure out how to set/call that color to be the color of the line graph. it always uses red.

$graph->add_colour(colourname => [0, 0, 0]);
$graph->set(
transparent => '1',
bgclr => 'white',
boxclr => 'lgray',
fgclr => 'white',
x_label => 'Part ID',


Zhris
Enthusiast

Apr 22, 2015, 10:49 AM

Post #4 of 6 (2273 views)
Re: [artperl] SVG::TT::Graph::Line; [In reply to] Can't Post

Looks like you want the dclrs option ( http://search.cpan.org/dist/GDGraph/Graph.pm#Colours ). You can use colours you have added i.e. as per your snippet "colourname" refers to rgb 000.

Chris


(This post was edited by Zhris on Apr 22, 2015, 10:53 AM)


artperl
Novice

Apr 22, 2015, 6:06 PM

Post #5 of 6 (2243 views)
Re: [Zhris] SVG::TT::Graph::Line; [In reply to] Can't Post

Hi Chris,

Yes, I actually tried that:
$graph->add_colour(colourname => [0, 0, 0]);
$graph->set(
transparent => '1',
bgclr => 'white',
boxclr => 'lgray',
fgclr => 'white',
x_label => 'Part ID',
dclrs => 'colourname',

But im getting this error:
Can't use string ("colourname") as an ARRAY ref while "strict refs" in use at /usr/local/share/perl5/GD/Graph.pm line 485.

im sure im missing something else... appreciate your help...


Zhris
Enthusiast

Apr 22, 2015, 8:56 PM

Post #6 of 6 (2231 views)
Re: [artperl] SVG::TT::Graph::Line; [In reply to] Can't Post

If you look at the documentation you'll see the value of dclrs should be an array reference not a scalar. This is in order to potentially support multiple lines each of a different colour:


Quote
This controls the colours for the bars, lines, markers, or pie slices. This should be a reference to an array of colour names as defined in GD::Graph::colour (perldoc GD::Graph::colour for the names available).

Code
$graph->set( dclrs => [ qw(green pink blue cyan) ] );



Therefore you should make the following adjustment:


Code
dclrs => 'colourname',  
dclrs => [ 'colourname' ],


Chris


(This post was edited by Zhris on Apr 22, 2015, 9:00 PM)

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives