Debian Codegraph @

lib/Chart/Manual/Workflows.pod

raw
1
2 =encoding UTF-8
3
4 =head1 NAME
5
6 Chart::Manual::Workflows - different ways to create charts
7
8 =head1 OVERVIEW
9
10 Four of the five major steps in creating a chart image are fixed in their
11 order. First you have to L<load the module|/"use Chart">, secondly
12 L<create|Chart::Manual::Methods/new> create the object. After that you
13 may change some L<properties|Chart::Manual::Properties>.
14 And always as a last step you L<create the image|/"create image">,
15 no matter if the output goes to STDOUT or into a file.
16
17 The only flexibility lies in how you prefer to provide the data.
18 And here you have three options. Most commonly you
19 L<add one data set|Chart::Manual::Methods/add_dataset> at the time,
20 which could be also understood as a row of the complete data table.
21 Second option is to build the table
22 L<column by column|Chart::Manual::Methods/add_pt>. Thirdly you can
23 drop the complete table L<at once|/"drop data">, either by reference to
24 a data structure or L<a file|/"data files"> containing the data.
25 The last option is closed if you already given the object data.
26 It is not advisable to reuse a chart object for further image creation
27 outside of modern art projects.
28
29 =head1 STEPS
30
31 Most steps are already explained elsewhere and the OVERVIEW just links
32 there. The missing bits are layed out here.
33
34 =head2 use Chart
35
36 As with any other Modul you have to:
37
38 use Chart::[Type];
39
40 Type being a placeholder for a name of a chart type, which are:
41 Bars, Composite, Direction, ErrorBars, HorizontalBars, Lines, LinesPoints,
42 Mountain, Pareto, Pie, Points, Split, StackedBars. To know more about them
43 read L<Chart::Manual::Types>.
44
45 Alternatively write to load all chart types at ones with
46
47 use Chart;
48
49 Both are not importing any symbols in your name space but load L<Carp>
50 and L<GD>.
51
52 =head2 drop data
53
54 All the methods listed in the L<last section|/"create image">,
55 that create the final image, take as an optional, second argument data.
56 This data may be delivered either as a reference to an array of arrays:
57
58 my $data = [ [ 1, 4, 3 ... ], # data set 0
59 [ 5, 8, 2 ... ], # data set 1
60 ...
61 ];
62 $graph->png( 'file.png', $data );
63
64 or in form of a file. Then the argument has to be a file name or a
65 file handle (old school as in C<FILE> or modern as in C<$FH>).
66 Alternatively use the method L<add_datafile|Chart::Manual::Methods/add_datafile>.
67
68 =head2 data files
69
70 Are arbitrary named text files containing one or several rows of numbers,
71 which have to be separated by spaces or tabs (\t) (mixing allowed).
72 Perl style comments or empty lines will be ignored, but rows containing
73 different amount of numbers will cause problems.
74
75 =head2 create image
76
77 Currently we support only images in the PNG and JPEG format. The methods
78 to create them are named straight forwardly:
79 -E<gt>L<png|Chart::Manual::Methods/png> and
80 -E<gt>L<jpeg|Chart::Manual::Methods/jpeg>. Both take the same
81 arguments and produce image files. For shell scripting or web programming
82 you need the image binary, which you get with:
83 -E<gt>L<cgi_png|Chart::Manual::Methods/cgi_png> or
84 -E<gt>L<cgi_jpeg|Chart::Manual::Methods/cgi_jpeg>. Some users
85 might even want the L<GD> object for further processing by your perl
86 programm. In that case please use:
87 -E<gt>L<scalar_png|Chart::Manual::Methods/scalar_png> or
88 -E<gt>L<scalar_jpeg|Chart::Manual::Methods/scalar_jpeg>.
89
90 After having created a chart for web purposes, you also might want to
91 utilize L<imagemap_dump|Chart::Manual::Methods/imagemap_dump>.
92
93 =head1 COPYRIGHT & LICENSE
94
95 Copyright 2022 Herbert Breunung.
96
97 This program is free software; you can redistribute it and/or modify it
98 under same terms as Perl itself.
99
100 =head1 AUTHOR
101
102 Herbert Breunung, <[email protected]>
103
104
105 =cut