CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Perl

 GD Graph module (GD::Graph::lines) & incompatible data

Print topic Send  topic

Author Message
crake
Posted: 12/22/2004, 3:06 AM

I'm using GD Graph module (GD::Graph::lines) with perl
(http://crs.ciril.fr/public/docs/perl/GD/Graph.html).

I think that I have maybe found bug or there is something weird?

If x axis data values are negative numbers and all the values are same numbers then script runs very long time with maximum cpu usage and doesn't draw image.
Why it not work?

I run script from http server.

--- cut and paste -----


#!/usr/bin/perl -w
# Change above line to point to your perl binary

use CGI ':standard';
use GD::Graph::lines;
use strict;




#############################################

# Here bug?

my @data = (['Fall 01', 'Spr 01', 'Fall 02', 'Spr 02' ], # Ok, works
[-1, -1, -1, -1]); # Why data values are not work?

# I tried with other values and works without problems:
# [-1, -2, -2, -1]); # Ok works
# [0, 0, 0, 0]); # Ok, works
# [1, 1, 1, 1]); # Ok, works

#
# If I use negative numbers and all the values are same numbers
# script runs long time with maximum cpu usage and doesn't draw image.
# Is this bug?
#
# What I can do so that my script can draw all same negative numbers to my graph?
#
#
#


##########################################################3

my $mygraph = GD::Graph::lines->new(600, 300);
$mygraph->set(
x_label => 'Semester',
y_label => 'Marks',
title => 'Grade report for a student',
y_max_value => 10,
y_min_value => -10,

# Draw datasets in 'solid', 'dashed' and 'dotted-dashed' lines
line_types => [1, 2, 4],
# Set the thickness of line
line_width => 2,
# Set colors for datasets
dclrs => ['blue'],
) or warn $mygraph->error;

$mygraph->set_legend_font(GD::gdMediumBoldFont);
$mygraph->set_legend('Exam 1');
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;

print "Content-type: image/png\n\n";
print $myimage->png;
Jan
Posted: 03/06/2005, 2:23 PM

I am currently doing my final year project at University using perl cgi.

I have used a cgi script to output data onto the web browser, but have also included code to generate a graph using gd:graph. The problem is that on submit of my form the graph appears as a string of wierd characters onto the browser window. The user input appears as text onto the browser window as specified. If I run the graph as a separate script then it outputs fine.

Your help will be much appreciated on this as there is no one at my University who knows Perl.

Many thanks


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.