line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# Axis.pm is a class that contains the fundamental options for |
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
|
|
|
|
|
|
|
$VERSION = 3.2; |
39
|
|
|
|
|
|
|
package Chart::Graph::Xmgrace::Axis; |
40
|
|
|
|
|
|
|
@ISA = qw(Chart::Graph::Xmgrace::Base_Option); |
41
|
4
|
|
|
4
|
|
21
|
use Carp; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
268
|
|
42
|
|
|
|
|
|
|
# for Bar_Options, Label_Options, Tick_Options, Ticklabel_Options |
43
|
4
|
|
|
4
|
|
2566
|
use Chart::Graph::Xmgrace::Axis_Options; |
|
4
|
|
|
|
|
13
|
|
|
4
|
|
|
|
|
2598
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub _init { |
46
|
12
|
|
|
12
|
|
14
|
my $self = shift; |
47
|
12
|
|
|
|
|
13
|
my $type_of_axis = shift; #xaxis, yaxis, altxaxis, altyaxis |
48
|
12
|
|
|
|
|
26
|
$self->{name} = $type_of_axis; |
49
|
12
|
|
|
|
|
37
|
$self->{print_order} = ["status", "type zero", "offset", "bar options", |
50
|
|
|
|
|
|
|
"label options", "tick options","ticklabel options"]; |
51
|
12
|
|
|
|
|
13
|
$self->{length} = 4; |
52
|
12
|
|
|
|
|
56
|
$self->{options} = { |
53
|
|
|
|
|
|
|
"status" => "on", |
54
|
|
|
|
|
|
|
"type zero" => "false", |
55
|
|
|
|
|
|
|
"offset" => ["0.000000","0.000000"], |
56
|
|
|
|
|
|
|
"bar options" => new Chart::Graph::Xmgrace::Bar_Options, |
57
|
|
|
|
|
|
|
"label options" => new Chart::Graph::Xmgrace::Label_Options, |
58
|
|
|
|
|
|
|
"tick options" => new Chart::Graph::Xmgrace::Tick_Options, |
59
|
|
|
|
|
|
|
"ticklabel options" => new Chart::Graph::Xmgrace::Ticklabel_Options, |
60
|
|
|
|
|
|
|
}; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub type_zero ($$) { |
64
|
0
|
|
|
0
|
0
|
0
|
$self = shift; |
65
|
0
|
|
|
|
|
0
|
$val = shift; |
66
|
0
|
|
|
|
|
0
|
$self->{options}->{"type zero"} = $val; |
67
|
0
|
|
|
|
|
0
|
return 1; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub bar_options ($) { |
71
|
0
|
|
|
0
|
0
|
0
|
$self = shift; |
72
|
0
|
|
|
|
|
0
|
return $self->{options}->{"bar options"}; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub label_options ($) { |
76
|
8
|
|
|
8
|
0
|
10
|
$self = shift; |
77
|
8
|
|
|
|
|
89
|
return $self->{options}->{"label options"}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub tick_options ($) { |
81
|
0
|
|
|
0
|
0
|
0
|
$self = shift; |
82
|
0
|
|
|
|
|
0
|
return $self->{options}->{"tick options"}; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
sub ticklabel_options ($) { |
86
|
0
|
|
|
0
|
0
|
0
|
$self = shift; |
87
|
0
|
|
|
|
|
0
|
return $self->{options}->{"ticklabel options"}; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub print($$ ) { |
91
|
4
|
|
|
4
|
0
|
6
|
my $self = shift; |
92
|
4
|
|
|
|
|
3
|
my $handle = shift; |
93
|
4
|
|
|
|
|
5
|
my $string = ""; |
94
|
4
|
|
|
|
|
6
|
my $substr = ""; |
95
|
|
|
|
|
|
|
|
96
|
4
|
|
|
|
|
5
|
foreach $option (@{ $self->{"print_order"} }) { |
|
4
|
|
|
|
|
8
|
|
97
|
16
|
|
|
|
|
25
|
my $option_ref = $self->{"options"}; |
98
|
|
|
|
|
|
|
|
99
|
16
|
100
|
66
|
|
|
65
|
if ($option eq "status" or $option eq "in_out_status") { |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# we first check the status of the axes, whether it's on/off |
102
|
|
|
|
|
|
|
# if it's off, we don't print it out |
103
|
4
|
100
|
|
|
|
14
|
if ($option_ref->{"status"} eq "off") { |
104
|
2
|
|
|
|
|
6
|
$string = "$self->{name} $option_ref->{$option}\n"; |
105
|
2
|
|
|
|
|
6
|
$self->_printline($handle, $string, $self->{"length"}); |
106
|
2
|
|
|
|
|
9
|
last; |
107
|
|
|
|
|
|
|
} |
108
|
|
|
|
|
|
|
|
109
|
2
|
|
|
|
|
5
|
$string = "$self->{name} $option_ref->{$option}\n"; |
110
|
2
|
|
|
|
|
12
|
$self->_printline($handle, $string, $self->{"length"}); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
} else { |
113
|
|
|
|
|
|
|
# print function handles both scalars and lists |
114
|
12
|
100
|
|
|
|
56
|
if (!ref($option_ref->{$option})) { |
|
|
100
|
|
|
|
|
|
115
|
2
|
|
|
|
|
10
|
$string = "$self->{name} $option $option_ref->{$option}\n"; |
116
|
2
|
|
|
|
|
7
|
$self->_printline($handle, $string, $self->{"length"}); |
117
|
|
|
|
|
|
|
} elsif (ref($option_ref->{$option}) eq ARRAY) { |
118
|
2
|
|
|
|
|
3
|
$substr = join (", ", (@{ $option_ref->{$option} })); |
|
2
|
|
|
|
|
7
|
|
119
|
2
|
|
|
|
|
6
|
$string = "$self->{name} $option $substr\n"; |
120
|
2
|
|
|
|
|
7
|
$self->_printline($handle, $string, $self->{"length"}); |
121
|
|
|
|
|
|
|
} else { # a blessed object, uses Axis Option print |
122
|
8
|
|
|
|
|
40
|
$option_ref->{$option}->print($handle, $self->{name}); |
123
|
|
|
|
|
|
|
} |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
} |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
1; |