File Coverage

blib/lib/Chart/Graph/Xmgrace/Dataset_Options.pm
Criterion Covered Total %
statement 51 86 59.3
branch 0 2 0.0
condition n/a
subroutine 10 19 52.6
pod n/a
total 61 107 57.0


line stmt bran cond sub pod time code
1             #
2             # Dataset_Options.pm
3             #
4             ## This software product is developed by Esmond Lee and David Moore,
5             ## and copyrighted(C) 1998 by the University of California, San Diego
6             ## (UCSD), with all rights reserved. UCSD administers the CAIDA grant,
7             ## NCR-9711092, under which part of this code was developed.
8             ##
9             ## There is no charge for this software. You can redistribute it and/or
10             ## modify it under the terms of the GNU General Public License, v. 2 dated
11             ## June 1991 which is incorporated by reference herein. This software is
12             ## distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF MERCHANTABILITY
13             ## OR FITNESS FOR A PARTICULAR PURPOSE or that the use of it will not
14             ## infringe on any third party's intellectual property rights.
15             ##
16             ## You should have received a copy of the GNU GPL along with this program.
17             ##
18             ##
19             ## IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY
20             ## PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
21             ## DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS
22             ## SOFTWARE, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF
23             ## THE POSSIBILITY OF SUCH DAMAGE.
24             ##
25             ## THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND THE
26             ## UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE,
27             ## SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. THE UNIVERSITY
28             ## OF CALIFORNIA MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES
29             ## OF ANY KIND, EITHER IMPLIED OR EXPRESS, INCLUDING, BUT NOT LIMITED
30             ## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A
31             ## PARTICULAR PURPOSE, OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE
32             ## ANY PATENT, TRADEMARK OR OTHER RIGHTS.
33             ##
34             ##
35             ## Contact: graph-dev@caida.org
36             ##
37             ##
38              
39             $VERSION = 3.2;
40              
41 4     4   2635 use Chart::Graph::Xmgrace::Base_Dataset_Option;
  4         12  
  4         135  
42 4     4   27 use Carp;
  4         10  
  4         27395  
