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