Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: gd::graph returns unicode

by Khen1950fx (Canon)
on Jul 09, 2013 at 19:43 UTC ( #1043368=note: print w/ replies, xml ) Need Help??


in reply to gd::graph returns unicode

According to the author, the use of @data is legacy code. I rewrote it to reflect the newer usage. Note that the usual way to print is...

open(IMG, '>test.png'); binmode IMG; print IMG $gd->png;
The full script:
#!/usr/bin/perl -l use strict; use warnings; use GD::Graph::bars; use GD::Graph::Data; print "Hello world!\n"; my $data = GD::Graph::Data->new([ [1,2,3,4], [5,3,8,9], ]) or die $!; my $graph = GD::Graph::bars->new(); $graph->set( x_label => 'X num', y_label => 'Y num', title => 'Test', ) or die $graph->error; my $gd = $graph->plot($data) or die $!; open(IMG, '>test.png'); binmode IMG; print IMG $gd->png;


Comment on Re: gd::graph returns unicode
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1043368]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2015-08-01 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (285 votes), past polls