Perl GD::Graph and outputting to a graphics file


 
Thread Tools Search this Thread
Top Forums Programming Perl GD::Graph and outputting to a graphics file
# 1  
Old 12-14-2008
Perl GD::Graph and outputting to a graphics file

To successfully export a perl GD::Graph object to a graphics file (e.g. a .png file), do you do the following ?

Code:
# Set graph data

$graph->set(....);
$graph->plot(\@graph_data);
open(IMG,'>file.png') or die $!;
binmode IMG;
print IMG $graph->png;
close IMG;

Reason Im asking is because the resulting .png file cannot be opened (even with the .png viewer packages being installed)

regards
James
# 2  
Old 12-15-2008
I managed to solve the problem.

It was a case of using the 'require' keyword to include an external perl script and invoking the method contained within it in order to properly create a graphics file.

In my case Im using GDGraph-1.44_01 package, so you MUST include the following in your perl script at all times

Code:
# At the start

require '/complete path name of save.pl/save.pl


# When you want to export to a graphics file

save_chart($graph,$graph_title);

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. OS X (Apple)

[Solved] links2 --enable-graphics from source, configure error: no graphics driver found.

Howdy I am trying to install links2 with graphics support on snow leopard 10.6.8 (xcode installed). I have had the program running last year, also installed from source - but then I had installed some image libraries with mac ports and fink - cannot reproduce that setup. Plus I would like to not... (6 Replies)
Discussion started by: butterbaerchen
6 Replies

2. UNIX for Dummies Questions & Answers

Help with Plotting a graph using Perl

Dear all, I have a hash in my data file and I'd like to output the data contained within as a graph (can be lines or histogram form) but I dont know how to do this with Perl. Can somone suggest how I can have a graph with Keys of the hash being on the X-axis and the Values for the keys plotted on... (1 Reply)
Discussion started by: pawannoel
1 Replies

3. UNIX for Dummies Questions & Answers

outputting set -x to file

I need to enable set -x in my croned script as at times the script is not returning all data that it should be. This only happens intermittently and as such I would like a means of being able to check what goes wrong. My question is how to output the debug of set -x to file? (1 Reply)
Discussion started by: rob171171
1 Replies

4. Red Hat

Outputting clive --debug to file?

I am running clive on Linux version 2.6.24.5-85.fc8 (Red Hat 4.1.2-33) with the debug command as follows clive --debug -O <logfile> http://www.youtube.com/watch?v.... I need to get the contents of the debug written to file to extract data later. Using the -O option actually writes the... (0 Replies)
Discussion started by: rob171171
0 Replies

5. Shell Programming and Scripting

awk, sed, perl assistance in outputting formatted file

Hello, Please advise. Scoured this site, as well as google for answers. However if you do not know what to search for, it's a bit hard to find answers. INPUT: ACTASS= 802 BASECOS= 279 COSNCHG= 3 CUSCOS= 52 UPLDCOS= 2 DESIRED OUTPUT: ACTASS=802 BASECOS=279 (13 Replies)
Discussion started by: abacus
13 Replies

6. Shell Programming and Scripting

write a perl script or kornshell reading a two files and outputting to comma format

Hello Can someone help me to write a perl script or kornshell reading a two files and outputting to comma format. Here is the two files listofdisks.txt id, diskname, diskgroup, diskisze(GB), FC 1, CN34, GRP1, 30, FC_CN34 2, CN67, GRP5, 19, 4, VD1, GRP4, 23, FC_VD1 6, CF_D1, ... (0 Replies)
Discussion started by: deiow
0 Replies

7. Shell Programming and Scripting

outputting a text file in html

is there anyway i can paste/cat a text file into a html paragraph <p> function html_header { cat <<END <html> <head><title>${1}</title></head> <body> <p> ${2} </p> END } function html_footer { cat <<END </body> </html> END (2 Replies)
Discussion started by: magnia
2 Replies

8. Shell Programming and Scripting

Perl with Excel Graph

Hi Everyone, Would like to know some hints where should I look for, if I want to do the perl with excel graph staff, i read some people say can use GD:Graph, would please give me some guide on where should I search for, which keyword should I put into google to search. Thanks (1 Reply)
Discussion started by: jimmy_y
1 Replies

9. UNIX for Advanced & Expert Users

Installing GD Perl graphics modules

I'm on Mac OSX, I *think* I succeeded in installing libpng. I can see usr/local/lib/libpng.dylib and its brethren are in place after executing ./configure nd and the holy make install. (2 Replies)
Discussion started by: andrewduncan
2 Replies
Login or Register to Ask a Question