1SVG::TT::Graph::HeatMapU(s3e)r Contributed Perl DocumentaStViGo:n:TT::Graph::HeatMap(3)
2
3
4

NAME

6       SVG::TT::Graph::HeatMap - Create presentation quality SVG HeatMap graph
7       of XYZ data points easily
8

SYNOPSIS

10         use SVG::TT::Graph::HeatMap;
11
12         my @data_cpu = (
13                          {  x        => x_point1,
14                             y_point1 => 10,
15                             y_point2 => 200,
16                             y_point3 => 1000,
17                          },
18                          {  x        => x_point2,
19                             y_point1 => 100,
20                             y_point2 => 400,
21                             y_point3 => 500,
22                          },
23                          {  x        => x_point3,
24                             y_point1 => 1000,
25                             y_point2 => 600,
26                             y_point3 => 0,
27                          },
28                        );
29
30         my $graph = SVG::TT::Graph::HeatMap->new(
31                                                   { block_height => 24,
32                                                     block_width  => 24,
33                                                     gutter_width => 1,
34                                                   } );
35
36         $graph->add_data(
37                           { 'data'  => \@data_cpu,
38                             'title' => 'CPU',
39                           } );
40
41         print "Content-type: image/svg+xml\n\n";
42         print $graph->burn();
43

DESCRIPTION

45       This object aims to allow you to easily create high quality SVG HeatMap
46       graphs of XYZ data. You can either use the default style sheet or
47       supply your own.
48
49       Please note, the height and width of the final image is computed from
50       the size of the labels, block_height/block_with and gutter_size.
51

METHODS

53   new()
54         use SVG::TT::Graph::HeatMap;
55
56         my $graph = SVG::TT::Graph::HeatMap->new({
57
58           # Optional - defaults shown
59           block_height => 24,
60           block_width  => 24,
61           gutter_width => 1,
62
63           'y_axis_order' => [],
64         });
65
66       The constructor takes a hash reference with values defaulted to those
67       shown above - with the exception of style_sheet which defaults to using
68       the internal style sheet.
69
70   add_data()
71         my @data_cpu = (
72                          {  x        => x_point1,
73                             y_point1 => 10,
74                             y_point2 => 200,
75                             y_point3 => 1000,
76                          },
77                          {  x        => x_point2,
78                             y_point1 => 100,
79                             y_point2 => 400,
80                             y_point3 => 500,
81                          },
82                          {  x        => x_point3,
83                             y_point1 => 1000,
84                             y_point2 => 600,
85                             y_point3 => 0,
86                          },
87                        );
88         or
89
90          my @data_cpu = ( ['x',        'y_point1', 'y_point2', 'y_point3'],
91                        ['x_point1', 10,         200,        5],
92                        ['x_point2', 100,        400,        1000],
93                        ['x_point3', 1000,       600,        0],
94                      );
95
96         $graph->add_data({
97           'data' => \@data_cpu,
98           'title' => 'CPU',
99         });
100
101       This method allows you to add data to the graph object.  The data are
102       expected to be either a array of hashes or as a 2D matrix (array of
103       arrays), with the Y-axis as the first arrayref, and the X-axis values
104       in the first element of subsequent arrayrefs.
105
106   clear_data()
107         my $graph->clear_data();
108
109       This method removes all data from the object so that you can reuse it
110       to create a new graph but with the same config options.
111
112   burn()
113         print $graph->burn();
114
115       This method processes the template with the data and config which has
116       been set and returns the resulting SVG.
117
118       This method will croak unless at least one data set has been added to
119       the graph object.
120
121   config methods
122         my $value = $graph->method();
123         my $confirmed_new_value = $graph->method($value);
124
125       The following is a list of the methods which are available to change
126       the config of the graph object after it has been created.
127
128       compress()
129           Whether or not to compress the content of the SVG file
130           (Compress::Zlib required).
131
132       tidy()
133           Whether or not to tidy the content of the SVG file (XML::Tidy
134           required).
135
136       block_width()
137           The width of the blocks in px.
138
139       block_height()
140           The height of the blocks in px.
141
142       gutter()
143           The space between the blocks in px.
144
145       y_axis_order()
146            This is order the columns are presented on the y-axis, if the data is in a Array of hashes,
147            this has to be set, however is the data is in an 2D matrix (array of arrays), it will use
148            the order presented in the header array.
149
150            If the data is given in a 2D matrix, and the y_axis_order is set, the y_axis_order will take
151            prescience.
152

EXAMPLES

154       For examples look at the project home page
155       http://leo.cuckoo.org/projects/SVG-TT-Graph/
156

EXPORT

158       None by default.
159

SEE ALSO

161       SVG::TT::Graph, SVG::TT::Graph::Line, SVG::TT::Graph::Bar,
162       SVG::TT::Graph::BarHorizontal, SVG::TT::Graph::BarLine,
163       SVG::TT::Graph::Pie, SVG::TT::Graph::Bubble, Compress::Zlib, XML::Tidy
164
165
166
167perl v5.30.1                      2020-02-09        SVG::TT::Graph::HeatMap(3)
Impressum