[svn-upgrade] Integrating new upstream version, libchart-clicker-perl (2.62)
Jonathan Yu
14 years ago
0 | 0 | Revision history for Perl extension Chart::Clicker. |
1 | ||
2 | 2.62 | |
3 | - More POD fixes | |
4 | ||
5 | 2.61 | |
6 | - Add bar_width attribute to Bar and StackedBar renderers for choosing your | |
7 | own bar width. | |
8 | - Remove unnecessary type declaration from Axis | |
9 | - POD errors (spotted by Ricardo Signes) | |
10 | - Add POD 'whatis' entries (RT #56287, Jonathan Yu) | |
11 | - Update README (RT #56396, Jonathan Yu) | |
12 | - Add missing dependency on Test::Exception (RT #56398, Jonathan Yu) | |
1 | 13 | |
2 | 14 | 2.60 March 20, 2010 |
3 | 15 | - Add gradient_reverse attribute to Pie renderer for reverse the |
6 | 6 | example/heatmap.pl |
7 | 7 | example/line-and-shape.pl |
8 | 8 | example/line.pl |
9 | example/markers.pl | |
10 | 9 | example/multiple-axes.pl |
11 | 10 | example/multiple-renderers.pl |
12 | 11 | example/overaxis-bar.pl |
3 | 3 | - 'Cory G Watson <gphat@cpan.org>' |
4 | 4 | build_requires: |
5 | 5 | ExtUtils::MakeMaker: 6.42 |
6 | Test::Exception: 0 | |
6 | 7 | configure_requires: |
7 | 8 | ExtUtils::MakeMaker: 6.42 |
8 | 9 | distribution_type: module |
37 | 38 | resources: |
38 | 39 | license: http://dev.perl.org/licenses/ |
39 | 40 | repository: http://github.com/gphat/chart-clicker |
40 | version: 2.60 | |
41 | version: 2.62 |
1 | 1 | |
2 | 2 | name 'Chart-Clicker'; |
3 | 3 | all_from 'lib/Chart/Clicker.pm'; |
4 | ||
5 | test_requires 'Test::Exception'; | |
4 | 6 | |
5 | 7 | requires 'Color::Scheme' => '1.02'; |
6 | 8 | requires 'Moose' => '0.76'; |
17 | 19 | requires 'Layout::Manager' => '0.31'; |
18 | 20 | requires 'Math::Gradient' => '0.04'; |
19 | 21 | |
20 | ||
21 | ||
22 | 22 | recommends 'Statistics::Basic' => 0; |
23 | 23 | |
24 | 24 | repository 'http://github.com/gphat/chart-clicker'; |
0 | Chart::Clicker | |
1 | ================== | |
2 | ||
3 | The README is used to introduce the module and provide instructions on | |
4 | how to install the module, any machine dependencies it may have (for | |
5 | example C compilers and installed libraries) and any other information | |
6 | that should be provided before the module is installed. | |
7 | ||
8 | A README file is required for CPAN modules since CPAN extracts the | |
9 | README file from a module distribution so that people browsing the | |
10 | archive can use it get an idea of the modules uses. It is usually a | |
11 | good idea to provide version information here so that people can | |
12 | decide whether fixes for the module are worth downloading. | |
13 | ||
14 | INSTALLATION | |
15 | ||
16 | To install this module type the following: | |
17 | ||
18 | perl Makefile.PL | |
19 | make | |
20 | make test | |
21 | make install | |
22 | ||
23 | DEPENDENCIES | |
24 | ||
25 | This module requires these other modules and libraries: | |
26 | ||
27 | blah blah blah | |
28 | ||
29 | COPYRIGHT AND LICENCE | |
30 | ||
31 | Put the correct copyright and licence information here. | |
32 | ||
33 | Copyright (C) 2007 by gphat | |
34 | ||
35 | This library is free software; you can redistribute it and/or modify | |
36 | it under the same terms as Perl itself, either Perl version 5.8.6 or, | |
37 | at your option, any later version of Perl 5 you may have available. | |
38 | ||
39 | ||
0 | NAME | |
1 | Chart::Clicker - Powerful, extensible charting. | |
2 | ||
3 | SYNOPSIS | |
4 | use Chart::Clicker; | |
5 | ||
6 | my $cc = Chart::Clicker->new; | |
7 | ||
8 | my @values = (42, 25, 86, 23, 2, 19, 103, 12, 54, 9); | |
9 | $cc->add_data('Sales', \@values); | |
10 | ||
11 | # alternately, you can add data one bit at a time... | |
12 | foreach my $v (@values) { | |
13 | $cc->add_data('Sales', $v); | |
14 | } | |
15 | ||
16 | # Or, if you want to specify the keys you can use a hashref | |
17 | my $data = { 12 => 123, 13 => 341, 14 => 1241 }; | |
18 | $cc->add_data('Sales', $data); | |
19 | ||
20 | $cc->write_output('foo.png'); | |
21 | ||
22 | DESCRIPTION | |
23 | Chart::Clicker aims to be a powerful, extensible charting package that | |
24 | creates really pretty output. Charts can be saved in png, svg, pdf and | |
25 | postscript format. | |
26 | ||
27 | Clicker leverages the power of Graphics::Primitive to create snazzy | |
28 | graphics without being tied to specific backend. You may want to begin | |
29 | with Chart::Clicker::Tutorial. | |
30 | ||
31 | For code examples see the examples repository on GitHub: | |
32 | <http://github.com/gphat/chart-clicker-examples/> | |
33 | ||
34 | FEATURES | |
35 | Renderers | |
36 | Clicker supports the following renderers: | |
37 | ||
38 | Line | |
39 | StackedLine | |
40 | Bar | |
41 | StackedBar | |
42 | Area | |
43 | StackedArea | |
44 | Bubble | |
45 | CandleStick | |
46 | Point | |
47 | Pie | |
48 | PolarArea | |
49 | ||
50 | ADDING DATA | |
51 | The synopsis shows the simple way to add data. | |
52 | ||
53 | my @values = (42, 25, 86, 23, 2, 19, 103, 12, 54, 9); | |
54 | foreach my $v (@values) { | |
55 | $cc->add_data('Sales', $v); | |
56 | } | |
57 | ||
58 | This is a convenience method provided to make simple cases much simpler. | |
59 | Adding multiple Series to a chart is as easy as changing the name | |
60 | argument of "add_data". Each unique first argument will result in a | |
61 | separate series. See the docs for "add_data" to learn more. | |
62 | ||
63 | If you'd like to use the more advanced features of Clicker you'll need | |
64 | to shake off this simple method and build Series & DataSets explicitly. | |
65 | ||
66 | use Chart::Clicker::Data::Series; | |
67 | use Chart::Clicker::Data::DataSet; | |
68 | ||
69 | ... | |
70 | ||
71 | my $series = Chart::Clicker::Data::Series->new( | |
72 | keys => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], | |
73 | values => [ 42, 25, 86, 23, 2, 19, 103, 12, 54, 9 ], | |
74 | ); | |
75 | ||
76 | my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series ]); | |
77 | ||
78 | $cc->add_to_datasets($ds); | |
79 | ||
80 | This used to be the only way to add data, but repeated requests to make | |
81 | the common case easier resulted in the inclusion of "add_data". | |
82 | ||
83 | COOKBOOK | |
84 | Check the cookbook at <http://www.onemogin.com/clicker/cookbook> | |
85 | ||
86 | CONTEXTS | |
87 | The normal use case for a chart is a couple of datasets on the same | |
88 | axes. Sometimes you want to chart one or more datasets on different | |
89 | axes. A common need for this is when you are comparing two datasets of | |
90 | vastly different scale such as the number of employees in an office | |
91 | (1-10) to monthly revenues (10s of thousands). On a normal chart the | |
92 | number of employees would show up as a flat line at the bottom of the | |
93 | chart. | |
94 | ||
95 | To correct this, Clicker has contexts. A context is a pair of axes, a | |
96 | renderer and a name. The name is the 'key' by which you will refer to | |
97 | the context. | |
98 | ||
99 | my $context = Chart::Clicker::Context->new( name => 'sales' ); | |
100 | $clicker->add_to_contexts($context); | |
101 | ||
102 | $dataset->context('sales'); | |
103 | ||
104 | $clicker->add_to_datasets($dataset); | |
105 | ||
106 | New contexts provide a fresh domain and range axis and default to a Line | |
107 | renderer. | |
108 | ||
109 | Caveat: Clicker expects that the default context (identified by the | |
110 | string "default") will always be present. It is from this context that | |
111 | some of Clicker's internals draw their values. You should use the | |
112 | default context unless you need more than one, in which case you should | |
113 | use "default" as the base context. | |
114 | ||
115 | FORMATS & OUTPUT | |
116 | Clicker supports PNG, SVG, PDF and PostScript output. To change your | |
117 | output type, specificy it when you create your Clicker object: | |
118 | ||
119 | my $cc = Chart::Clicker->new(format => 'pdf', ...); | |
120 | # ... | |
121 | $cc->write_output('chart.pdf'); | |
122 | ||
123 | If you are looking to get a scalar of the output for use with HTTP or | |
124 | similar things, you can use: | |
125 | ||
126 | # ... make your chart | |
127 | $cc->draw; | |
128 | my $image_data = $cc->data; | |
129 | ||
130 | If you happen to be using Catalyst then take a look at | |
131 | Catalyst::View::Graphics::Primitive. | |
132 | ||
133 | ATTRIBUTES | |
134 | contexts | |
135 | Set/Get the contexts for this chart. | |
136 | ||
137 | datasets | |
138 | Get/Set the datasets for this chart. | |
139 | ||
140 | format | |
141 | Get the format for this Chart. Required in the constructor. Must be on | |
142 | of Png, Pdf, Ps or Svg. | |
143 | ||
144 | legend | |
145 | Set/Get the legend that will be used with this chart. | |
146 | ||
147 | legend_position | |
148 | The position the legend will be added. Should be one of north, south, | |
149 | east, west or center as required by Layout::Manager::Compass. | |
150 | ||
151 | grid_over | |
152 | Flag controlling if the grid is rendered over the data. Defaults to 0. | |
153 | You probably want to set the grid's background color to an alpha of 0 if | |
154 | you enable this flag. | |
155 | ||
156 | title | |
157 | Set/Get the title component for this chart. This is a | |
158 | Graphics::Primitive::TextBox, not a string. To set the title of a chart | |
159 | you should access the TextBox's "text" method. | |
160 | ||
161 | $cc->title->text('A Title!'); | |
162 | $cc->title->font->size(20); | |
163 | # etc, etc | |
164 | ||
165 | If the title has text then it is added to the chart in the position | |
166 | specified by "title_position". | |
167 | ||
168 | You should consult the documentation for Graphics::Primitive::TextBox | |
169 | for things like padding and text rotation. If you are adding it to the | |
170 | top and want some padding between it and the plot, you can: | |
171 | ||
172 | $cc->title->padding->bottom(5); | |
173 | ||
174 | title_position | |
175 | The position the title will be added. Should be one of north, south, | |
176 | east, west or center as required by Layout::Manager::Compass. | |
177 | ||
178 | Note that if no angle is set for the title then it will be changed to | |
179 | -1.5707 if the title position is east or west. | |
180 | ||
181 | METHODS | |
182 | new | |
183 | Creates a new Chart::Clicker object. If no format, width and height are | |
184 | specified then defaults of Png, 500 and 300 are chosen, respectively. | |
185 | ||
186 | add_data ($name, $data) | |
187 | Convenience method for adding data to the chart. Can be called one of | |
188 | three ways. | |
189 | ||
190 | scalar | |
191 | Passing a name and a scalar will "add" the scalar data to that | |
192 | series' data. | |
193 | ||
194 | $cc->add_data('Sales', 1234); | |
195 | $cc->add_data('Sales', 1235); | |
196 | ||
197 | This will result in a Series names 'Sales' with two values. | |
198 | ||
199 | arrayref | |
200 | Passing a name and an arrayref works much the same as the scalar | |
201 | method discussed above, but appends the supplied arrayref to the | |
202 | existing one. It may be mixed with the scalar method. | |
203 | ||
204 | $cc->add_data('Sales', \@some_sales); | |
205 | $cc->add_data('Sales', \@some_more_sales); | |
206 | # This works still! | |
207 | $cc->add_data('Sales', 1234); | |
208 | ||
209 | hashref | |
210 | This allows you to pass both keys and add in all at once, but it's | |
211 | an all-or-nothing thing. Subsequent calls with the same name will | |
212 | overwrite previous calls. | |
213 | ||
214 | $cc->add_data('Sales', { 2009 => 1234, 2010 => 1235 }); | |
215 | # Overwrites last call! | |
216 | $cc->add_data('Sales', { 2011 => 1234, 2012 => 1235 }); | |
217 | ||
218 | add_to_contexts | |
219 | Add the specified context to the chart. | |
220 | ||
221 | add_to_datasets | |
222 | Add the specified dataset (or arrayref of datasets) to the chart. | |
223 | ||
224 | add_to_markers | |
225 | Add the specified marker to the chart. | |
226 | ||
227 | color_allocator | |
228 | Set/Get the color_allocator for this chart. | |
229 | ||
230 | data | |
231 | Returns the data for this chart as a scalar. Suitable for 'streaming' to | |
232 | a client. | |
233 | ||
234 | draw | |
235 | Draw this chart. | |
236 | ||
237 | get_datasets_for_context | |
238 | Returns an arrayref containing all datasets for the given context. Used | |
239 | by renderers to get a list of datasets to chart. | |
240 | ||
241 | inside_width | |
242 | Get the width available in this container after taking away space for | |
243 | insets and borders. | |
244 | ||
245 | inside_height | |
246 | Get the height available in this container after taking away space for | |
247 | insets and borders. | |
248 | ||
249 | marker_overlay | |
250 | Set/Get the marker overlay object that will be used if this chart has | |
251 | markers. This is lazily constructed to save time. | |
252 | ||
253 | set_renderer ($renderer_object, [ $context ]); | |
254 | Sets the renderer on the specified context. If no context is provided | |
255 | then 'default' is assumed. | |
256 | ||
257 | write | |
258 | This method is passed through to the underlying driver. It is only | |
259 | necessary that you call this if you manually called "draw" beforehand. | |
260 | You likely want to use "write_output". | |
261 | ||
262 | write_output ($path) | |
263 | Write the chart output to the specified location. Output is written in | |
264 | the format provided to the constructor (which defaults to Png). | |
265 | Internally calls "draw" for you. If you use this method, do not call | |
266 | "draw" first! | |
267 | ||
268 | $c->write_output('/path/to/the.png'); | |
269 | ||
270 | AUTHOR | |
271 | Cory G Watson <gphat@cpan.org> | |
272 | ||
273 | CONTRIBUTORS | |
274 | Many thanks to the individuals who have contributed various bits: | |
275 | ||
276 | Ash Berlin | |
277 | ||
278 | Brian Cassidy | |
279 | ||
280 | Guillermo Roditi | |
281 | ||
282 | Torsten Schoenfeld | |
283 | ||
284 | Yuval Kogman | |
285 | ||
286 | SOURCE | |
287 | Chart::Clicker is on github: | |
288 | ||
289 | http://github.com/gphat/chart-clicker/tree/master | |
290 | ||
291 | LICENSE | |
292 | You can redistribute and/or modify this code under the same terms as | |
293 | Perl itself. | |
294 |
0 | #!/usr/bin/perl | |
1 | use strict; | |
2 | ||
3 | use Chart::Clicker; | |
4 | use Chart::Clicker::Context; | |
5 | use Chart::Clicker::Data::DataSet; | |
6 | use Chart::Clicker::Data::Marker; | |
7 | use Chart::Clicker::Data::Series; | |
8 | use Geometry::Primitive::Rectangle; | |
9 | use Graphics::Color::RGB; | |
10 | ||
11 | my $cc = Chart::Clicker->new(width => 500, height => 400); | |
12 | ||
13 | my $series1 = Chart::Clicker::Data::Series->new( | |
14 | keys => [qw(1 2 3 4 5 6 7 8 9 10 11 12)], | |
15 | values => [qw(5.8 5.0 4.9 4.8 4.5 4.25 3.5 2.9 2.5 1.8 .9 .8)] | |
16 | ); | |
17 | ||
18 | my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series1 ]); | |
19 | ||
20 | $cc->add_to_datasets($ds); | |
21 | ||
22 | my $domain_range_marker = Chart::Clicker::Data::Marker->new(key => 4, key2 => 6); | |
23 | $domain_range_marker->inside_color( | |
24 | Graphics::Color::RGB->new(red => 0, green => 0, blue => 0, alpha => .25) | |
25 | ); | |
26 | ||
27 | my $domain_marker = Chart::Clicker::Data::Marker->new(key => 7); | |
28 | $domain_marker->color( | |
29 | Graphics::Color::RGB->new(red => 1, green => 0, blue => 0) | |
30 | ); | |
31 | ||
32 | my $range_range_marker = Chart::Clicker::Data::Marker->new(value => 4, value2 => 5); | |
33 | $range_range_marker->inside_color( | |
34 | Graphics::Color::RGB->new(red => 0, green => 0, blue => 0, alpha => .25) | |
35 | ); | |
36 | ||
37 | my $range_marker = Chart::Clicker::Data::Marker->new(value => 2); | |
38 | $range_marker->color( | |
39 | Graphics::Color::RGB->new(red => 1, green => 0, blue => 0) | |
40 | ); | |
41 | ||
42 | my $defctx = $cc->get_context('default'); | |
43 | ||
44 | $defctx->add_marker($domain_range_marker); | |
45 | $defctx->add_marker($range_range_marker); | |
46 | $defctx->add_marker($range_marker); | |
47 | $defctx->add_marker($domain_marker); | |
48 | ||
49 | $cc->write_output('foo.png'); |
131 | 131 | |
132 | 132 | =head1 NAME |
133 | 133 | |
134 | Chart::Clicker::Axis::DateTime | |
134 | Chart::Clicker::Axis::DateTime - An X or Y Axis using DateTime | |
135 | 135 | |
136 | 136 | =head1 DESCRIPTION |
137 | 137 |
12 | 12 | use Layout::Manager::Absolute; |
13 | 13 | |
14 | 14 | use Math::Trig ':pi'; |
15 | ||
16 | use Moose::Util::TypeConstraints; | |
17 | ||
18 | type 'StrOrCodeRef' => where { (ref($_) eq "") || ref($_) eq 'CODE' }; | |
19 | 15 | |
20 | 16 | has 'tick_label_angle' => ( |
21 | 17 | is => 'rw', |
45 | 41 | }) |
46 | 42 | } |
47 | 43 | ); |
48 | has 'format' => ( is => 'rw', isa => 'StrOrCodeRef' ); | |
44 | has 'format' => ( is => 'rw', isa => 'Str|CodeRef' ); | |
49 | 45 | has 'fudge_amount' => ( is => 'rw', isa => 'Num', default => 0 ); |
50 | 46 | has 'hidden' => ( is => 'rw', isa => 'Bool', default => 0 ); |
51 | 47 | has 'label' => ( is => 'rw', isa => 'Str' ); |
469 | 465 | |
470 | 466 | =head1 NAME |
471 | 467 | |
472 | Chart::Clicker::Axis | |
468 | Chart::Clicker::Axis - An X or Y Axis | |
473 | 469 | |
474 | 470 | =head1 DESCRIPTION |
475 | 471 | |
551 | 547 | |
552 | 548 | =head2 orientation |
553 | 549 | |
554 | The orientation of this axis. See L<Chart::Clicker::Drawing>. | |
550 | The orientation of this axis. See L<Graphics::Primitive::Oriented>. | |
555 | 551 | |
556 | 552 | =head2 position |
557 | 553 |
18 | 18 | |
19 | 19 | =head1 NAME |
20 | 20 | |
21 | Chart::Clicker::Component | |
21 | Chart::Clicker::Component - Base class that extends Graphics::Primitive::Component | |
22 | 22 | |
23 | 23 | =head1 DESCRIPTION |
24 | 24 |
18 | 18 | |
19 | 19 | =head1 NAME |
20 | 20 | |
21 | Chart::Clicker::Container | |
21 | Chart::Clicker::Container - Base class that extends Graphics::Primitive::Container | |
22 | 22 | |
23 | 23 | =head1 DESCRIPTION |
24 | 24 |
62 | 62 | |
63 | 63 | =head1 NAME |
64 | 64 | |
65 | Chart::Clicker::Context | |
65 | Chart::Clicker::Context - A rendering context: Axes, Markers and a Renderer | |
66 | 66 | |
67 | 67 | =head1 DESCRIPTION |
68 | 68 |
96 | 96 | |
97 | 97 | =head1 NAME |
98 | 98 | |
99 | Chart::Clicker::Data::DataSet | |
99 | Chart::Clicker::Data::DataSet - A collection of series | |
100 | 100 | |
101 | 101 | =head1 DESCRIPTION |
102 | 102 |
42 | 42 | |
43 | 43 | =head1 NAME |
44 | 44 | |
45 | Chart::Clicker::Data::Marker | |
45 | Chart::Clicker::Data::Marker - Highlight arbitrary value(s) | |
46 | 46 | |
47 | 47 | =head1 DESCRIPTION |
48 | 48 |
108 | 108 | |
109 | 109 | =head1 NAME |
110 | 110 | |
111 | Chart::Clicker::Data::Range | |
111 | Chart::Clicker::Data::Range - A range of Data | |
112 | 112 | |
113 | 113 | =head1 DESCRIPTION |
114 | 114 |
59 | 59 | |
60 | 60 | =head1 NAME |
61 | 61 | |
62 | Chart::Clicker::Data::Series::HighLow | |
62 | Chart::Clicker::Data::Series::HighLow - Series data with additional attributes for High-Low charts | |
63 | 63 | |
64 | 64 | =head1 DESCRIPTION |
65 | 65 |
50 | 50 | |
51 | 51 | =head1 NAME |
52 | 52 | |
53 | Chart::Clicker::Data::Series::Size | |
53 | Chart::Clicker::Data::Series::Size - Chart data with additional attributes for Size charts | |
54 | 54 | |
55 | 55 | =head1 DESCRIPTION |
56 | 56 |
90 | 90 | |
91 | 91 | =head1 NAME |
92 | 92 | |
93 | Chart::Clicker::Data::Series | |
93 | Chart::Clicker::Data::Series - A series of key, value pairs representing chart data | |
94 | 94 | |
95 | 95 | =head1 DESCRIPTION |
96 | 96 |
52 | 52 | |
53 | 53 | =head1 NAME |
54 | 54 | |
55 | Chart::Clicker::Decoration::Glass | |
55 | Chart::Clicker::Decoration::Glass - Under-chart gradient decoration | |
56 | 56 | |
57 | 57 | =head1 DESCRIPTION |
58 | 58 |
113 | 113 | |
114 | 114 | =head1 NAME |
115 | 115 | |
116 | Chart::Clicker::Decoration::Grid | |
116 | Chart::Clicker::Decoration::Grid - Under-data grid | |
117 | 117 | |
118 | 118 | =head1 DESCRIPTION |
119 | 119 |
146 | 146 | |
147 | 147 | =head1 NAME |
148 | 148 | |
149 | Chart::Clicker::Decoration::Legend::Tabular | |
149 | Chart::Clicker::Decoration::Legend::Tabular - Tabular version of Legend | |
150 | 150 | |
151 | 151 | =head1 DESCRIPTION |
152 | 152 |
91 | 91 | |
92 | 92 | =head1 NAME |
93 | 93 | |
94 | Chart::Clicker::Decoration::Legend | |
94 | Chart::Clicker::Decoration::Legend - Series name, color key | |
95 | 95 | |
96 | 96 | =head1 DESCRIPTION |
97 | 97 |
102 | 102 | |
103 | 103 | =head1 NAME |
104 | 104 | |
105 | Chart::Clicker::Decoration::MarkerOverlay | |
105 | Chart::Clicker::Decoration::MarkerOverlay - Component for drawing markers | |
106 | 106 | |
107 | 107 | =head1 DESCRIPTION |
108 | 108 |
125 | 125 | |
126 | 126 | =head1 NAME |
127 | 127 | |
128 | Chart::Clicker::Decoration::OverAxis | |
128 | Chart::Clicker::Decoration::OverAxis - An axis drawn over data | |
129 | 129 | |
130 | 130 | =head1 DESCRIPTION |
131 | 131 |
66 | 66 | |
67 | 67 | =head1 NAME |
68 | 68 | |
69 | Chart::Clicker::Decoration::Plot | |
69 | Chart::Clicker::Decoration::Plot - Area on which renderers draw | |
70 | 70 | |
71 | 71 | =head1 DESCRIPTION |
72 | 72 |
13 | 13 | |
14 | 14 | =head1 NAME |
15 | 15 | |
16 | Chart::Clicker::Decoration | |
16 | Chart::Clicker::Decoration - Shiny baubles! | |
17 | 17 | |
18 | 18 | =head1 DESCRIPTION |
19 | 19 |
118 | 118 | |
119 | 119 | =head1 NAME |
120 | 120 | |
121 | Chart::Clicker::Drawing::ColorAllocator | |
121 | Chart::Clicker::Drawing::ColorAllocator - Color picker | |
122 | 122 | |
123 | 123 | =head1 DESCRIPTION |
124 | 124 |
132 | 132 | |
133 | 133 | =head1 NAME |
134 | 134 | |
135 | Chart::Clicker::Renderer::Area | |
135 | Chart::Clicker::Renderer::Area - Area renderer | |
136 | 136 | |
137 | 137 | =head1 DESCRIPTION |
138 | 138 |
12 | 12 | is => 'rw', |
13 | 13 | isa => 'Int', |
14 | 14 | default => 0 |
15 | ); | |
16 | has 'bar_width' => ( | |
17 | is => 'rw', | |
18 | isa => 'Num', | |
19 | predicate => 'has_bar_width' | |
15 | 20 | ); |
16 | 21 | has 'brush' => ( |
17 | 22 | is => 'rw', |
63 | 68 | my $range = $ctx->range_axis; |
64 | 69 | |
65 | 70 | my $owidth = $width - ($width * $domain->fudge_amount); |
66 | my $bwidth = int(($owidth / $self->{KEYCOUNT})) - $padding; | |
71 | my $bwidth; | |
72 | if($self->has_bar_width) { | |
73 | $bwidth = $self->bar_width; | |
74 | } else { | |
75 | $bwidth = int(($owidth / $self->{KEYCOUNT})) - $padding; | |
76 | } | |
67 | 77 | my $hbwidth = int($bwidth / 2); |
68 | 78 | |
69 | # Fudge amounts change mess up the calculation of bar widths, so | |
79 | # Fudge amounts mess up the calculation of bar widths, so | |
70 | 80 | # we compensate for them here. |
71 | 81 | my $cbwidth = $bwidth / $self->{SCOUNT}; |
72 | 82 | my $chbwidth = int($cbwidth / 2); |
164 | 174 | |
165 | 175 | =head1 NAME |
166 | 176 | |
167 | Chart::Clicker::Renderer::Bar | |
177 | Chart::Clicker::Renderer::Bar - Bar renderer | |
168 | 178 | |
169 | 179 | =head1 DESCRIPTION |
170 | 180 | |
199 | 209 | How much padding to put around a bar. A padding of 4 will result in 2 pixels |
200 | 210 | on each side. |
201 | 211 | |
212 | =head2 bar_width | |
213 | ||
214 | Allows you to override the calculation that determines the optimal width for | |
215 | bars. Be careful using this as it can making things look terrible. Note that | |
216 | this number is divided evenly between all the values in a series when charting | |
217 | multiple series. | |
218 | ||
202 | 219 | =head2 brush |
203 | 220 | |
204 | 221 | Set/Get the Brush to use around each bar. |
20 | 20 | |
21 | 21 | =head1 NAME |
22 | 22 | |
23 | Chart::Clicker::Renderer::Bubble | |
23 | Chart::Clicker::Renderer::Bubble - Bubble render | |
24 | 24 | |
25 | 25 | =head1 DESCRIPTION |
26 | 26 |
147 | 147 | |
148 | 148 | =head1 NAME |
149 | 149 | |
150 | Chart::Clicker::Renderer::CandleStick | |
150 | Chart::Clicker::Renderer::CandleStick - CandleStick renderer | |
151 | 151 | |
152 | 152 | =head1 DESCRIPTION |
153 | 153 |
181 | 181 | |
182 | 182 | =head1 NAME |
183 | 183 | |
184 | Chart::Clicker::Renderer::HeatMap | |
184 | Chart::Clicker::Renderer::HeatMap - Work In Progress | |
185 | 185 | |
186 | 186 | =head1 DESCRIPTION |
187 | 187 |
140 | 140 | |
141 | 141 | =head1 NAME |
142 | 142 | |
143 | Chart::Clicker::Renderer::Line | |
143 | Chart::Clicker::Renderer::Line - Line renderer | |
144 | 144 | |
145 | 145 | =head1 DESCRIPTION |
146 | 146 |
157 | 157 | |
158 | 158 | =head1 NAME |
159 | 159 | |
160 | Chart::Clicker::Renderer::Pie | |
160 | Chart::Clicker::Renderer::Pie - Pie renderer | |
161 | 161 | |
162 | 162 | =head1 DESCRIPTION |
163 | 163 |
92 | 92 | |
93 | 93 | =head1 NAME |
94 | 94 | |
95 | Chart::Clicker::Renderer::Point | |
95 | Chart::Clicker::Renderer::Point - Point renderer | |
96 | 96 | |
97 | 97 | =head1 DESCRIPTION |
98 | 98 | |
107 | 107 | =head1 SYNOPSIS |
108 | 108 | |
109 | 109 | my $pr = Chart::Clicker::Renderer::Point->new({ |
110 | shape => Chart::Clicker::Shape::Arc->new({ | |
110 | shape => Geometry::Primitive::Arc->new({ | |
111 | 111 | angle1 => 0, |
112 | 112 | angle2 => 180, |
113 | 113 | radius => 5 |
174 | 174 | |
175 | 175 | =head1 NAME |
176 | 176 | |
177 | Chart::Clicker::Renderer::PolarArea | |
177 | Chart::Clicker::Renderer::PolarArea - Polar Area renderer | |
178 | 178 | |
179 | 179 | =head1 DESCRIPTION |
180 | 180 |
135 | 135 | |
136 | 136 | =head1 NAME |
137 | 137 | |
138 | Chart::Clicker::Renderer::StackedArea | |
138 | Chart::Clicker::Renderer::StackedArea - Stacked Area renderer | |
139 | 139 | |
140 | 140 | =head1 DESCRIPTION |
141 | 141 |
12 | 12 | is => 'rw', |
13 | 13 | isa => 'Int', |
14 | 14 | default => 0 |
15 | ); | |
16 | has 'bar_width' => ( | |
17 | is => 'rw', | |
18 | isa => 'Num', | |
19 | predicate => 'has_bar_width' | |
15 | 20 | ); |
16 | 21 | has 'brush' => ( |
17 | 22 | is => 'rw', |
59 | 64 | my $strokewidth = $self->brush->width; |
60 | 65 | $padding += $strokewidth; |
61 | 66 | |
62 | $self->{BWIDTH} = int(($width - ($width * $domain->fudge_amount) | |
63 | - ($padding / 2 * $self->{KEYCOUNT})) / ($self->{KEYCOUNT})); | |
64 | $self->{HBWIDTH} = $self->{BWIDTH} / 2; | |
67 | my $bwidth; | |
68 | if($self->has_bar_width) { | |
69 | $bwidth = $self->bar_width; | |
70 | } else { | |
71 | $bwidth = int(($width - ($width * $domain->fudge_amount) | |
72 | - ($padding / 2 * $self->{KEYCOUNT})) / ($self->{KEYCOUNT})); | |
73 | } | |
74 | ||
75 | my $hbwidth = $bwidth / 2; | |
65 | 76 | |
66 | 77 | # Fetch all the colors we'll need. Since we build each vertical bar from |
67 | 78 | # top to bottom, we'll need to change colors vertically. |
90 | 101 | my $y = $range->mark($height, $val); |
91 | 102 | next unless defined($y); |
92 | 103 | |
93 | $self->move_to($x - $self->{HBWIDTH}, $height - $y + $self->brush->width * 2); | |
94 | $self->rectangle($self->{BWIDTH}, $y - $accum - 1); | |
104 | $self->move_to($x - $hbwidth, $height - $y + $self->brush->width * 2); | |
105 | $self->rectangle($bwidth, $y - $accum - 1); | |
95 | 106 | # Accumulate the Y value, as it dictates how much we bump up the |
96 | 107 | # next bar. |
97 | 108 | $accum += $y - $accum; |
134 | 145 | |
135 | 146 | =head1 NAME |
136 | 147 | |
137 | Chart::Clicker::Renderer::StackedBar | |
148 | Chart::Clicker::Renderer::StackedBar - Stacked Bar renderer | |
138 | 149 | |
139 | 150 | =head1 DESCRIPTION |
140 | 151 | |
157 | 168 | How much padding to put around a bar. A padding of 4 will result in 2 pixels |
158 | 169 | on each side. |
159 | 170 | |
171 | =head2 bar_width | |
172 | ||
173 | Allows you to override the calculation that determines the optimal width for | |
174 | bars. Be careful using this as it can making things look terrible. | |
175 | ||
160 | 176 | =head2 brush |
161 | 177 | |
162 | 178 | A stroke to use on each bar. |