473,398 Members | 2,427 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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 4762

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Michael Tobis | last post by:
Summary of my understanding of a recent interesting thread: General usage has "declaration" meaning "statement which does not generate executable bytecode but merely affects the compiler". My...
8
by: Stefan Burger | last post by:
Those of you who are in need for drawing vector lines might be interested in the following code. DrawLine( x1, y1, x2, y2, color ) draws a vector line from any Point x1,y1 to any Point x2,y2 in...
2
by: _andrea.l | last post by:
I'd like to draw a graph using a different pictures for each node. How can I do? I'd like to link the nodes and the arcs. There is a library for doing that? if it not exists what is the best...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
1
by: dnguyen | last post by:
Hi, I want to know what is the perl code to draw a chart in x and y by using two dimensional arrays. x from 0 to 5 y from 0 to 10 i want to draw 11 lines like this:
1
by: stbrian | last post by:
Does anyone know how I can start the line graph from the origin. The examples on the web all start from the first tick on the x-axis. Thanks.
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.