1Graph::FAQ(3) User Contributed Perl Documentation Graph::FAQ(3)
2
3
4
6 GD::Graph::FAQ - Frequently asked questions
7
9 I get errors like "Can't call method METHOD on an undefined value". What
10 gives?
11 You probably had an error somewhere, most likely in the plot() method,
12 and you didn't check for it. See the section on Error Handling in the
13 documentation for GD::Graph to find out how to deal with this sort of
14 thing, and how to get more information about what the error was.
15
16 I am drawing a bar chart, and the chart area is a lot smaller than the
17 image. What is going on?
18 As of version 1.30, GD::Graph automatically corrects the width of the
19 plotting area of a chart if it needs to draw bars (i.e. for bars and
20 some mixed charts). This is necessary, because rounding errors cause
21 irregular gaps between or overlaps of bars if the bar is not an exact
22 integer number of pixels wide.
23
24 If you want the old behaviour back, set the correct_width attribute to
25 a false value.
26
27 I have my data in some format that doesn't look at all like the array that
28 I am supposed to give to GD::Graph's plot method. Do I really need to
29 mess around with array references?
30 Not necessarily. Check out the GD::Graph::Data class.
31
32 How do I stop those pesky accents appearing around bars or inside area
33 charts?
34 You can set the "accent_treshold" option to a large enough value
35 (larger than your chart). Alternatively, you may like it better to set
36 the "borderclrs" attribute to be the same as the dclrs one.
37
38 I'll probably include an option in a future version that gives better
39 control over this.
40
41 Where is the ActiveState ppm of GD::Graph?
42 Ask them. I have asked them, but didn't get an answer. I don't know
43 what to do to get it included in their set of ppms, and I really do not
44 have the time to keep asking them.
45
46 I believe that GD::graph has finally made it into ActiveState's ppm
47 archive. However, I am going to leave this question here in case they
48 get behind again.
49
50 Do you have some example code for me?
51 The distribution has a large set of examples in it. If you don't have
52 the original distribution, please get it from CPAN
53 (http://www.cpan.org/ or some local mirror).
54
55 Will you support X or Y?
56 If you send me a patch that (in a decent manner) adds the functionality
57 to the latest version, I may very well add it for the next release. If
58 you don't send me a patch, but just a question, you will have to be
59 patient. (Please also see the section on bugs in the main body of
60 GD::Graph.)
61
62 Why does export_format give me a weird string, instead of just 'png' or
63 'gif'?
64 As of version 1.31, export_format in a list context returns all formats
65 that GD can export. If you are only interested in the answer 'gif' or
66 'png', make sure that you call it in a scalar context.
67
68 $export_format = GD::Graph->export_format;
69 $export_format = $graph->export_format;
70 print "Export format is ", scalar $graph->export_format, "\n";
71 print "Export format is " . $graph->export_format . "\n";
72 @export_formats = $graph->export_format;
73
74 TrueType fonts don't work when I use GD::Graph from a CGI program.
75 When your programs run as CGI, they typically do not have the same
76 environment as when you use them from the command line. The Perl FAQ,
77 section 9, has some information on this. It is also not guaranteed that
78 your script runs from the directory that it is in. It is probably
79 better to include something like:
80
81 use GD::Text;
82 GD::Text->font_path("/path/to/my/font_dir");
83
84 See the GD::Text documentation for more information about font paths.
85
86 I'm trying to use GD's builtin fonts, but it's not working.
87 Most likely, you are using the font short name, like gdGiantFont or
88 gdMediumBoldFont, and you have not put a "use GD" in your program.
89 This is needed, because these short names need to be exported into your
90 name space by the GD library:
91
92 use GD;
93 # ...
94 $graph->set_x_axis_font(gdMediumBoldFont);
95
96 If you don't want to include the GD library, you can use the longer
97 alternative names (which is what I'd recommend anyway):
98
99 $graph1->set_x_axis_font(GD::Font->MediumBold);
100
101 If you "use strict" then you will actually get an error message if you
102 try to use the short names without including the GD module.
103
104 Also see the GD::Text documentation for this information.
105
106 When I have many data sets, some end up having the same colour.
107 The default number of colours for data sets is seven, so if you use
108 more than seven data sets, those colours will be re-used for the higher
109 data sets.
110
111 This is described in the entry for the "dclrs" attribute in the
112 GD::Graph documentation.
113
114 Can you tell me how to do X?
115 Not necessarily (X might be kind of complicated, after all). Did you
116 look in the samples for something similar? If not, you're probably
117 best off seeing if you can get help from a group of people, rather than
118 one or the other of the overworked individuals whose e-mail addresses
119 are shown below.
120
121 If you're more comfortable with asking a newsgroup for help, the
122 canonical resource is <comp.lang.perl.misc>; if you prefer web forums,
123 there is a good one at <http://www.perlmonks.org>.
124
125 In either case, if you are not familiar with the forum and its
126 denizens, you might wish to read the following helpful guide before
127 posting your question: http://www.perlmonks.org/?node_id=172086
128
129 Can you fix this bug I've found?
130 Well, I hope so. Please see the "BUGS" section in the main body of
131 GD::Graph for the best way to report it.
132
134 Martien Verbruggen <mgjv@tradingpost.com.au>
135
136 Current maintenance (including this release) by Benjamin Warfield
137 <bwarfield@cpan.org>
138
139 (c) Martien Verbruggen.
140
141 All rights reserved. This package is free software; you can
142 redistribute it and/or modify it under the same terms as Perl itself.
143
144
145
146perl v5.12.0 2007-04-26 Graph::FAQ(3)