| 1 | # | ||||||||||||||||||||||||||||
| 2 | # Graph_Presentation_Type manages what type of graphs and what kind of presentation | ||||||||||||||||||||||||||||
| 3 | # is used. XY graph, Xy chart, BAR graph, BAR chart. | ||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||
| 5 | # contains: Chart::Graph::Xmgrace::Graph | ||||||||||||||||||||||||||||
| 6 | # Chart::Graph::Xmgrace::Chart | ||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||
| 8 | # things to do as of 4/2000: | ||||||||||||||||||||||||||||
| 9 | # 1) implement Polar graph object | ||||||||||||||||||||||||||||
| 10 | # 2) implement Smith chart object | ||||||||||||||||||||||||||||
| 11 | # 3) implement Fixed chart object | ||||||||||||||||||||||||||||
| 12 | # | ||||||||||||||||||||||||||||
| 13 | ## This software product is developed by Esmond Lee and David Moore, | ||||||||||||||||||||||||||||
| 14 | ## and copyrighted(C) 1998 by the University of California, San Diego | ||||||||||||||||||||||||||||
| 15 | ## (UCSD), with all rights reserved. UCSD administers the CAIDA grant, | ||||||||||||||||||||||||||||
| 16 | ## NCR-9711092, under which part of this code was developed. | ||||||||||||||||||||||||||||
| 17 | ## | ||||||||||||||||||||||||||||
| 18 | ## There is no charge for this software. You can redistribute it and/or | ||||||||||||||||||||||||||||
| 19 | ## modify it under the terms of the GNU General Public License, v. 2 dated | ||||||||||||||||||||||||||||
| 20 | ## June 1991 which is incorporated by reference herein. This software is | ||||||||||||||||||||||||||||
| 21 | ## distributed WITHOUT ANY WARRANTY, IMPLIED OR EXPRESS, OF MERCHANTABILITY | ||||||||||||||||||||||||||||
| 22 | ## OR FITNESS FOR A PARTICULAR PURPOSE or that the use of it will not | ||||||||||||||||||||||||||||
| 23 | ## infringe on any third party's intellectual property rights. | ||||||||||||||||||||||||||||
| 24 | ## | ||||||||||||||||||||||||||||
| 25 | ## You should have received a copy of the GNU GPL along with this program. | ||||||||||||||||||||||||||||
| 26 | ## | ||||||||||||||||||||||||||||
| 27 | ## | ||||||||||||||||||||||||||||
| 28 | ## IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY | ||||||||||||||||||||||||||||
| 29 | ## PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL | ||||||||||||||||||||||||||||
| 30 | ## DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS | ||||||||||||||||||||||||||||
| 31 | ## SOFTWARE, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF | ||||||||||||||||||||||||||||
| 32 | ## THE POSSIBILITY OF SUCH DAMAGE. | ||||||||||||||||||||||||||||
| 33 | ## | ||||||||||||||||||||||||||||
| 34 | ## THE SOFTWARE PROVIDED HEREIN IS ON AN "AS IS" BASIS, AND THE | ||||||||||||||||||||||||||||
| 35 | ## UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, | ||||||||||||||||||||||||||||
| 36 | ## SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. THE UNIVERSITY | ||||||||||||||||||||||||||||
| 37 | ## OF CALIFORNIA MAKES NO REPRESENTATIONS AND EXTENDS NO WARRANTIES | ||||||||||||||||||||||||||||
| 38 | ## OF ANY KIND, EITHER IMPLIED OR EXPRESS, INCLUDING, BUT NOT LIMITED | ||||||||||||||||||||||||||||
| 39 | ## TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A | ||||||||||||||||||||||||||||
| 40 | ## PARTICULAR PURPOSE, OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE | ||||||||||||||||||||||||||||
| 41 | ## ANY PATENT, TRADEMARK OR OTHER RIGHTS. | ||||||||||||||||||||||||||||
| 42 | ## | ||||||||||||||||||||||||||||
| 43 | ## | ||||||||||||||||||||||||||||
| 44 | ## Contact: graph-dev@caida.org | ||||||||||||||||||||||||||||
| 45 | ## | ||||||||||||||||||||||||||||
| 46 | ## | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 4 | $VERSION = 3.2; | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 4 | ▶ | use Chart::Graph::Xmgrace::Dataset_Options; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 51 | 4 | ▶ | use Chart::Graph::Xmgrace::Base_Dataset_Option; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | package Chart::Graph::Xmgrace::Graph_Presentation_Type; | ||||||||||||||||||||||||||||
| 54 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 15 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 57 | 15 | my $that = shift; | |||||||||||||||||||||||||||
| 58 | 15 | my $color = shift; | |||||||||||||||||||||||||||
| 59 | 15 | $color += 1; | |||||||||||||||||||||||||||
| 60 | 15 | ▶ | my $class = ref($that) || $that; | ||||||||||||||||||||||||||
|
Condition33%1/3
ref $that || $that
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table33%1/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||||||||||
| 61 | 15 | my $self = { | |||||||||||||||||||||||||||
| 62 | "XY graph" => new Chart::Graph::Xmgrace::Graph("XY", $color), | ||||||||||||||||||||||||||||
| 63 | "XY chart" => new Chart::Graph::Xmgrace::Chart("XY", $color), | ||||||||||||||||||||||||||||
| 64 | "BAR graph" => new Chart::Graph::Xmgrace::Graph("BAR",$color), | ||||||||||||||||||||||||||||
| 65 | "BAR chart" => new Chart::Graph::Xmgrace::Chart("BAR",$color), | ||||||||||||||||||||||||||||
| 66 | "Polar graph" => undef, | ||||||||||||||||||||||||||||
| 67 | "Smith chart" => undef, | ||||||||||||||||||||||||||||
| 68 | "Fixed" => undef, | ||||||||||||||||||||||||||||
| 69 | }; | ||||||||||||||||||||||||||||
| 70 | 15 | bless $self, $class; | |||||||||||||||||||||||||||
| 71 | 15 | return $self; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub XY_graph { | ||||||||||||||||||||||||||
|
Subroutine
XY_graph: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 75 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 76 | 0 | return $self->{"XY graph"}; | |||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub XY_chart { | ||||||||||||||||||||||||||
|
Subroutine
XY_chart: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 80 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 81 | 0 | return $self->{"XY chart"}; | |||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 15 | ▶ | sub AUTOLOAD { | ||||||||||||||||||||||||||
|
Subroutine
AUTOLOAD: called CC=5 SCAR=18.7
| |||||||||||||||||||||||||||||
| 85 | 15 | my $self = shift; | |||||||||||||||||||||||||||
| 86 | 15 | ▶ | my $type = ref($self) || croak "$self is not an object"; | ||||||||||||||||||||||||||
|
Condition50%1/2
ref $self || croak("$self is not an object")
MC/DC0%0/1
ref $self || croak("$self is not an object")
ref $self
Truth table50%1/2
A
A= ref $self
| |||||||||||||||||||||||||||||
| 87 | 15 | my $name = $AUTOLOAD; | |||||||||||||||||||||||||||
| 88 | 15 | $name =~ s/.*://; #strip fully-qualified portion | |||||||||||||||||||||||||||
| 89 | 15 | ▶ | unless (($name eq "DESTROY") or (exists $self->{$name})) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$name eq "DESTROY" or exists $self->{$name}
MC/DC0%0/2
$name eq "DESTROY" or exists $self->{$name}
$name eq "DESTROY"
exists $self->{$name}
Truth table33%1/3
A or B
A= $name eq "DESTROY"B= exists $self->{$name}
| |||||||||||||||||||||||||||||
| 90 | 0 | croak "Can't access '$name' field in object of class $type"; | |||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 15 | ▶ | if (@_) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | 0 | return $self->{$name} = shift; | |||||||||||||||||||||||||||
| 95 | } else { | ||||||||||||||||||||||||||||
| 96 | 15 | return $self->{$name}; | |||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||
| 100 | package Chart::Graph::Xmgrace::Graph; | ||||||||||||||||||||||||||||
| 101 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 102 | 4 | @ISA = qw(Chart::Graph::Xmgrace::Base_Dataset_Option); | |||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | 30 | ▶ | sub _init { | ||||||||||||||||||||||||||
|
Subroutine
_init: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||
| 105 | 30 | my $self = shift; | |||||||||||||||||||||||||||
| 106 | 30 | my ($type, $color) = @_; | |||||||||||||||||||||||||||
| 107 | 30 | $self->{type} = $type; | |||||||||||||||||||||||||||
| 108 | $self->{print_order} = ["hidden","type","symbol","line","baseline", | ||||||||||||||||||||||||||||
| 109 | "dropline","fill","avalue","errorbar","comment", | ||||||||||||||||||||||||||||
| 110 | "legend"], | ||||||||||||||||||||||||||||
| 111 | 30 | $self->{length} = 4; | |||||||||||||||||||||||||||
| 112 | $self->{options} = { | ||||||||||||||||||||||||||||
| 113 | 30 | "hidden" => "false", | |||||||||||||||||||||||||||
| 114 | "type" => "$type", | ||||||||||||||||||||||||||||
| 115 | "symbol" => new Chart::Graph::Xmgrace::Symbol_Options($color), | ||||||||||||||||||||||||||||
| 116 | "line" => new Chart::Graph::Xmgrace::Line_Options($color), | ||||||||||||||||||||||||||||
| 117 | "baseline" => new Chart::Graph::Xmgrace::Baseline_Options($color), | ||||||||||||||||||||||||||||
| 118 | "dropline" => new Chart::Graph::Xmgrace::Dropline_Options($color), | ||||||||||||||||||||||||||||
| 119 | "fill" => new Chart::Graph::Xmgrace::Fill_Options($color), | ||||||||||||||||||||||||||||
| 120 | "avalue" => new Chart::Graph::Xmgrace::Avalue_Options($color), | ||||||||||||||||||||||||||||
| 121 | "errorbar" => new Chart::Graph::Xmgrace::Errorbar_Options($color), | ||||||||||||||||||||||||||||
| 122 | "comment" => "", | ||||||||||||||||||||||||||||
| 123 | "legend" => "", | ||||||||||||||||||||||||||||
| 124 | }; | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | 30 | ▶ | if ($type eq "XY") { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 127 | 15 | return 1; | |||||||||||||||||||||||||||
| 128 | } elsif ($type eq "BAR") { | ||||||||||||||||||||||||||||
| 129 | 15 | $self->symbol->fill_pattern("1"); | |||||||||||||||||||||||||||
| 130 | 15 | $self->symbol->color("1"); | |||||||||||||||||||||||||||
| 131 | 15 | $self->line->type("0"); | |||||||||||||||||||||||||||
| 132 | 15 | return 1; | |||||||||||||||||||||||||||
| 133 | } else { | ||||||||||||||||||||||||||||
| 134 | 0 | carp "Warning: Invalid graph type\n"; | |||||||||||||||||||||||||||
| 135 | 0 | return 0; | |||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | package Chart::Graph::Xmgrace::Chart; | ||||||||||||||||||||||||||||
| 140 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 141 | 4 | @ISA = qw(Chart::Graph::Xmgrace::Base_Dataset_Option); | |||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||
| 143 | 30 | ▶ | sub _init { | ||||||||||||||||||||||||||
|
Subroutine
_init: called CC=3 SCAR=11.1
| |||||||||||||||||||||||||||||
| 144 | 30 | my $self = shift; | |||||||||||||||||||||||||||
| 145 | 30 | my ($type, $color) = @_; | |||||||||||||||||||||||||||
| 146 | 30 | $self->{type} = $type; | |||||||||||||||||||||||||||
| 147 | $self->{print_order} = ["hidden","type","symbol","line","baseline", | ||||||||||||||||||||||||||||
| 148 | "dropline","fill","avalue","errorbar","comment", | ||||||||||||||||||||||||||||
| 149 | "legend"], | ||||||||||||||||||||||||||||
| 150 | 30 | $self->{length} = 4; | |||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||
| 152 | $self->{options} = { | ||||||||||||||||||||||||||||
| 153 | 30 | "hidden" => "false", | |||||||||||||||||||||||||||
| 154 | "type" => "$type", | ||||||||||||||||||||||||||||
| 155 | "symbol" => new Chart::Graph::Xmgrace::Symbol_Options($color), | ||||||||||||||||||||||||||||
| 156 | "line" => new Chart::Graph::Xmgrace::Line_Options($color), | ||||||||||||||||||||||||||||
| 157 | "baseline" => new Chart::Graph::Xmgrace::Baseline_Options($color), | ||||||||||||||||||||||||||||
| 158 | "dropline" => new Chart::Graph::Xmgrace::Dropline_Options($color), | ||||||||||||||||||||||||||||
| 159 | "fill" => new Chart::Graph::Xmgrace::Fill_Options($color), | ||||||||||||||||||||||||||||
| 160 | "avalue" => new Chart::Graph::Xmgrace::Avalue_Options($color), | ||||||||||||||||||||||||||||
| 161 | "errorbar" => new Chart::Graph::Xmgrace::Errorbar_Options($color), | ||||||||||||||||||||||||||||
| 162 | "comment" => "", | ||||||||||||||||||||||||||||
| 163 | "legend" => "", | ||||||||||||||||||||||||||||
| 164 | }; | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | 30 | ▶ | if ($type eq "XY") { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 167 | 15 | return 1; | |||||||||||||||||||||||||||
| 168 | } elsif ($type eq "BAR") { | ||||||||||||||||||||||||||||
| 169 | 15 | $self->symbol->fill_pattern("1"); | |||||||||||||||||||||||||||
| 170 | 15 | $self->symbol->pattern("0"); | |||||||||||||||||||||||||||
| 171 | 15 | $self->line->type("0"); | |||||||||||||||||||||||||||
| 172 | 15 | return 1; | |||||||||||||||||||||||||||
| 173 | } else { | ||||||||||||||||||||||||||||
| 174 | 0 | carp "Warning: Invalid graph type\n"; | |||||||||||||||||||||||||||
| 175 | 0 | return 0; | |||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 4 | 1; | |||||||||||||||||||||||||||