Clicker.pm

filter: Statementstmt 42.4% 107 / 252 Branchbran 15.0% 12 / 80 Conditioncond 5.5% 1 / 18 MC/DCmcdc 0.0% 0 / 12 Subroutinesub 84.6% 33 / 39 Podpod 87.5% 7 / 8 totaltotal 39.1% 160 / 409 CC 56 SCAR 62.5
CC
56
Cov
34%
__ANON__
1332.0
add_data
50.0
add_subgraph
12.0
CRAP 517.5
« Clicker/Renderer/Line.pm ↑ Summary Clicker/Axis.pm »
1 package Chart::Clicker;
2 7 $Chart::Clicker::VERSION = '2.90';
3 7 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 7 extends 'Chart::Clicker::Container';
6  
7 # ABSTRACT: Powerful, extensible charting.
8  
9 7 ▶use Layout::Manager::Compass;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 7 ▶use Graphics::Color::RGB;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 7 ▶use Graphics::Primitive::Insets;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 7 ▶use Graphics::Primitive::Border;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 #use Graphics::Primitive::Driver::Cairo;
17  
18 7 ▶use Chart::Clicker::Context;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 7 ▶use Chart::Clicker::Data::DataSet;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 7 ▶use Chart::Clicker::Data::Series;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 7 ▶use Chart::Clicker::Decoration::Legend;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 7 ▶use Chart::Clicker::Decoration::MarkerOverlay;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 7 ▶use Chart::Clicker::Decoration::Plot;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 7 ▶use Chart::Clicker::Drawing::ColorAllocator;
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 7 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
28 7 ▶use Scalar::Util qw(refaddr);
Subroutine BEGIN: called CC=1 SCAR=0.0
29  
30  
31 has '+background_color' => (
32 7 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
33 7 Graphics::Color::RGB->new({ red => 1, green => 1, blue => 1, alpha => 1 })
34 }
35 7 );
36  
37  
38 has '+border' => (
39 7 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
40 7 my $b = Graphics::Primitive::Border->new;
41 7 $b->color(Graphics::Color::RGB->new(red => 0, green => 0, blue => 0));
42 7 $b->width(1);
43 7 return $b;
44 }
45 7 );
46  
47  
48 has 'color_allocator' => (
49 is => 'rw',
50 isa => 'Chart::Clicker::Drawing::ColorAllocator',
51 7 ▶ default => sub { Chart::Clicker::Drawing::ColorAllocator->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
52 7 );
53  
54  
55 has 'contexts' => (
56 traits => [ 'Hash' ],
57 is => 'rw',
58 isa => 'HashRef[Chart::Clicker::Context]',
59 7 ▶ default => sub { { default => Chart::Clicker::Context->new(name => 'default') } },
Subroutine __ANON__: called CC=1 SCAR=0.0
60 7 handles => {
61 'set_context' => 'set',
62 'get_context' => 'get',
63 'context_names' => 'keys',
64 'context_count' => 'count',
65 'delete_context' => 'delete'
66 }
67 );
68  
69 has '_data' => (
70 traits => [ 'Hash' ],
71 is => 'rw',
72 isa => 'HashRef[Str]',
73 7 ▶ default => sub { {} }
Subroutine __ANON__: called CC=1 SCAR=0.0
74 7 );
75  
76  
77 has 'datasets' => (
78 traits => [ 'Array' ],
79 is => 'rw',
80 isa => 'ArrayRef',
81 7 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
82 7 handles => {
83 'dataset_count' => 'count',
84 'add_to_datasets' => 'push',
85 'get_dataset' => 'get'
86 }
87 );
88  
89  
90 has 'driver' => (
91 is => 'rw',
92 does => 'Graphics::Primitive::Driver',
93 6 ▶ default => sub {
Subroutine __ANON__: called CC=4 SCAR=17.1
94 6 my ($self) = @_;
95 6 ▶ my $driver = $ENV{CHART_CLICKER_DEFAULT_DRIVER} || ($^O eq 'MSWin32'?"Graphics::Primitive::Driver::GD":"Graphics::Primitive::Driver::Cairo");
Branch: 1 branch
BranchTrueFalseTotal
$^O eq 'MSWin32' ? : 0 6 6
Condition33%1/3
$ENV{'CHART_CLICKER_DEFAULT_DRIVER'} || ($^O eq 'MSWin32' ? 'Graphics::Primitive::Driver::GD' : 'Graphics::Primitive::Driver::Cairo')
l!l&&r!l&&!r
060
MC/DC0%0/2
$ENV{'CHART_CLICKER_DEFAULT_DRIVER'} || ($^O eq 'MSWin32' ? 'Graphics::Primitive::Driver::GD' : 'Graphics::Primitive::Driver::Cairo')
$ENV{'CHART_CLICKER_DEFAULT_DRIVER'} ($^O eq 'MSWin32' ? 'Graphics::Primitive::Driver::GD' : 'Graphics::Primitive::Driver::Cairo')
Truth table33%1/3
A || B
A= $ENV{'CHART_CLICKER_DEFAULT_DRIVER'}B= ($^O eq 'MSWin32' ? 'Graphics::Primitive::Driver::GD' : 'Graphics::Primitive::Driver::Cairo')
ABresult
1X1
011
000
96 6 ▶ eval "require $driver;" or die "Cannot load driver $driver";
Branch: 1 branch
BranchTrueFalseTotal
eval "require $driver;" or die "Cannot load driver $driver" 0 6 6
97 0 $driver->new(
98 'format' => $self->format,
99 )
100 },
101 7 handles => {
102 rendered_data => 'data',
103 write => 'write'
104 },
105 lazy => 1
106 );
107  
108  
109 7 has 'format' => (
110 is => 'rw',
111 isa => 'Str',
112 default => 'PNG'
113 );
114  
115  
116 7 has 'plot_mode' => (
117 is => 'rw',
118 isa => 'Str',
119 default => 'slow'
120 );
121  
122  
123 7 has 'grid_over' => (
124 is => 'rw',
125 isa => 'Bool',
126 default => 0
127 );
128  
129  
130 7 has '+height' => (
131 default => 300
132 );
133  
134  
135 has '+layout_manager' => (
136 7 ▶ default => sub { Layout::Manager::Compass->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
137 7 );
138  
139  
140 has 'legend' => (
141 is => 'rw',
142 isa => 'Chart::Clicker::Decoration::Legend',
143 7 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
144 7 Chart::Clicker::Decoration::Legend->new(
145 name => 'legend',
146 );
147 }
148 7 );
149  
150  
151 7 has 'legend_position' => (
152 is => 'rw',
153 isa => 'Str',
154 default => 's'
155 );
156  
157  
158 has 'marker_overlay' => (
159 is => 'rw',
160 isa => 'Chart::Clicker::Decoration::MarkerOverlay',
161 lazy => 1,
162 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
163 0 Chart::Clicker::Decoration::MarkerOverlay->new
164 }
165 7 );
166  
167  
168 has 'over_decorations' => (
169 traits => [ 'Array' ],
170 is => 'rw',
171 isa => 'ArrayRef',
172 7 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
173 7 handles => {
174 'over_decoration_count' => 'count',
175 'add_to_over_decorations' => 'push',
176 'get_over_decoration' => 'get'
177 }
178 );
179  
180  
181 has '+padding' => (
182 7 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
183 7 Graphics::Primitive::Insets->new(
184 top => 3, bottom => 3, right => 3, left => 3
185 )
186 }
187 7 );
188  
189  
190 has 'plot' => (
191 is => 'rw',
192 isa => 'Chart::Clicker::Decoration::Plot',
193 7 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
194 7 Chart::Clicker::Decoration::Plot->new
195 }
196 7 );
197  
198  
199 has 'subgraphs' => (
200 is => 'rw',
201 isa => 'ArrayRef',
202 7 ▶ default => sub { [] },
Subroutine __ANON__: called CC=1 SCAR=0.0
203 7 predicate => 'has_subgraphs'
204 );
205  
206  
207 has 'title' => (
208 is => 'rw',
209 isa => 'Graphics::Primitive::TextBox',
210 7 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
211 7 Graphics::Primitive::TextBox->new(
212 color => Graphics::Color::RGB->new( red => 0, green => 0, blue => 0),
213 horizontal_alignment => 'center'
214 )
215 }
216 7 );
217  
218  
219 7 has 'title_position' => (
220 is => 'rw',
221 isa => 'Str',
222 default => 'n'
223 );
224  
225  
226 7 has '+width' => (
227 default => 500
228 );
229  
230  
231 2 ▶sub add_to_contexts {
Subroutine add_to_contexts: called CC=2 SCAR=7.6
Pod documented
232 2 my ($self, $ctx) = @_;
233  
234 2 ▶ if(defined($self->get_context($ctx->name))) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->get_context($ctx->name)) 0 2 2
235 0 croak("Context named '".$ctx->name."' already exists.");
236 }
237 2 $self->set_context($ctx->name, $ctx);
238 }
239  
240  
241 0 ▶sub add_subgraph {
Subroutine add_subgraph: not called CC=3 SCAR=24.8
Pod documented
242 0 my ($self, $graph) = @_;
243  
244 0 ▶ if (not ref $graph or not $graph->isa('Chart::Clicker')) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $graph and $graph->isa("Chart::Clicker")) 0 0 0
Condition0%0/3
ref $graph and $graph->isa("Chart::Clicker")
!ll&&!rl&&r
000
MC/DC0%0/2
ref $graph and $graph->isa("Chart::Clicker")
ref $graph $graph->isa("Chart::Clicker")
Truth table0%0/3
A and B
A= ref $graphB= $graph->isa("Chart::Clicker")
ABresult
0X0
100
111
245 0 die('Sub-Graphs must be Chart::Clicker objects');
246 }
247 0 push(@{$self->subgraphs}, $graph);
248 }
249  
250 0 ▶sub data {
Subroutine data: not called CC=1 SCAR=6.9
Pod undocumented
251 0 my ($self) = @_;
252 0 print STDERR "WARNING: Calling 'data' to get image data is deprecated, please use rendered_data\n";
253 0 $self->rendered_data;
254 }
255  
256  
257 6 ▶sub draw {
Subroutine draw: called CC=1 SCAR=2.6
Pod documented
258 6 my ($self) = @_;
259 6 my $driver = $self->driver;
260 0 $driver->prepare($self);
261  
262 0 $self->layout_manager->do_layout($self);
263 0 $driver->finalize($self);
264 0 $driver->draw($self);
265 }
266  
267  
268 0 ▶sub get_datasets_for_context {
Subroutine get_datasets_for_context: not called CC=3 SCAR=24.8
Pod documented
269 0 my ($self, $name) = @_;
270  
271 0 my @dses;
272 0 foreach my $ds (@{ $self->datasets }) {
273 0 ▶ if($ds->context eq $name) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ds->context eq $name) 0 0 0
274 0 push(@dses, $ds);
275 }
276 }
277  
278 0 return \@dses;
279 }
280  
281  
282 10 ▶sub add_data {
Subroutine add_data: called CC=11 SCAR=39.1
Pod documented
283 10 my ($self, $name, $data) = @_;
284  
285 10 ▶ if(ref($data) eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $data eq 'ARRAY') { } 0 10 10
elsif (ref $data eq 'HASH') { } 0 10 10
286 croak "Can't add arrayref data after adding hashrefs"
287 0 ▶ if ref($self->_data->{$name}) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->_data->{$name} eq "HASH" 0 0 0
288 0 ▶ $self->_data->{$name} = [] unless defined($self->_data->{$name});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->_data->{$name} 0 0 0
289 0 push(@{ $self->_data->{$name}}, @{ $data });
290 } elsif(ref($data) eq 'HASH') {
291 0 ▶ if (!defined $self->_data->{$name}) {
Branch: 2 branches
BranchTrueFalseTotal
if (not defined $self->_data->{$name}) { } 0 0 0
elsif (ref $self->_data->{$name} eq 'ARRAY') { } 0 0 0
292 0 $self->_data->{$name} = {};
293 } elsif (ref($self->_data->{$name}) eq 'ARRAY') {
294 0 my $old_data = $self->_data->{$name};
295 0 $self->_data->{$name} = {};
296 0 for my $i (0 .. @$old_data - 1) {
297 0 $self->_data->{$name}{$i} = $old_data->[$i];
298 }
299 }
300 0 for my $key (keys %$data) {
301 0 $self->_data->{$name}{$key} = $data->{$key};
302 }
303 } else {
304 croak "Can't add scalar data after adding hashrefs"
305 10 ▶ if ref($self->_data->{$name}) eq 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->_data->{$name} eq "HASH" 0 10 10
306 10 ▶ $self->_data->{$name} = [] unless defined($self->_data->{$name});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->_data->{$name} 1 9 10
307 10 push(@{ $self->_data->{$name}}, $data);
308 }
309 }
310  
311 0 ▶override('prepare', sub {
Subroutine __ANON__: not called CC=36 SCAR=71.9
312 0 my ($self, $driver) = @_;
313  
314 0 ▶ return if $self->prepared;
Branch: 1 branch
BranchTrueFalseTotal
if $self->prepared 0 0 0
315  
316 0 ▶ if(scalar(keys(%{ $self->_data }))) {
Branch: 1 branch
BranchTrueFalseTotal
if (scalar keys %{$self->_data;}) 0 0 0
317  
318 0 my $ds = Chart::Clicker::Data::DataSet->new;
319 0 foreach my $name (keys(%{ $self->_data })) {
320  
321 0 my $vals = $self->_data->{$name};
322  
323 0 ▶ if(ref($vals) eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $vals eq 'ARRAY') { } 0 0 0
elsif (ref $vals eq 'HASH') { } 0 0 0
324 # This allows the user to add data as an array
325  
326 $ds->add_to_series(
327 Chart::Clicker::Data::Series->new(
328 name => $name,
329 0 keys => [ 0..scalar(@{ $vals }) - 1 ],
330 values => $vals
331 )
332 );
333 } elsif(ref($vals) eq 'HASH') {
334 # This allows the user to add data as a hashref
335 0 my @keys = sort { $a <=> $b } keys %{ $vals };
336  
337 0 my @values = ();
338 0 foreach my $k (@keys) {
339 0 push(@values, $vals->{$k})
340 }
341  
342 $ds->add_to_series(
343 0 Chart::Clicker::Data::Series->new(
344 name => $name,
345 keys => \@keys,
346 values => \@values
347 )
348 );
349 }
350 }
351 0 $self->add_to_datasets($ds);
352 }
353  
354 0 ▶ unless(scalar(@{ $self->components })) {
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar @{$self->components;}) 0 0 0
355 0 $self->add_component($self->plot, 'c');
356  
357 0 my $lp = lc($self->legend_position);
358 0 ▶ if($self->legend->visible) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->legend->visible) 0 0 0
359 0 ▶ if(($lp =~ /^e/) || ($lp =~ /^w/)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($lp =~ /^e/ or $lp =~ /^w/) 0 0 0
Condition0%0/3
$lp =~ /^e/ or $lp =~ /^w/
l!l&&r!l&&!r
000
MC/DC0%0/2
$lp =~ /^e/ or $lp =~ /^w/
$lp =~ /^e/ $lp =~ /^w/
Truth table0%0/3
A or B
A= $lp =~ /^e/B= $lp =~ /^w/
ABresult
1X1
011
000
360 0 $self->legend->orientation('vertical');
361 }
362 0 $self->add_component($self->legend, $self->legend_position);
363 }
364  
365 # Add subgraphs
366 0 ▶ if($self->has_subgraphs) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_subgraphs) 0 0 0
367 0 for my $subgraph (@{$self->subgraphs}) {
368 0 $subgraph->border->width(0);
369 0 $subgraph->padding(0);
370  
371 0 $self->add_component($subgraph, 'south');
372 }
373 }
374  
375 0 ▶ if(defined($self->title->text)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->title->text) 0 0 0
376 0 my $tp = $self->title_position;
377 0 ▶ if(($tp =~ /^e/) || ($tp =~ /^w/)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($tp =~ /^e/ or $tp =~ /^w/) 0 0 0
Condition0%0/3
$tp =~ /^e/ or $tp =~ /^w/
l!l&&r!l&&!r
000
MC/DC0%0/2
$tp =~ /^e/ or $tp =~ /^w/
$tp =~ /^e/ $tp =~ /^w/
Truth table0%0/3
A or B
A= $tp =~ /^e/B= $tp =~ /^w/
ABresult
1X1
011
000
378 0 ▶ unless(defined($self->title->angle)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->title->angle) 0 0 0
379 0 $self->title->angle(-1.5707);
380 }
381 }
382 0 $self->add_component($self->title, $tp);
383 }
384 }
385  
386 0 my $plot = $self->plot;
387  
388 0 $plot->clear_components;
389 0 $plot->render_area->clear_components;
390  
391 # These two adds are here because the plot is too dependant on changes
392 # in the axes and such to trust it across multiple prepares. Putting all
393 # of this here made it easier to digest, although this has some codestink
394 # to it...
395 0 ▶ if($plot->grid->visible && !$self->grid_over) {
Branch: 1 branch
BranchTrueFalseTotal
if ($plot->grid->visible and not $self->grid_over) 0 0 0
Condition0%0/3
$plot->grid->visible and not $self->grid_over
!ll&&!rl&&r
000
MC/DC0%0/2
$plot->grid->visible and not $self->grid_over
$plot->grid->visible not $self->grid_over
Truth table0%0/3
A and not(B)
A= $plot->grid->visibleB= not $self->grid_over
ABresult
0X0
100
111
396 0 $plot->render_area->add_component($plot->grid, 'c');
397 }
398  
399 $plot->render_area->add_component(
400 0 $self->marker_overlay
401 );
402  
403 # Sentinels to control the side that the axes will be drawn on.
404 0 my $dcount = 0;
405 0 my $rcount = 0;
406 # Hashes of axes & renderers we've already seen, as we don't want to add
407 # them again...
408 0 my %xaxes;
409 my %yaxes;
410  
411 # A "seen" hash to prevent us from adding multiple renderers for the same
412 # context.
413 0 my %rends;
414  
415 0 my $dflt_ctx = $self->get_context('default');
416 0 ▶ die('Clicker must have a default context') unless defined($dflt_ctx);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $dflt_ctx 0 0 0
417  
418 # Prepare the datasets and establish ranges for the axes.
419 0 my $count = 0;
420 0 foreach my $ds (@{ $self->datasets }) {
421 0 ▶ unless($ds->count > 0) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($ds->count > 0) 0 0 0
422 0 die("Dataset $count is empty.");
423 }
424  
425 0 $ds->prepare;
426  
427 0 my $ctx = $self->get_context($ds->context);
428  
429 0 ▶ unless(defined($ctx)) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $ctx) 0 0 0
430 0 $ctx = $dflt_ctx;
431 }
432  
433 # Find our x axis and add it.
434 0 my $xaxis = $ctx->domain_axis;
435 0 ▶ unless(exists($xaxes{refaddr($xaxis)})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $xaxes{builtin::refaddr($xaxis)}) 0 0 0
436 0 $xaxis->range->combine($ds->domain);
437  
438 0 $xaxis->orientation('horizontal');
439  
440 0 ▶ if($dcount % 2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dcount % 2) { } 0 0 0
441 0 $xaxis->position('top');
442 0 $xaxis->border->bottom->width($xaxis->brush->width);
443 } else {
444 0 $xaxis->position('bottom');
445 0 $xaxis->border->top->width($xaxis->brush->width);
446 }
447 0 $xaxis->border->color($xaxis->color);
448  
449 0 ▶ $plot->add_component($xaxis, $xaxis->is_top ? 'n' : 's');
Branch: 1 branch
BranchTrueFalseTotal
$xaxis->is_top ? : 0 0 0
450 0 $xaxes{refaddr($xaxis)} = 1;
451 0 $dcount++;
452 }
453  
454 # Find our y axis and add it.
455 0 my $yaxis = $ctx->range_axis;
456 0 ▶ unless(exists($yaxes{refaddr($yaxis)})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $yaxes{builtin::refaddr($yaxis)}) 0 0 0
457 0 $yaxis->range->combine($ds->range);
458  
459 0 $yaxis->orientation('vertical');
460  
461 0 ▶ if($rcount % 2) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rcount % 2) { } 0 0 0
462 0 $yaxis->position('right');
463 0 $yaxis->border->left->width($yaxis->brush->width);
464 } else {
465 0 $yaxis->position('left');
466 0 $yaxis->border->right->width($yaxis->brush->width);
467 }
468 0 $yaxis->border->color($yaxis->color);
469  
470 0 ▶ $plot->add_component($yaxis, $yaxis->is_left ? 'w' : 'e');
Branch: 1 branch
BranchTrueFalseTotal
$yaxis->is_left ? : 0 0 0
471 0 $rcount++;
472 0 $yaxes{refaddr($yaxis)} = 1;
473 }
474  
475 0 my $rend = $ctx->renderer;
476 0 ▶ if($rend->additive) {
Branch: 1 branch
BranchTrueFalseTotal
if ($rend->additive) { } 0 0 0
477 0 $yaxis->range->upper($ds->largest_value_slice);
478 } else {
479 0 $yaxis->range->combine($ds->range);
480 }
481  
482 # Only add this renderer to the chart if we haven't seen it already.
483 0 ▶ unless(exists($rends{$ctx->name})) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $rends{$ctx->name}) 0 0 0
484 0 $rend->context($ctx->name);
485 0 $rend->clicker($self);
486 0 $plot->render_area->add_component($rend, 'c');
487 0 $rends{$ctx->name} = $rend;
488 }
489  
490 0 $count++;
491 }
492  
493 0 ▶ if($plot->grid->visible && $self->grid_over) {
Branch: 1 branch
BranchTrueFalseTotal
if ($plot->grid->visible and $self->grid_over) 0 0 0
Condition0%0/3
$plot->grid->visible and $self->grid_over
!ll&&!rl&&r
000
MC/DC0%0/2
$plot->grid->visible and $self->grid_over
$plot->grid->visible $self->grid_over
Truth table0%0/3
A and B
A= $plot->grid->visibleB= $self->grid_over
ABresult
0X0
100
111
494 0 $plot->grid->background_color->alpha(0);
495 0 $plot->render_area->add_component($plot->grid, 'c');
496 }
497  
498 0 foreach my $c (@{ $self->components }) {
499 0 ▶ $c->clicker($self) if $c->can('clicker');
Branch: 1 branch
BranchTrueFalseTotal
if $c->can("clicker") 0 0 0
500 }
501  
502 0 $plot->add_component($plot->render_area, 'c');
503  
504 0 foreach my $oc (@{ $self->over_decorations }) {
505 0 $plot->render_area->add_component($oc, 'c');
506 }
507  
508 0 super;
509 7 });
510  
511  
512 3 ▶sub set_renderer {
Subroutine set_renderer: called CC=3 SCAR=11.0
Pod documented
513 3 my ($self, $renderer, $context) = @_;
514  
515 3 ▶ $context = 'default' unless defined($context);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $context 1 2 3
516  
517 3 my $ctx = $self->get_context($context);
518 3 ▶ die("Unknown context: '$context'") unless defined($ctx);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $ctx 1 2 3
519  
520 2 $ctx->renderer($renderer);
521 }
522  
523  
524 0 ▶sub write_output {
Subroutine write_output: not called CC=1 SCAR=6.9
Pod documented
525 0 my $self = shift;
526  
527 0 $self->draw;
528 0 $self->write(@_);
529 }
530  
531 7 __PACKAGE__->meta->make_immutable;
532  
533 7 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
534  
535 7 1;
536  
537 __END__
« Clicker/Renderer/Line.pm ↑ Summary Clicker/Axis.pm »