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