469,949 Members | 2,680 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,949 developers. It's quick & easy.

GD::Graph::Lines ... Controling some behavior...

I have a sample graph using GD::Graph::Lines, it's a simple X-Y line graph
(www.bitmosphere.com/cgi-bin/graph.pl) I want to change the color of the
graph border, and the tick lines (vertical and horiziontal). I can't seem
to find how to change them to: border being black, horiziontal lines being
light gray dashed, and vertical being light gray. Anyone know if this is
possible, or has done this?
Code:
#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);
use CGI ':standard';
use GD::Graph::lines;
use strict;

# Both the arrays should same number of entries.
my @data = (['v1', 'v2','v3','v4','v5'],
[30.5, 31, 31.04, 30.75, 33.01],
[29.5, 30.25, 30.25, 30.2, 30.75 ]);

my $mygraph = GD::Graph::lines->new(600, 300);
$mygraph->set(
x_label => 'X Axis',
y_label => 'Y Axis',
title => 'Chart Title',

y_tick_number => 5,
y_min_value => 29,
y_max_value => 34,
x_label_skip => 2,
long_ticks => 1,

# Draw datasets in 'solid', 'dashed' and 'dotted-dashed' lines
line_types => [1, 1],

# Set the thickness of line
line_width => 1,

# Set colors for datasets
dclrs => ['blue', 'red'],
) or warn $mygraph->error;
$mygraph->set_legend_font(GD::gdMediumBoldFont);
$mygraph->set_legend('Line Type 1', 'Line Type 2');

my $myimage = $mygraph->plot(\@data) or die $mygraph->error;

print "Context-type: image/png\n\n";
print $myimage->png;

Thanks,
Brian
Jul 19 '05 #1
0 4619

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

9 posts views Thread by Michael Tobis | last post: by
8 posts views Thread by Stefan Burger | last post: by
2 posts views Thread by _andrea.l | last post: by
1 post views Thread by stbrian | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.