D
deepak p
Hello,
I'm writing perl scripts that utilize GD::Graph module to generate 3
types of graphs: bar, lines, linespoint and my question is specific to
this wonderful module. These 3 types of graphs are similar in that
they all have x-y axis and I'm running into difficulty in 2 areas.
1. In setting label for the ‘y axis' all 3 types of graphs, if I don't
include the method ‘set_y_label_font' in my graph generation data
structure, the y label appears as one would expect i.e. its
approximately centered in the y axis and oriented such that one would
read it bottom to top as illustrated in the URL below. (See y label –
"Revenue…")
http://wdvl.internet.com/Authoring/Languages/Perl/Weave/chart1-3.html
If however, I specify the font type and size for the y label as shown
below, the y label's orientation and placement gets messed up.
$graph->set_y_label_font('/usr/openwin/lib/X11/fonts/TrueType/CourierNew-Bold.ttf',
12);
What happens is 1) Y Label text gets automatically rotated 180 degrees
(hence, instead of it appearing from bottom to top along the y axis,
now its top to bottom). 2) Text is no longer centered along the y
axis, rather its gets shifted towards the bottom such that the last
letter of the y label ends at the start of y axis. I want to be able
to specify the y_label_font's type and size such that it does not
rotate and shift the text.
Incidentally when I specify the x_label_font, it does not mess its
orientation or placement. Why would x_label_font render fine while
y_label_font gets messed..its puzzling to me and don't know how to
fix.
2. In creating line graphs, if my data set is missing some data
points, I would expect to see breaks in the line. For example, if my
data set is as shown below
my @data = (['Jan', 'Feb', 'Mar', 'Apr', 'May', ‘Jun', ‘Jul'],
[50, 60, undef, 90, 50, undef, 80],
I would like to see a line segment connecting 50 to 60, then a break,
then a new segment connecting 90 to 50. The line graph however appears
to connect 50 to 60, then 60 to 90, then 90 to 50 and 50 to
80..ignoring the undef points. How can I specify GD::Graph::lines to
have breaks in the line segments when it encounters undefs?
I really appreciate and would like to thank in advance, if anyone can
help me overcome the difficulties. My env. if it matters is perl 5.61
running on Solaris 5.6 and we're using the latest GD::Graph module
(1.43).
Thank you for your time.
Best wishes,
Deepak
I'm writing perl scripts that utilize GD::Graph module to generate 3
types of graphs: bar, lines, linespoint and my question is specific to
this wonderful module. These 3 types of graphs are similar in that
they all have x-y axis and I'm running into difficulty in 2 areas.
1. In setting label for the ‘y axis' all 3 types of graphs, if I don't
include the method ‘set_y_label_font' in my graph generation data
structure, the y label appears as one would expect i.e. its
approximately centered in the y axis and oriented such that one would
read it bottom to top as illustrated in the URL below. (See y label –
"Revenue…")
http://wdvl.internet.com/Authoring/Languages/Perl/Weave/chart1-3.html
If however, I specify the font type and size for the y label as shown
below, the y label's orientation and placement gets messed up.
$graph->set_y_label_font('/usr/openwin/lib/X11/fonts/TrueType/CourierNew-Bold.ttf',
12);
What happens is 1) Y Label text gets automatically rotated 180 degrees
(hence, instead of it appearing from bottom to top along the y axis,
now its top to bottom). 2) Text is no longer centered along the y
axis, rather its gets shifted towards the bottom such that the last
letter of the y label ends at the start of y axis. I want to be able
to specify the y_label_font's type and size such that it does not
rotate and shift the text.
Incidentally when I specify the x_label_font, it does not mess its
orientation or placement. Why would x_label_font render fine while
y_label_font gets messed..its puzzling to me and don't know how to
fix.
2. In creating line graphs, if my data set is missing some data
points, I would expect to see breaks in the line. For example, if my
data set is as shown below
my @data = (['Jan', 'Feb', 'Mar', 'Apr', 'May', ‘Jun', ‘Jul'],
[50, 60, undef, 90, 50, undef, 80],
I would like to see a line segment connecting 50 to 60, then a break,
then a new segment connecting 90 to 50. The line graph however appears
to connect 50 to 60, then 60 to 90, then 90 to 50 and 50 to
80..ignoring the undef points. How can I specify GD::Graph::lines to
have breaks in the line segments when it encounters undefs?
I really appreciate and would like to thank in advance, if anyone can
help me overcome the difficulties. My env. if it matters is perl 5.61
running on Solaris 5.6 and we're using the latest GD::Graph module
(1.43).
Thank you for your time.
Best wishes,
Deepak