line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Chart::Clicker::Context; |
2
|
|
|
|
|
|
|
$Chart::Clicker::Context::VERSION = '2.88'; |
3
|
8
|
|
|
8
|
|
26497
|
use Moose; |
|
8
|
|
|
|
|
529448
|
|
|
8
|
|
|
|
|
87
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: A rendering context: Axes, Markers and a Renderer |
6
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
73451
|
use Chart::Clicker::Axis; |
|
8
|
|
|
|
|
38
|
|
|
8
|
|
|
|
|
431
|
|
8
|
8
|
|
|
8
|
|
6266
|
use Chart::Clicker::Renderer::Line; |
|
8
|
|
|
|
|
37
|
|
|
8
|
|
|
|
|
2422
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has 'domain_axis' => ( |
12
|
|
|
|
|
|
|
is => 'rw', |
13
|
|
|
|
|
|
|
isa => 'Chart::Clicker::Axis', |
14
|
|
|
|
|
|
|
default => sub { |
15
|
|
|
|
|
|
|
Chart::Clicker::Axis->new( |
16
|
|
|
|
|
|
|
orientation => 'horizontal', |
17
|
|
|
|
|
|
|
position => 'bottom', |
18
|
|
|
|
|
|
|
format => '%0.2f' |
19
|
|
|
|
|
|
|
) |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has 'markers' => ( |
25
|
|
|
|
|
|
|
traits => [ 'Array' ], |
26
|
|
|
|
|
|
|
is => 'rw', |
27
|
|
|
|
|
|
|
isa => 'ArrayRef[Chart::Clicker::Data::Marker]', |
28
|
|
|
|
|
|
|
default => sub { [] }, |
29
|
|
|
|
|
|
|
handles => { |
30
|
|
|
|
|
|
|
'marker_count' => 'count', |
31
|
|
|
|
|
|
|
'add_marker' => 'push' |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has 'name' => ( |
37
|
|
|
|
|
|
|
is => 'rw', |
38
|
|
|
|
|
|
|
isa => 'Str', |
39
|
|
|
|
|
|
|
required => 1 |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
has 'range_axis' => ( |
44
|
|
|
|
|
|
|
is => 'rw', |
45
|
|
|
|
|
|
|
isa => 'Chart::Clicker::Axis', |
46
|
|
|
|
|
|
|
default => sub { |
47
|
|
|
|
|
|
|
Chart::Clicker::Axis->new( |
48
|
|
|
|
|
|
|
orientation => 'vertical', |
49
|
|
|
|
|
|
|
position => 'left', |
50
|
|
|
|
|
|
|
format => '%0.2f' |
51
|
|
|
|
|
|
|
) |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
has 'renderer' => ( |
57
|
|
|
|
|
|
|
is => 'rw', |
58
|
|
|
|
|
|
|
isa => 'Chart::Clicker::Renderer', |
59
|
|
|
|
|
|
|
default => sub { Chart::Clicker::Renderer::Line->new }, |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub share_axes_with { |
64
|
0
|
|
|
0
|
1
|
|
my ($self, $other_context) = @_; |
65
|
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
$self->range_axis($other_context->range_axis); |
67
|
0
|
|
|
|
|
|
$self->domain_axis($other_context->domain_axis); |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
71
|
|
|
|
|
|
|
|
72
|
8
|
|
|
8
|
|
94
|
no Moose; |
|
8
|
|
|
|
|
17
|
|
|
8
|
|
|
|
|
68
|
|
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
1; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
__END__ |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=pod |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 NAME |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Chart::Clicker::Context - A rendering context: Axes, Markers and a Renderer |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 VERSION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
version 2.88 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 SYNOPSIS |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
my $clicker = Chart::Clicker->new; |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
my $context = Chart::Clicker::Context->new( |
93
|
|
|
|
|
|
|
name => 'Foo' |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
$clicker->add_to_contexts('foo', $context); |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 DESCRIPTION |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Contexts represent the way a dataset should be charted. Multiple contexts |
101
|
|
|
|
|
|
|
allow a chart with multiple renderers and axes. See the CONTEXTS section |
102
|
|
|
|
|
|
|
in L<Chart::Clicker>. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 renderer |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Set/get this context's renderer |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 domain_axis |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Set/get this context's domain L<Axis|Chart::Clicker::Axis>. |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 markers |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
An arrayref of L<Chart::Clicker::Data::Marker>s for this context. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 name |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Set/get this context's name |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 range_axis |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Set/get this context's range L<Axis|Chart::Clicker::Axis>. |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 METHODS |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 add_marker |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Add a marker to this context. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 marker_count |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Get a count of markers in this context. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head2 share_axes_with ($other_context) |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
Sets this context's axes to those of the supplied context. This is a |
139
|
|
|
|
|
|
|
convenience method for quickly sharing axes. It's simple doing: |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
$self->range_axis($other_context->range_axis); |
142
|
|
|
|
|
|
|
$self->domain_axis($other_context->domain_axis); |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=head1 AUTHOR |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
Cory G Watson <gphat@cpan.org> |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Cold Hard Code, LLC. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
153
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
=cut |