line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Chart::OFC::Dataset::Line; |
2
|
|
|
|
|
|
|
$Chart::OFC::Dataset::Line::VERSION = '0.12'; |
3
|
16
|
|
|
16
|
|
13359
|
use strict; |
|
16
|
|
|
|
|
39
|
|
|
16
|
|
|
|
|
619
|
|
4
|
16
|
|
|
16
|
|
95
|
use warnings; |
|
16
|
|
|
|
|
125
|
|
|
16
|
|
|
|
|
459
|
|
5
|
|
|
|
|
|
|
|
6
|
16
|
|
|
16
|
|
91
|
use Moose; |
|
16
|
|
|
|
|
33
|
|
|
16
|
|
|
|
|
116
|
|
7
|
16
|
|
|
16
|
|
128414
|
use MooseX::StrictConstructor; |
|
16
|
|
|
|
|
71
|
|
|
16
|
|
|
|
|
172
|
|
8
|
16
|
|
|
16
|
|
53718
|
use Chart::OFC::Types; |
|
16
|
|
|
|
|
43
|
|
|
16
|
|
|
|
|
3778
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
extends 'Chart::OFC::Dataset'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Cannot do has '+values' because the new type is not a subtype of the |
13
|
|
|
|
|
|
|
# type in the parent class. |
14
|
|
|
|
|
|
|
has 'values' => |
15
|
|
|
|
|
|
|
( is => 'ro', |
16
|
|
|
|
|
|
|
isa => 'Chart::OFC::Type::NonEmptyArrayRefOfNumsOrUndefs', |
17
|
|
|
|
|
|
|
required => 1, |
18
|
|
|
|
|
|
|
auto_deref => 1, |
19
|
|
|
|
|
|
|
); |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
has width => |
22
|
|
|
|
|
|
|
( is => 'ro', |
23
|
|
|
|
|
|
|
isa => 'Chart::OFC::Type::PosInt', |
24
|
|
|
|
|
|
|
default => 2, |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has color => |
28
|
|
|
|
|
|
|
( is => 'ro', |
29
|
|
|
|
|
|
|
isa => 'Chart::OFC::Type::Color', |
30
|
|
|
|
|
|
|
coerce => 1, |
31
|
|
|
|
|
|
|
default => '#000000', |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has label => |
35
|
|
|
|
|
|
|
( is => 'ro', |
36
|
|
|
|
|
|
|
isa => 'Str', |
37
|
|
|
|
|
|
|
predicate => '_has_label', |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has text_size => |
41
|
|
|
|
|
|
|
( is => 'ro', |
42
|
|
|
|
|
|
|
isa => 'Chart::OFC::Type::Size', |
43
|
|
|
|
|
|
|
default => 10, |
44
|
|
|
|
|
|
|
); |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub type |
47
|
|
|
|
|
|
|
{ |
48
|
6
|
|
|
6
|
0
|
17
|
return 'line'; |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub _parameters_for_type |
52
|
|
|
|
|
|
|
{ |
53
|
6
|
|
|
6
|
|
12
|
my $self = shift; |
54
|
|
|
|
|
|
|
|
55
|
6
|
|
|
|
|
240
|
my @p = ( $self->width(), $self->color() ); |
56
|
6
|
100
|
|
|
|
333
|
push @p, ( $self->label(), $self->text_size() ) |
57
|
|
|
|
|
|
|
if $self->_has_label(); |
58
|
|
|
|
|
|
|
|
59
|
6
|
|
|
|
|
42
|
return @p; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
16
|
|
|
16
|
|
158
|
no Moose; |
|
16
|
|
|
|
|
35
|
|
|
16
|
|
|
|
|
103
|
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__PACKAGE__->meta()->make_immutable(); |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# ABSTRACT: A dataset represented as a line |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=pod |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 NAME |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Chart::OFC::Dataset::Line - A dataset represented as a line |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 VERSION |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
version 0.12 |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 SYNOPSIS |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
my @numbers = (1, 2, 3); |
85
|
|
|
|
|
|
|
my $line = Chart::OFC::Dataset::Line->new( |
86
|
|
|
|
|
|
|
values => \@numbers, |
87
|
|
|
|
|
|
|
width => 5, |
88
|
|
|
|
|
|
|
color => 'purple', |
89
|
|
|
|
|
|
|
label => 'Daily Sales in $', |
90
|
|
|
|
|
|
|
text_size => 12, |
91
|
|
|
|
|
|
|
); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 DESCRIPTION |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
This class contains values to be charted as a line on a grid chart. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=for Pod::Coverage type |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
This class has several attributes which may be passed to the C<new()> |
102
|
|
|
|
|
|
|
method. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
It is a subclass of C<Chart::OFC::Dataset> and accepts all of that |
105
|
|
|
|
|
|
|
class's attributes as well as its own. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head2 values |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
For this class, the values array may contain some undefined |
110
|
|
|
|
|
|
|
values. These are simply skipped in the resulting chart. |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 links |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
Just as with values, this may contain some undefined values. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 width |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The width of the line in pixels. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Defaults to 2. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head2 color |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
The color of the line, and of the text in the chart key, if a label is |
125
|
|
|
|
|
|
|
specified. |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
Defaults to #999999 (medium grey). |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
=head2 label |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
If provided, this will be shown as part of the chart key. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
This attribute is optional. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 text_size |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
This is the size of the text in the key. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Defaults to 10 (pixels). |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 ROLES |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
This class does the C<Chart::OFC::Role::OFCDataLines> role. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 AUTHOR |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Dave Rolsky <autarch@urth.org> |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
This software is Copyright (c) 2014 by Dave Rolsky. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
This is free software, licensed under: |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=cut |