43              
44             package Chart::Graph::Xmgrace::Symbol_Options;
45             @ISA= qw(Chart::Graph::Xmgrace::Base_Dataset_Option);
46              
47             sub _init {
48 60     60   69 my $self = shift;
49 60         85 my $color = shift;
50              
51 60         146 $self->{name} = "symbol";
52 60         172 $self->{print_order} = ["symbol type","size","color","pattern","fill color",
53             "fill pattern","linewidth","linestyle","char",
54             "char font","skip"];
55 60         92 $self->{length} = 4;
56 60         501 $self->{options} = {
57             "symbol type" => "0",
58             "size" => "1.000000",
59             "color" => $color,
60             "pattern" => "1",
61             "fill color" => $color,
62             "fill pattern" => "0",
63             "linewidth" => "1.0",
64             "linestyle" => "1",
65             "char" => "65",
66             "char font" => "0",
67             "skip" => "0",
68             };
69             }
70              
71             sub fill_color ($$) {
72 0     0   0 my $self = shift;
73 0         0 my $val = shift;
74 0         0 $self->{options}->{"fill color"} = $val;
75             }
76              
77             sub fill_pattern ($$) {
78 30     30   38 my $self = shift;
79 30         36 my $val = shift;
80 30         418 $self->{options}->{"fill pattern"} = $val;
81             }
82              
83             sub symbol_char ($$) {
84 0     0   0 my $self = shift;
85 0         0 my $val = shift;
86 0         0 $self->{options}->{"symbol char"} = $val;
87             }
88              
89             sub char_font ($$) {
90 0     0   0 my $self = shift;
91 0         0 my $val = shift;
92 0         0 $self->{options}->{"char font"} = $val;
93             }
94              
95             sub print($$$ ) {
96 0     0   0 my $self = shift;
97 0         0 my ($handle, $set) = @_;
98 0         0 my $string = "";
99            
100 0         0 foreach $option (@{ $self->{"print_order"} }) {
  0         0  
101 0         0 my $option_ref = $self->{"options"};
102              
103 0 0       0 if ($option eq "symbol type") {
104 0         0 $string = "$set $self->{name} $option_ref->{$option}\n";
105             } else {
106 0         0 $string = "$set $self->{name} $option $option_ref->{$option}\n";
107             }
108            
109 0         0 $self->_printline($handle, $string, $self->{"length"});
110 0         0 $string = "";
111             }
112             }
113              
114             package Chart::Graph::Xmgrace::Line_Options;
115             @ISA= qw(Chart::Graph::Xmgrace::Base_Dataset_Option);
116              
117             sub _init {
118 60     60   69 my $self = shift;
119 60         71 my $color = shift;
120 60         135 $self->{name} = "line";
121 60         181 $self->{print_order} = ["type","linestyle","linewidth","color","pattern"];
122 60         89 $self->{length} = 4;
123 60         287 $self->{options} = {
124             "type" => "1", # straight, left stairs, right stairs, segs, 3-segs
125             "linestyle" => "1", # solid, 7 other variations of dotted lines
126             "linewidth" => "1.0",
127             "color" => $color,
128             "pattern" => "1",
129             };
130             }
131              
132             package Chart::Graph::Xmgrace::Baseline_Options;
133             @ISA= qw(Chart::Graph::Xmgrace::Base_Dataset_Option);
134              
135             sub _init {
136 60     60   79 my $self = shift;
137 60         72 my $color = shift;
138 60         145 $self->{name} = "baseline";
139 60         128 $self->{print_order} = ["type","status"];
140 60         89 $self->{length} = 4;
141 60         213 $self->{options} = {
142             "type" => "0",
143             "status" => "off",
144             };
145              
146             }
147              
148             package Chart::Graph::Xmgrace::Dropline_Options;
149             @ISA= qw(Chart::Graph::Xmgrace::Base_Dataset_Option);
150              
151             sub _init {
152 60     60   74 my $self = shift;
153 60         77 my $color = shift;
154 60         133 $self->{name} = "dropline";
155 60         154 $self->{print_order} = ["status"];
156 60         99 $self->{length} = 4;
157 60         1348 $self->{options} = {
158             "status" => "off",
159             };
160              
161             }
162              
163             package Chart::Graph::Xmgrace::Fill_Options;
164             @ISA= qw(Chart::Graph::Xmgrace::Base_Dataset_Option);
165              
166             sub _init {
167 60     60   71 my $self = shift;
168 60         66 my $color = shift;
169 60         119 $self->{name} = "fill";
170 60         140 $self->{print_order} = ["type","rule","color","pattern"];
171 60         84 $self->{length} = 4;
172 60         266 $self->{options} = {
173             "type" => "0",
174             "rule" => "0",
175             "color" => $color,
176             "pattern" => "1",
177             };
178             }
179            
180              
181             package Chart::Graph::Xmgrace::Avalue_Options;
182             @ISA= qw(Chart::Graph::Xmgrace::Base_Dataset_Option);
183              
184             sub _init {
185 60     60   70 my $self = shift;
186 60         73 my $color = shift;
187 60         138 $self->{name} = "avalue";
188 60         309 $self->{print_order} = ["status","type","char size","font","color",
189             "rot","format","prec","prepend","append","offset"];
190 60         91 $self->{length} = 4;
191 60         504 $self->{options} = {
192             "status" => "off",
193             "type" => "2",
194             "char size" => "1.000000",
195             "font" => "0",
196             "color" => $color, # used to be "auto"
197             "rot" => "0",
198             "format" => "general",
199             "prec" => "3",
200             "prepend" => "",
201             "append" => "",
202             "offset" => ["0.000000", "0.000000"],
203             };
204              
205             }
206              
207             sub char_size ($$) {
208 0     0   0 my $self = shift;
209 0         0 my $val = shift;
210 0         0 $self->{options}->{"char size"} = $val;
211             }
212              
213              
214             package Chart::Graph::Xmgrace::Errorbar_Options;
215             @ISA= qw(Chart::Graph::Xmgrace::Base_Dataset_Option);
216              
217             sub _init {
218 60     60   72 my $self = shift;
219 60         61 my $color = shift;
220 60         136 $self->{name} = "errorbar";
221 60         229 $self->{print_order} = ["status","place","color","pattern","size","linewidth",
222             "linestyle","riser linewidth","riser linestyle",
223             "riser clip", "riser clip length"];
224 60         91 $self->{length} = 4;
225 60         550 $self->{options} = {
226             "status" => "on",
227             "place" => "normal",
228             "color" => $color,
229             "pattern" => "1",
230             "size" => "1.000000",
231             "linewidth" => "1.0",
232             "linestyle" => "1",
233             "riser linewidth" => "1.0",
234             "riser linestyle" => "1",
235             "riser clip" => "off",
236             "riser clip length" => "0.100000",
237             };
238             }
239              
240             sub riser_linewidth ($$) {
241 0     0     my $self = shift;
242 0           my $val = shift;
243 0           $self->{options}->{"riser linewidth"} = $val;
244             }
245              
246             sub riser_linestyle ($$) {
247 0     0     my $self = shift;
248 0           my $val = shift;
249 0           $self->{options}->{"riser linestyle"} = $val;
250             }
251              
252             sub riser_clip_status ($$) {
253 0     0     my $self = shift;
254 0           my $val = shift;
255 0           $self->{options}->{"riser clip status"} = $val;
256             }
257              
258             sub riser_clip_length ($$) {
259 0     0     my $self = shift;
260 0           my $val = shift;
261 0           $self->{options}->{"riser clip length"} = $val;
262             }
263              
264             1;
265              
266              
267              
268              
269