line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Chart::Clicker::Decoration::Grid; |
2
|
|
|
|
|
|
|
$Chart::Clicker::Decoration::Grid::VERSION = '2.88'; |
3
|
9
|
|
|
9
|
|
25689
|
use Moose; |
|
9
|
|
|
|
|
516145
|
|
|
9
|
|
|
|
|
70
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
extends 'Graphics::Primitive::Canvas'; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
with 'Graphics::Primitive::Oriented'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
# ABSTRACT: Under-data grid |
10
|
|
|
|
|
|
|
|
11
|
9
|
|
|
9
|
|
61133
|
use Graphics::Color::RGB; |
|
9
|
|
|
|
|
1615116
|
|
|
9
|
|
|
|
|
5684
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
has '+background_color' => ( |
15
|
|
|
|
|
|
|
default => sub { |
16
|
|
|
|
|
|
|
Graphics::Color::RGB->new( |
17
|
|
|
|
|
|
|
red => 0.9, green => 0.9, blue => 0.9, alpha => 1 |
18
|
|
|
|
|
|
|
) |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
has 'clicker' => ( is => 'rw', isa => 'Chart::Clicker' ); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
has 'domain_brush' => ( |
27
|
|
|
|
|
|
|
is => 'rw', |
28
|
|
|
|
|
|
|
isa => 'Graphics::Primitive::Brush', |
29
|
|
|
|
|
|
|
default => sub { |
30
|
|
|
|
|
|
|
Graphics::Primitive::Brush->new( |
31
|
|
|
|
|
|
|
color => Graphics::Color::RGB->new( |
32
|
|
|
|
|
|
|
red => .75, green => .75, blue => .75, alpha => 1 |
33
|
|
|
|
|
|
|
), |
34
|
|
|
|
|
|
|
width => 1 |
35
|
|
|
|
|
|
|
) |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has 'range_brush' => ( |
41
|
|
|
|
|
|
|
is => 'rw', |
42
|
|
|
|
|
|
|
isa => 'Graphics::Primitive::Brush', |
43
|
|
|
|
|
|
|
default => sub { |
44
|
|
|
|
|
|
|
Graphics::Primitive::Brush->new( |
45
|
|
|
|
|
|
|
color => Graphics::Color::RGB->new( |
46
|
|
|
|
|
|
|
red => .75, green => .75, blue => .75, alpha => 1 |
47
|
|
|
|
|
|
|
), |
48
|
|
|
|
|
|
|
width => 1 |
49
|
|
|
|
|
|
|
) |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
); |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
has 'show_domain' => ( |
55
|
|
|
|
|
|
|
is => 'rw', |
56
|
|
|
|
|
|
|
isa => 'Bool', |
57
|
|
|
|
|
|
|
default => 1 |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
has 'show_range' => ( |
62
|
|
|
|
|
|
|
is => 'rw', |
63
|
|
|
|
|
|
|
isa => 'Bool', |
64
|
|
|
|
|
|
|
default => 1 |
65
|
|
|
|
|
|
|
); |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
override('finalize', sub { |
69
|
|
|
|
|
|
|
my $self = shift; |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
return unless ($self->show_domain || $self->show_range); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
my $clicker = $self->clicker; |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
my $dflt = $clicker->get_context('default'); |
76
|
|
|
|
|
|
|
my $daxis = $dflt->domain_axis; |
77
|
|
|
|
|
|
|
my $raxis = $dflt->range_axis; |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
if($self->show_domain) { |
80
|
|
|
|
|
|
|
$self->draw_lines($daxis); |
81
|
|
|
|
|
|
|
my $dop = Graphics::Primitive::Operation::Stroke->new; |
82
|
|
|
|
|
|
|
$dop->brush($self->domain_brush); |
83
|
|
|
|
|
|
|
$self->do($dop); |
84
|
|
|
|
|
|
|
} |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
if($self->show_range) { |
87
|
|
|
|
|
|
|
$self->draw_lines($raxis); |
88
|
|
|
|
|
|
|
my $rop = Graphics::Primitive::Operation::Stroke->new; |
89
|
|
|
|
|
|
|
$rop->brush($self->range_brush); |
90
|
|
|
|
|
|
|
$self->do($rop); |
91
|
|
|
|
|
|
|
} |
92
|
|
|
|
|
|
|
}); |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub draw_lines { |
96
|
0
|
|
|
0
|
1
|
|
my ($self, $axis) = @_; |
97
|
|
|
|
|
|
|
|
98
|
0
|
|
|
|
|
|
my $height = $self->height; |
99
|
0
|
|
|
|
|
|
my $width = $self->width; |
100
|
|
|
|
|
|
|
|
101
|
0
|
0
|
|
|
|
|
if($axis->is_horizontal) { |
102
|
|
|
|
|
|
|
|
103
|
0
|
|
|
|
|
|
foreach my $val (@{ $axis->tick_values }) { |
|
0
|
|
|
|
|
|
|
104
|
0
|
|
|
|
|
|
my $mark = $axis->mark($width, $val); |
105
|
|
|
|
|
|
|
# Don't try and draw a mark if the Axis wouldn't give us a value, |
106
|
|
|
|
|
|
|
# it might be skipping... |
107
|
0
|
0
|
|
|
|
|
next unless defined($mark); |
108
|
0
|
|
|
|
|
|
$self->move_to($mark, 0); |
109
|
0
|
|
|
|
|
|
$self->rel_line_to(0, $height); |
110
|
|
|
|
|
|
|
} |
111
|
|
|
|
|
|
|
} else { |
112
|
|
|
|
|
|
|
|
113
|
0
|
|
|
|
|
|
foreach my $val (@{ $axis->tick_values }) { |
|
0
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my $mark = $axis->mark($height, $val); |
115
|
|
|
|
|
|
|
# Don't try and draw a mark if the Axis wouldn't give us a value, |
116
|
|
|
|
|
|
|
# it might be skipping... |
117
|
0
|
0
|
|
|
|
|
next unless defined($mark); |
118
|
0
|
|
|
|
|
|
$self->move_to(0, $height - $mark); |
119
|
0
|
|
|
|
|
|
$self->rel_line_to($width, 0); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
} |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
125
|
|
|
|
|
|
|
|
126
|
9
|
|
|
9
|
|
70
|
no Moose; |
|
9
|
|
|
|
|
27
|
|
|
9
|
|
|
|
|
64
|
|
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
__END__ |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=pod |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
=head1 NAME |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Chart::Clicker::Decoration::Grid - Under-data grid |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 VERSION |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
version 2.88 |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
=head1 DESCRIPTION |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Generates a collection of Markers for use as a background. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head2 background_color |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Set/Get the background L<color|Graphics::Color::RGB> for this Grid. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head2 border |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Set/Get the L<border|Graphics::Primitive::Border> for this Grid. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=head2 color |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
Set/Get the L<color|Graphics::Color::RGB> for this Grid. |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 domain_brush |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Set/Get the L<brush|Graphics::Primitive::Brush> for inking the domain markers. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head2 range_brush |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Set/Get the L<brush|Graphics::Primitive::Brush> for inking the range markers. |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=head2 show_domain |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Flag to show or not show the domain lines. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=head2 show_range |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Flag to show or not show the range lines. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head2 stroke |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Set/Get the Stroke for this Grid. |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=head1 METHODS |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head2 draw_lines |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Called by pack, draws the lines for a given axis. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 AUTHOR |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Cory G Watson <gphat@cpan.org> |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
This software is copyright (c) 2014 by Cold Hard Code, LLC. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
195
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=cut |