Ask a Question related to PERL Modules, Design and Development.
-
deepak p #1
Request for help in using GD::Graph module (y label and undef related)
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…")
[url]http://wdvl.internet.com/Authoring/Languages/Perl/Weave/chart1-3.html[/url]
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
deepak p Guest
-
Graph.0.69 Module---how to get a DAG from graph with cycles
Here I use an example to illustrate the problem I met when using Graph Theory Module: I have a directed graph looks like the following (see the... -
Do we need Graph::Clique module?
Hi, I am planning to implement an extension to Greg Bacon's implementation on clique reduction in a graph: ... -
Perl GD::Graph module: bug?
While producing HTML Image MAP for the graph, I have found that th first line in linespoints graph type has suspicious coordinates o first line in... -
Recommend/survey graph, chart module space?
While looking for a chart module, I see a very large number to choose from. Is there a pointer to a guide, or do folks have recommendations, on... -
Proposed new module Graph::Timeline
I am currently looking to create a Graph::Timeline module (similar in some respects to Image::Timeline) that would allow rendering timelines as... -
deepak p #2
Request for help in using GD::Graph module (y label and undef related)
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…")
[url]http://wdvl.internet.com/Authoring/Languages/Perl/Weave/chart1-3.html[/url]
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
deepak p Guest
-
Martien Verbruggen #3
Re: Request for help in using GD::Graph module (y label and undef related)
On 9 Jul 2003 20:20:58 -0700,
deepak p <deepak10000@hotmail.com> wrote:
Looks like your text is, for some reason or other, also being rotated by> 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.
180 degrees. None of this happens for me. In fact, samples 14 and 71 in
the distribution do exactly this, without problems. Could you check
those examples in the distribution, just to see whether they do the same
thing?
If not, could you post (or email me) the full code for a program, as
small as possible, that displays the problem, together with its data
set? Could you also include the versions of GD, GD::Graph and GD::Text
you use? Run the following to find out:
#!/usr/local/bin/perl
use GD;
use GD::Text;
use GD::Graph;
print "GD: $GD::VERSION\n";
print "GD::Text: $GD::Text::VERSION\n";
print "GD::Graph: $GD::Graph::VERSION\n";
print "Perl: $]\n";
Alternatively, you can run 'make info' in the samples directory of a
recent GD::Graph distribution.
It's puzzling me as well, which is why I'd like that information above,> 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.
so I can see whether there's some problem with GD::graph or something
else.
That's on my todo list.> 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
Ok.. Could you also include the version numbers of GD and GD::Text? And> 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).
if you know which libgd and which freetype GD were linked against, that
could also help. There used to be some bugs in the freetype library
that entirely screwed up rotations. This happened several times.
I'd actually say that that is the most likely cause, without knowing
more.
Martien
--
|
Martien Verbruggen | prepBut nI vrbLike adjHungarian! qWhat's
| artThe adjBig nProblem? -- Alec Flett
|
Martien Verbruggen Guest
-
Martien Verbruggen #4
Re: Request for help in using GD::Graph module (y label and undef related)
On 9 Jul 2003 20:20:58 -0700,
deepak p <deepak10000@hotmail.com> wrote:
Looks like your text is, for some reason or other, also being rotated by> 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.
180 degrees. None of this happens for me. In fact, samples 14 and 71 in
the distribution do exactly this, without problems. Could you check
those examples in the distribution, just to see whether they do the same
thing?
If not, could you post (or email me) the full code for a program, as
small as possible, that displays the problem, together with its data
set? Could you also include the versions of GD, GD::Graph and GD::Text
you use? Run the following to find out:
#!/usr/local/bin/perl
use GD;
use GD::Text;
use GD::Graph;
print "GD: $GD::VERSION\n";
print "GD::Text: $GD::Text::VERSION\n";
print "GD::Graph: $GD::Graph::VERSION\n";
print "Perl: $]\n";
Alternatively, you can run 'make info' in the samples directory of a
recent GD::Graph distribution.
It's puzzling me as well, which is why I'd like that information above,> 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.
so I can see whether there's some problem with GD::graph or something
else.
That's on my todo list.> 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
Ok.. Could you also include the version numbers of GD and GD::Text? And> 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).
if you know which libgd and which freetype GD were linked against, that
could also help. There used to be some bugs in the freetype library
that entirely screwed up rotations. This happened several times.
I'd actually say that that is the most likely cause, without knowing
more.
Martien
--
|
Martien Verbruggen | prepBut nI vrbLike adjHungarian! qWhat's
| artThe adjBig nProblem? -- Alec Flett
|
Martien Verbruggen Guest



Reply With Quote

