blib/lib/PSGRAPH.pm

filter: Statementstmt 7.8% 121 / 1552 Branchbran 4.4% 24 / 542 Conditioncond 0.0% 0 / 81 MC/DCmcdc 0.0% 0 / 44 Subroutinesub 62.3% 38 / 61 Podpod 0.0% 0 / 53 totaltotal 7.8% 183 / 2333 CC 310 SCAR 72.0
CC
310
Cov
7%
writeGraphic
5512.3
pie31
650.0
pie4
650.0
CRAP 1342.7
↑ Summary const-xs.inc »
1 package PSGRAPH;
2  
3 1 ▶use 5.8.8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 require Exporter;
9 1 ▶use AutoLoader;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our @ISA = qw(Exporter);
12  
13 # Items to export into callers namespace by default. Note: do not export
14 # names by default without a very good reason. Use EXPORT_OK instead.
15 # Do not simply export all your public functions/methods/constants.
16  
17 # This allows declaration use PSGRAPH ':all';
18 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
19 # will save memory.
20 1 our %EXPORT_TAGS = ( 'all' => [ qw(
21  
22 ) ] );
23  
24 1 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
25  
26 1 our @EXPORT = qw(
27  
28 );
29  
30 1 our $VERSION = '0.05';
31  
32 # This is the default class for the CGI object to use when all else fails.
33 1 ▶my $DefaultClass = 'PSGRAPH' unless defined $PSGRAPH::DefaultClass;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $PSGRAPH::DefaultClass 1 0 1
34  
35 sub new
36 1 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
37 1 my $class = shift;
38 1 my $self = {};
39 1 bless $self, $class;
40 1 return $self;
41 }
42 1 ▶sub setData{
Subroutine setData: called CC=2 SCAR=7.1
Pod undocumented
43 1 my ( $self, $Data) = @_;
44 1 ▶ $self->{Data} = $Data if defined($Data);
Branch: 1 branch
BranchTrueFalseTotal
if defined $Data 1 0 1
45 1 return $self->{Data};
46 }
47 1 ▶sub getData {
Subroutine getData: called CC=1 SCAR=0.0
Pod undocumented
48 1 my( $self ) = @_;
49 1 return $self->{Data};
50 }
51 2 ▶sub setGraphic{
Subroutine setGraphic: called CC=2 SCAR=7.1
Pod undocumented
52 2 my ( $self, $Graphic) = @_;
53 2 ▶ $self->{Graphic} = $Graphic if defined($Graphic);
Branch: 1 branch
BranchTrueFalseTotal
if defined $Graphic 2 0 2
54 2 return $self->{Graphic};
55 }
56 2 ▶sub getGraphic {
Subroutine getGraphic: called CC=1 SCAR=0.0
Pod undocumented
57 2 my( $self ) = @_;
58 2 return $self->{Graphic};
59 }
60 1 ▶sub setLabelandColor{
Subroutine setLabelandColor: called CC=2 SCAR=7.1
Pod undocumented
61 1 my ( $self, $LabelandColor) = @_;
62 1 ▶ $self->{LabelandColor} = $LabelandColor if defined($LabelandColor);
Branch: 1 branch
BranchTrueFalseTotal
if defined $LabelandColor 1 0 1
63 1 return $self->{LabelandColor};
64 }
65 1 ▶sub getLabelandColor {
Subroutine getLabelandColor: called CC=1 SCAR=0.0
Pod undocumented
66 1 my( $self ) = @_;
67 1 return $self->{LabelandColor};
68 }
69  
70 1 ▶sub setPS {
Subroutine setPS: called CC=21 SCAR=56.1
Pod undocumented
71 1 my( $self, $graphic ) = @_;
72 1 my $subtype;
73 1 ▶ if(defined($self->getSubtype)){$subtype=$self->getSubtype; print "subtype is defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getSubtype) 1 0 1
74 1 ▶ if($graphic eq '2Dpie'){
Branch: 3 branches
BranchTrueFalseTotal
if ($graphic eq '2Dpie') { } 0 1 1
elsif ($graphic eq '2Dbar') { } 0 1 1
elsif ($graphic eq '2Dcolumn') { } 0 1 1
75 0 ▶ if((defined($subtype) && $subtype==1) || !defined($subtype)){
Branch: 8 branches
BranchTrueFalseTotal
if (defined $subtype and $subtype == 1 or not defined $subtype) { } 0 0 0
elsif ($subtype == 2) { } 0 0 0
elsif ($subtype == 3) { } 0 0 0
elsif ($subtype == 31) { } 0 0 0
elsif ($subtype == 4) { } 0 0 0
elsif ($subtype == 41) { } 0 0 0
elsif ($subtype == 5) { } 0 0 0
elsif ($subtype == 6) { } 0 0 0
Condition0%0/6
defined $subtype and $subtype == 1 or not defined $subtype
l!l&&r!l&&!r
000
defined $subtype and $subtype == 1
!ll&&!rl&&r
000
MC/DC0%0/3
defined $subtype and $subtype == 1 or not defined $subtype
defined $subtype $subtype == 1 not defined $subtype
Truth table0%0/5
A and B or not(C)
A= defined $subtypeB= $subtype == 1C= not defined $subtype
ABCresult
11X1
0X11
1011
0X00
1000
76 0 $self->{PS} = 'gsave /radius 125 def /slicecount 1 def /pieslice {/label exch def /endangle exch def /startangle exch def /k exch def /y exch def /m exch def /c exch def /calloutline 29 def /labelpos 33 def 0 0 0 1 setcmykcolor .5 setlinewidth gsave 0 0 moveto /halfangle startangle endangle add 2 div def slicecount 2 mod 0 eq{/calloutline 15 def /labelpos 19 def}if halfangle startangle eq {halfangle rotate} {halfangle startangle gt {halfangle rotate}{/halfangle halfangle 180 add def halfangle rotate}ifelse}ifelse /checkangle halfangle def checkangle 360 gt {/checkangle checkangle cvi 360 mod def}if checkangle 90 gt { checkangle 110 lt{ /labelpos labelpos 4 add def }if checkangle 250 lt {checkangle 110 gt {/labelpos labelpos 8 add def}if}if}if checkangle 250 gt {/labelpos labelpos 14 add def}if radius calloutline add 0 lineto stroke grestore halfangle cos radius labelpos add mul typesize 3 checkangle 70 le {mul add}{div sub}ifelse halfangle sin radius labelpos add mul typesize 3 div sub moveto /Helvetica-Bold findfont typesize scalefont setfont ';
77 }elsif($subtype==2){
78 0 $self->{PS} = 'gsave /radius 125 def /slicecount 1 def /pieslice { /percent1 exch def /label1 exch def /endangle exch def /startangle exch def /k exch def /y exch def /m exch def /c exch def /calloutline 29 def /labelpos 33 def 0 0 0 1 setcmykcolor .5 setlinewidth /Helvetica-Bold findfont dup length dict begin {1 index /FID ne {def} {pop pop} ifelse}forall /Encoding ISOLatin1Encoding def currentdict end /Helvetica-Bold-ISOLatin1 exch definefont pop /Helvetica-Bold-ISOLatin1 findfont typesize scalefont setfont gsave 0 0 moveto /halfangle startangle endangle add 2 div def halfangle startangle eq {halfangle rotate} {halfangle startangle gt {halfangle rotate}{/halfangle halfangle 180 add def halfangle rotate}ifelse}ifelse radius calloutline add 0 lineto stroke grestore 0 0 0 1 setcmykcolor halfangle cos radius 45 add mul halfangle sin radius 45 add mul moveto gsave label1 dup stringwidth pop 2 div -1 mul 0 rmoveto show grestore gsave /percentline 1.2 def percent1 dup stringwidth pop 2 div -1 mul typesize percentline mul -1 mul rmoveto show grestore c m y k setcmykcolor 2 setlinejoin 0 0 moveto 0 0 radius startangle endangle arc closepath gsave fill grestore endangle startangle sub 360 ne { 0 0 0 0 setcmykcolor 1.5 setlinewidth stroke}if /slicecount slicecount 1 add def } def';
79 }elsif($subtype==3){
80 0 $self->{PS} = 'gsave /radius 125 def /typesize 8 def /slicecount 1 def /legendtype 16 def /legendbox 21 def /pieslice { /label exch def /endangle exch def /startangle exch def /k exch def /y exch def /m exch def /c exch def /calloutline 29 def /labelpos 33 def c m y k setcmykcolor 2 setlinejoin 0 0 moveto 0 0 radius startangle endangle arc closepath gsave fill grestore 0 0 0 0 setcmykcolor 1.5 setlinewidth stroke /slicecount slicecount 1 add def } def /legend { /vsize exch def /hsize exch def /leftright exch def /ystart exch def /xstart exch def /label exch def /k exch def /y exch def /m exch def /c exch def gsave xstart ystart moveto /legendtype1 legendtype vsize mul def /Helvetica findfont legendtype1 scalefont setfont leftright 1 eq { label stringwidth pop neg legendbox 2 mul sub 0 rmoveto } if /xstart currentpoint pop def 0 legendbox hsize mul rlineto legendbox vsize mul 0 rlineto /minuslegendbox{legendbox -1 mul} def 0 minuslegendbox hsize mul rlineto closepath c m y k setcmykcolor fill 0 0 0 1 setcmykcolor xstart legendbox 2 mul add ystart moveto gsave 1 hsize div 1 vsize div scale label show grestore grestore } def /legend_right { /vsize exch def /hsize exch def /ystart exch def /xstart exch def /label exch def /k exch def /y exch def /m exch def /c exch def gsave xstart ystart moveto /legendtype1 legendtype vsize mul def /Helvetica findfont legendtype1 scalefont setfont /xstart currentpoint pop def 0 legendbox hsize mul rlineto legendbox vsize mul 0 rlineto /minuslegendbox{legendbox -1 mul} def 0 minuslegendbox hsize mul rlineto closepath c m y k setcmykcolor fill 0 0 0 1 setcmykcolor xstart legendbox vsize mul 2 mul add ystart moveto gsave 1 hsize div 1 vsize div scale label show grestore grestore } def /legend_left { /vsize exch def /hsize exch def /ystart exch def /xstart exch def /label exch def /k exch def /y exch def /m exch def /c exch def gsave /xstart xstart 20 sub def xstart ystart moveto gsave 1 hsize div 1 vsize div scale /legendtype1 legendtype vsize mul def /Helvetica findfont legendtype1 scalefont setfont 0 0 0 1 setcmykcolor xstart hsize mul legendbox sub 10 sub label dup stringwidth pop -1 mul 0 rmoveto show 10 0 rmoveto legendbox vsize mul 0 rlineto 0 legendbox vsize mul rlineto /minuslegendbox{legendbox -1 mul} def minuslegendbox vsize mul 0 rlineto closepath c m y k setcmykcolor fill grestore grestore} def';
81 }elsif($subtype==31){
82 0 $self->{PS} = 'gsave /radius 125 def /typesize 14 def /slicecount 1 def /legendbox legendtype 3 add def /pieslice { /endangle exch def /startangle exch def /k exch def /y exch def /m exch def /c exch def /labelpos 39 def 0 0 0 1 setcmykcolor .5 setlinewidth c m y k setcmykcolor 2 setlinejoin 0 0 moveto 0 0 radius startangle endangle arc closepath gsave fill grestore 0 0 0 0 setcmykcolor 1.5 setlinewidth stroke /slicecount slicecount 1 add def } def /legend { /percent1 exch def /vsize exch def /hsize exch def /leftright exch def /ystart exch def /xstart exch def /label exch def /k exch def /y exch def /m exch def /c exch def gsave xstart ystart moveto /Helvetica-Bold findfont legendtype scalefont setfont leftright 1 eq { label stringwidth neg legendbox 2 mul sub 0 rmoveto } if /xstart currentpoint pop def 0 legendbox hsize mul rlineto legendbox vsize mul 0 rlineto /minuslegendbox{legendbox -1 mul} def 0 minuslegendbox hsize mul rlineto closepath c m y k setcmykcolor fill 0 0 0 1 setcmykcolor xstart legendbox vsize mul 2 mul add ystart moveto label show percent1 show grestore } def /legend_right { /percent1 exch def /vsize exch def /hsize exch def /ystart exch def /xstart exch def /label exch def /k exch def /y exch def /m exch def /c exch def gsave xstart ystart moveto /legendtype1 legendtype vsize mul def /Helvetica-Bold findfont legendtype1 scalefont setfont /xstart currentpoint pop def 0 legendbox hsize mul rlineto legendbox vsize mul 0 rlineto /minuslegendbox{legendbox -1 mul} def 0 minuslegendbox hsize mul rlineto closepath c m y k setcmykcolor fill 0 0 0 1 setcmykcolor xstart legendbox vsize mul 2 mul add ystart moveto gsave 1 hsize div 1 vsize div scale gsave label show percent1 show grestore grestore grestore } def grestore ';
83 }elsif($subtype==4){
84 0 $self->{PS} = 'gsave /radius 125 def /slicecount 1 def /legendtype 16 def /legendbox 21 def /pieslice { /percent1 exch def /endangle exch def /startangle exch def /k exch def /y exch def /m exch def /c exch def /calloutline 29 def /labelpos 33 def 0 0 0 1 setcmykcolor .5 setlinewidth /Helvetica findfont dup length dict begin {1 index /FID ne {def} {pop pop} ifelse}forall /Encoding ISOLatin1Encoding def currentdict end /Helvetica-ISOLatin1 exch definefont pop /Helvetica-ISOLatin1 findfont typesize scalefont setfont gsave 0 0 moveto /halfangle startangle endangle add 2 div def halfangle startangle eq {halfangle rotate} {halfangle startangle gt {halfangle rotate}{/halfangle halfangle 180 add def halfangle rotate}ifelse}ifelse radius calloutline add 0 lineto stroke grestore 0 0 0 1 setcmykcolor halfangle cos radius 45 add mul halfangle sin radius 45 add mul moveto gsave percent1 dup stringwidth pop 2 div -1 mul 0 rmoveto show c m y k setcmykcolor 2 setlinejoin 0 0 moveto 0 0 radius startangle endangle arc closepath gsave fill grestore endangle startangle sub 360 ne { 0 0 0 0 setcmykcolor 1.5 setlinewidth stroke}if /slicecount slicecount 1 add def } def /legend { /vsize exch def /hsize exch def /leftright exch def /ystart exch def /xstart exch def /label exch def /k exch def /y exch def /m exch def /c exch def gsave xstart ystart moveto /legendtype1 legendtype vsize mul def /Helvetica findfont legendtype1 scalefont setfont leftright 1 eq { label stringwidth pop neg legendbox 2 mul sub 0 rmoveto } if /xstart currentpoint pop def 0 legendbox hsize mul rlineto legendbox vsize mul 0 rlineto /minuslegendbox{legendbox -1 mul} def 0 minuslegendbox hsize mul rlineto closepath c m y k setcmykcolor fill 0 0 0 1 setcmykcolor xstart legendbox 2 mul add ystart moveto gsave 1 hsize div 1 vsize div scale label show grestore grestore } def /legend_right { /vsize exch def /hsize exch def /ystart exch def /xstart exch def /label exch def /k exch def /y exch def /m exch def /c exch def gsave xstart ystart moveto /legendtype1 legendtype vsize mul def /Helvetica findfont legendtype1 scalefont setfont /xstart currentpoint pop def 0 legendbox hsize mul rlineto legendbox vsize mul 0 rlineto /minuslegendbox{legendbox -1 mul} def 0 minuslegendbox hsize mul rlineto closepath c m y k setcmykcolor fill 0 0 0 1 setcmykcolor xstart legendbox vsize mul 2 mul add ystart moveto gsave 1 hsize div 1 vsize div scale label show grestore grestore } def /legend_left { /vsize exch def /hsize exch def /ystart exch def /xstart exch def /label exch def /k exch def /y exch def /m exch def /c exch def gsave /xstart xstart 20 sub def xstart ystart moveto gsave 1 hsize div 1 vsize div scale /legendtype1 legendtype vsize mul def /Helvetica findfont legendtype1 scalefont setfont 0 0 0 1 setcmykcolor xstart hsize mul legendbox sub 10 sub label dup stringwidth pop -1 mul 0 rmoveto show 10 0 rmoveto legendbox vsize mul 0 rlineto 0 legendbox vsize mul rlineto /minuslegendbox{legendbox -1 mul} def minuslegendbox vsize mul 0 rlineto closepath c m y k setcmykcolor fill grestore grestore} def';
85 }elsif($subtype==41){
86 0 $self->{PS} = 'gsave /radius 125 def /typesize 18 def /slicecount 1 def /pieslice { /percent1 exch def /endangle exch def /startangle exch def /k exch def /y exch def /m exch def /c exch def /calloutline 29 def /labelpos 33 def 0 0 0 1 setcmykcolor .5 setlinewidth /Helvetica-Bold findfont dup length dict begin {1 index /FID ne {def} {pop pop} ifelse}forall /Encoding ISOLatin1Encoding def currentdict end /Helvetica-Bold-ISOLatin1 exch definefont pop /Helvetica-Bold-ISOLatin1 findfont typesize scalefont setfont gsave 0 0 moveto /halfangle startangle endangle add 2 div def halfangle startangle eq {halfangle rotate} {halfangle startangle gt {halfangle rotate}{/halfangle halfangle 180 add def halfangle rotate}ifelse}ifelse radius calloutline add 0 lineto stroke grestore 0 0 0 1 setcmykcolor halfangle cos radius 45 add mul halfangle sin radius 45 add mul moveto gsave percent1 dup stringwidth pop 2 div -1 mul 0 rmoveto show c m y k setcmykcolor 2 setlinejoin 0 0 moveto 0 0 radius startangle endangle arc closepath gsave fill grestore endangle startangle sub 360 ne { 0 0 0 0 setcmykcolor 1.5 setlinewidth stroke}if /slicecount slicecount 1 add def } def';
87 }elsif($subtype==5){
88 0 $self->{PS} = ' gsave /radius 125 def /slicecount 1 def /pieslice { /sectionanchor exch def /explodeoffset exch def /label exch def /endangle exch def /startangle exch def /k exch def /y exch def /m exch def /c exch def gsave sectionanchor cos explodeoffset mul sectionanchor sin explodeoffset mul translate 0 0 moveto /Helvetica-Bold findfont typesize scalefont setfont '
89 # }elsif((defined($subtype) && $subtype==6) || !defined($subtype)){
90 }elsif($subtype==6){
91 0 $self->{PS} = 'gsave /radius 125 def /slicecount 1 def /pieslice {/label exch def /endangle exch def /startangle exch def /k exch def /y exch def /m exch def /c exch def c m y k setcmykcolor 2 setlinejoin 0 0 moveto 0 0 radius startangle endangle arc closepath gsave fill grestore 0 0 0 0 setcmykcolor 1.5 setlinewidth stroke /slicecount slicecount 1 add def} def '
92 }else{
93 0 $self->{PS} = 'ERROR: Unsupported subtype.';
94 }
95 }elsif($graphic eq '2Dbar'){
96 0 ▶ if((defined($subtype) && $subtype==1) || !defined($subtype)){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $subtype and $subtype == 1 or not defined $subtype) { } 0 0 0
Condition0%0/6
defined $subtype and $subtype == 1 or not defined $subtype
l!l&&r!l&&!r
000
defined $subtype and $subtype == 1
!ll&&!rl&&r
000
MC/DC0%0/3
defined $subtype and $subtype == 1 or not defined $subtype
defined $subtype $subtype == 1 not defined $subtype
Truth table0%0/5
A and B or not(C)
A= defined $subtypeB= $subtype == 1C= not defined $subtype
ABCresult
11X1
0X11
1011
0X00
1000
97 0 $self->{PS} = '/typecolor {0 setgray} def /straighttype {/stst exch def gsave 1 hsize div 1 vsize div scale stst show grestore} def /rectoffset 2 def /Helvetica findfont 9 scalefont setfont /centertype { /hpos exch def /cpos exch def /ctstring exch def ctstring stringwidth pop 2 div cpos exch sub hpos moveto ctstring straighttype} def /fillrect { /rectheight exch def /rectwidth exch def /lly exch def /llx exch def llx lly moveto 0 rectheight rlineto rectwidth 0 rlineto 0 rectheight neg rlineto closepath fill }def /outlinerect {/rectheight exch def /rectwidth exch def /lly exch def /llx exch def llx lly moveto 0 rectheight rlineto rectwidth 0 rlineto 0 rectheight neg rlineto closepath stroke } def /bar { /barwidth exch def /barstart exch def /l2 exch def /l1 exch def /barvalue exch def /barlength exch def /pos exch def /k exch def /y exch def /m exch def /c exch def /st barstart def headertype l1 0 st barwidth 3 div add 12 add moveto straighttype l2 0 st barwidth 3 div add moveto straighttype valuecolor valuetype barvalue 80 barlength add barstart barwidth 3 div add moveto straighttype c m y k setcmykcolor 72 st barlength barwidth fillrect } def /bkgroundbox { /bheight exch def /bwidth exch def /by exch def /bx exch def bkground bx by bwidth bheight fillrect .5 setlinewidth typecolor bx by moveto 0 bheight rlineto bwidth 0 rlineto 0 bheight neg rlineto closepath stroke } def /chartscale { /vsize exch def /hsize exch def /barwidth exch def /bardepth exch def /val5 exch def /val4 exch def /val3 exch def /val2 exch def /val1 exch def /val0 exch def axistype typecolor .5 setlinewidth /fifthline {barwidth 5 div} def 0 fifthline barwidth { /x exch def 71 x add 0 moveto gsave 0 bardepth rlineto stroke grestore } for val0 71 -12 centertype val1 71 fifthline add -12 centertype val2 71 fifthline 2 mul add -12 centertype val3 71 fifthline 3 mul add -12 centertype val4 71 fifthline 4 mul add -12 centertype val5 71 fifthline 5 mul add -12 centertype } def';
98 }else{
99 0 $self->{PS} = 'ERROR: Unsupported subtype.';
100 }
101 }elsif($graphic eq '2Dcolumn'){
102 0 ▶ if((defined($subtype) && $subtype==1) || !defined($subtype)){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $subtype and $subtype == 1 or not defined $subtype) { } 0 0 0
Condition0%0/6
defined $subtype and $subtype == 1 or not defined $subtype
l!l&&r!l&&!r
000
defined $subtype and $subtype == 1
!ll&&!rl&&r
000
MC/DC0%0/3
defined $subtype and $subtype == 1 or not defined $subtype
defined $subtype $subtype == 1 not defined $subtype
Truth table0%0/5
A and B or not(C)
A= defined $subtypeB= $subtype == 1C= not defined $subtype
ABCresult
11X1
0X11
1011
0X00
1000
103 0 $self->{PS} = '/shadowblk 0.5 def /typecolor {0 setgray} def /straighttype {/stst exch def gsave 1 hsize div 1 vsize div scale stst show grestore} def/rectoffset 2 def /Helvetica findfont 9 scalefont setfont /centertype { /hpos exch def /cpos exch def /ctstring exch def ctstring stringwidth pop 2 div cpos exch sub hpos moveto ctstring straighttype} def /fillrect { /rectheight exch def /rectwidth exch def /lly exch def /llx exch def llx lly moveto 0 rectheight rlineto rectwidth 0 rlineto 0 rectheight neg rlineto closepath fill }def /column { /ccwidth exch def /cstart exch def /l2 exch def /l1 exch def /cvalue exch def /height exch def /pos exch def /k exch def /y exch def /m exch def /c exch def /st cstart def headertype l1 st ccwidth 2 div add 262 vsize mul 12 add centertype l2 st ccwidth 2 div add 262 vsize mul centertype typecolor valuetype cvalue st ccwidth 2 div add 226 vsize mul centertype /blkstep{ shadowblk k sub ccwidth 3 div div } def /shadowblk1 shadowblk def 1 1 ccwidth 3 div{ c m y shadowblk1 setcmykcolor st 0 1 height fillrect /st st 1 add def /shadowblk1 shadowblk1 blkstep sub def }for c m y shadowblk1 setcmykcolor st 0 ccwidth 3 div height fillrect /st st ccwidth 3 div add def 1 1 ccwidth 3 div{ c m y shadowblk1 setcmykcolor st 0 1 height fillrect /st st 1 add def /shadowblk1 shadowblk1 blkstep add def }for } def /bkgroundbox { /bheight exch def /bwidth exch def /by exch def /bx exch def bkground bx by bwidth bheight fillrect .5 setlinewidth typecolor bx by moveto 0 bheight rlineto bwidth 0 rlineto 0 bheight neg rlineto closepath stroke } def /chartscale { /vsize exch def /hsize exch def /cwidth exch def /val5 exch def /val4 exch def /val3 exch def /val2 exch def /val1 exch def /val0 exch def axistype typecolor .5 setlinewidth 0 43 vsize mul 214 vsize mul 1 sub { /y exch def 71 y moveto cwidth 0 rlineto } for stroke val0 dup gsave 1 hsize div 1 scale stringwidth grestore pop 69 exch sub 0 moveto straighttype val1 dup gsave 1 hsize div 1 scale stringwidth grestore pop 69 exch sub 41 vsize mul moveto straighttype val2 dup gsave 1 hsize div 1 scale stringwidth grestore pop 69 exch sub 84 vsize mul moveto straighttype val3 dup gsave 1 hsize div 1 scale stringwidth grestore pop 69 exch sub 127 vsize mul moveto straighttype val4 dup gsave 1 hsize div 1 scale stringwidth grestore pop 69 exch sub 170 vsize mul moveto straighttype val5 dup gsave 1 hsize div 1 scale stringwidth grestore pop 69 exch sub 213 vsize mul moveto straighttype } def';
104 }else{
105 0 $self->{PS} = 'ERROR: Unsupported subtype.';
106 }
107 }else{
108 1 $self->{PS} = 'ERROR: Unsupported graphic.';
109 }
110 1 return $self->{PS};
111 }
112 0 ▶sub getPS{
Subroutine getPS: not called CC=1 SCAR=6.9
Pod undocumented
113 0 my($self)=@_;
114 0 return $self->{PS};
115 }
116 1 ▶sub setSubtype{
Subroutine setSubtype: called CC=2 SCAR=7.1
Pod undocumented
117 1 my ( $self, $Subtype) = @_;
118 1 ▶ $self->{Subtype} = $Subtype if defined($Subtype);
Branch: 1 branch
BranchTrueFalseTotal
if defined $Subtype 1 0 1
119 1 return $self->{Subtype};
120 }
121 3 ▶sub getSubtype {
Subroutine getSubtype: called CC=1 SCAR=0.0
Pod undocumented
122 3 my( $self ) = @_;
123 3 return $self->{Subtype};
124 }
125 1 ▶sub setHscale{
Subroutine setHscale: called CC=2 SCAR=7.1
Pod undocumented
126 1 my ( $self, $hscale) = @_;
127 1 ▶ $self->{Hscale} = $hscale if defined($hscale);
Branch: 1 branch
BranchTrueFalseTotal
if defined $hscale 1 0 1
128 1 return $self->{Hscale};
129 }
130 1 ▶sub getHscale {
Subroutine getHscale: called CC=1 SCAR=0.0
Pod undocumented
131 1 my( $self ) = @_;
132 1 return $self->{Hscale};
133 }
134 1 ▶sub setVscale{
Subroutine setVscale: called CC=2 SCAR=7.1
Pod undocumented
135 1 my ( $self, $vscale) = @_;
136 1 ▶ $self->{Vscale} = $vscale if defined($vscale);
Branch: 1 branch
BranchTrueFalseTotal
if defined $vscale 1 0 1
137 1 return $self->{Vscale};
138 }
139 1 ▶sub getVscale {
Subroutine getVscale: called CC=1 SCAR=0.0
Pod undocumented
140 1 my( $self ) = @_;
141 1 return $self->{Vscale};
142 }
143 0 ▶sub setInitialdegree{
Subroutine setInitialdegree: not called CC=2 SCAR=17.9
Pod undocumented
144 0 my ( $self, $initialdegree) = @_;
145 0 ▶ $self->{Initialdegree} = $initialdegree if defined($initialdegree);
Branch: 1 branch
BranchTrueFalseTotal
if defined $initialdegree 0 0 0
146 0 return $self->{Initialdegree};
147 }
148 0 ▶sub getInitialdegree {
Subroutine getInitialdegree: not called CC=1 SCAR=6.9
Pod undocumented
149 0 my( $self ) = @_;
150 0 return $self->{Initialdegree};
151 }
152 0 ▶sub setGexport{
Subroutine setGexport: not called CC=2 SCAR=17.9
Pod undocumented
153 0 my ( $self, $gexport) = @_;
154 0 ▶ $self->{Gexport} = $gexport if defined($gexport);
Branch: 1 branch
BranchTrueFalseTotal
if defined $gexport 0 0 0
155 0 return $self->{Gexport};
156 }
157 0 ▶sub getGexport {
Subroutine getGexport: not called CC=1 SCAR=6.9
Pod undocumented
158 0 my( $self ) = @_;
159 0 return $self->{Gexport};
160 }
161 0 ▶sub setLegend{
Subroutine setLegend: not called CC=2 SCAR=17.9
Pod undocumented
162 0 my ( $self, $legend) = @_;
163 0 ▶ $self->{Legend} = $legend if defined($legend);
Branch: 1 branch
BranchTrueFalseTotal
if defined $legend 0 0 0
164 0 return $self->{Legend};
165 }
166 0 ▶sub getLegend {
Subroutine getLegend: not called CC=1 SCAR=6.9
Pod undocumented
167 0 my( $self ) = @_;
168 0 return $self->{Legend};
169 }
170 1 ▶sub setColumnwidth {
Subroutine setColumnwidth: called CC=2 SCAR=7.1
Pod undocumented
171 1 my ( $self, $columnwidth) = @_;
172 1 ▶ $self->{Columnwidth} = $columnwidth if defined($columnwidth);
Branch: 1 branch
BranchTrueFalseTotal
if defined $columnwidth 1 0 1
173 1 return $self->{Columnwidth};
174 }
175 1 ▶sub getColumnwidth {
Subroutine getColumnwidth: called CC=1 SCAR=0.0
Pod undocumented
176 1 my( $self ) = @_;
177 1 return $self->{Columnwidth};
178 }
179 1 ▶sub setFormat {
Subroutine setFormat: called CC=2 SCAR=7.1
Pod undocumented
180 1 my ( $self, $format) = @_;
181 1 ▶ $self->{Format} = $format if defined($format);
Branch: 1 branch
BranchTrueFalseTotal
if defined $format 1 0 1
182 1 return $self->{Format};
183 }
184 1 ▶sub getFormat {
Subroutine getFormat: called CC=1 SCAR=0.0
Pod undocumented
185 1 my( $self ) = @_;
186 1 return $self->{Format};
187 }
188 1 ▶sub setHeadertype {
Subroutine setHeadertype: called CC=2 SCAR=7.1
Pod undocumented
189 1 my ( $self, $headertype) = @_;
190 1 ▶ $self->{Headertype} = $headertype if defined($headertype);
Branch: 1 branch
BranchTrueFalseTotal
if defined $headertype 1 0 1
191 1 return $self->{Headertype};
192 }
193 1 ▶sub getHeadertype {
Subroutine getHeadertype: called CC=1 SCAR=0.0
Pod undocumented
194 1 my( $self ) = @_;
195 1 return $self->{Headertype};
196 }
197 1 ▶sub setAxistype {
Subroutine setAxistype: called CC=2 SCAR=7.1
Pod undocumented
198 1 my ( $self, $axistype) = @_;
199 1 ▶ $self->{Axistype} = $axistype if defined($axistype);
Branch: 1 branch
BranchTrueFalseTotal
if defined $axistype 1 0 1
200 1 return $self->{Axistype};
201 }
202 1 ▶sub getAxistype {
Subroutine getAxistype: called CC=1 SCAR=0.0
Pod undocumented
203 1 my( $self ) = @_;
204 1 return $self->{Axistype};
205 }
206 1 ▶sub setValuetype {
Subroutine setValuetype: called CC=2 SCAR=7.1
Pod undocumented
207 1 my ( $self, $valuetype) = @_;
208 1 ▶ $self->{Valuetype} = $valuetype if defined($valuetype);
Branch: 1 branch
BranchTrueFalseTotal
if defined $valuetype 1 0 1
209 1 return $self->{Valuetype};
210 }
211 1 ▶sub getValuetype {
Subroutine getValuetype: called CC=1 SCAR=0.0
Pod undocumented
212 1 my( $self ) = @_;
213 1 return $self->{Valuetype};
214 }
215 1 ▶sub setValuecolor {
Subroutine setValuecolor: called CC=2 SCAR=7.1
Pod undocumented
216 1 my ( $self, $valuetype) = @_;
217 1 ▶ $self->{Valuecolor} = $valuetype if defined($valuetype);
Branch: 1 branch
BranchTrueFalseTotal
if defined $valuetype 1 0 1
218 1 return $self->{Valuecolor};
219 }
220 1 ▶sub getValuecolor {
Subroutine getValuecolor: called CC=1 SCAR=0.0
Pod undocumented
221 1 my( $self ) = @_;
222 1 return $self->{Valuecolor};
223 }
224 1 ▶sub setBackgroundcolor {
Subroutine setBackgroundcolor: called CC=2 SCAR=7.1
Pod undocumented
225 1 my ( $self, $backgroundcolor) = @_;
226 1 ▶ $self->{Backgroundcolor} = $backgroundcolor if defined($backgroundcolor);
Branch: 1 branch
BranchTrueFalseTotal
if defined $backgroundcolor 1 0 1
227 1 return $self->{Backgroundcolor};
228 }
229 1 ▶sub getBackgroundcolor {
Subroutine getBackgroundcolor: called CC=1 SCAR=0.0
Pod undocumented
230 1 my( $self ) = @_;
231 1 return $self->{Backgroundcolor};
232 }
233 1 ▶sub setHeadercolor {
Subroutine setHeadercolor: called CC=2 SCAR=7.1
Pod undocumented
234 1 my ( $self, $headercolor) = @_;
235 1 ▶ $self->{Headercolor} = $headercolor if defined($headercolor);
Branch: 1 branch
BranchTrueFalseTotal
if defined $headercolor 1 0 1
236 1 return $self->{Headercolor};
237 }
238 1 ▶sub getHeadercolor {
Subroutine getHeadercolor: called CC=1 SCAR=0.0
Pod undocumented
239 1 my( $self ) = @_;
240 1 return $self->{Headercolor};
241 }
242 0 ▶sub setExplodeoffset{
Subroutine setExplodeoffset: not called CC=2 SCAR=17.9
Pod undocumented
243 0 my ( $self, $explodeoffset) = @_;
244 0 ▶ $self->{Explodeoffset} = $explodeoffset if defined($explodeoffset);
Branch: 1 branch
BranchTrueFalseTotal
if defined $explodeoffset 0 0 0
245 0 return $self->{Explodeoffset};
246 }
247 0 ▶sub getExplodeoffset {
Subroutine getExplodeoffset: not called CC=1 SCAR=6.9
Pod undocumented
248 0 my( $self ) = @_;
249 0 return $self->{Explodeoffset};
250 }
251 0 ▶sub showInfo{
Subroutine showInfo: not called CC=15 SCAR=54.8
Pod undocumented
252 0 my( $self ) = @_;
253 0 print "LabelandColor: " . $self->getLabelandColor . "\n";
254 0 print "Data: " . $self->getData . "\n";
255 0 print "Graphic: " . $self->getGraphic . "\n";
256 0 print "PS: " . $self->getPS . "\n";
257 0 ▶ if(defined($self->getSubtype)){print "Subtype: " . $self->getSubtype . "\n";}else{print "Subtype: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getSubtype) { } 0 0 0
258 0 ▶ if(defined($self->getHscale)){print "Hscale: " . $self->getHscale . "\n";}else{print "Hscale: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getHscale) { } 0 0 0
259 0 ▶ if(defined($self->getVscale)){print "Vscale: " . $self->getVscale . "\n";}else{print "Vscale: Not Defined\n";};
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getVscale) { } 0 0 0
260 0 ▶ if(defined($self->getGexport)){print "Gexport: " . $self->getGexport . "\n";}else{print "Gexport: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getGexport) { } 0 0 0
261 0 ▶ if(defined($self->getLegend)){print "Legend: " . $self->getLegend . "\n";}else{print "Legend: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getLegend) { } 0 0 0
262 0 ▶ if(defined($self->getColumnwidth)){print "Columnwidth: " . $self->getColumnwidth . "\n";}else{print "Columnwidth: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getColumnwidth) { } 0 0 0
263 0 ▶ if(defined($self->getFormat)){print "Format: " . $self->getFormat . "\n";}else{print "Format: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getFormat) { } 0 0 0
264 0 ▶ if(defined($self->getHeadertype)){print "Headertype: " . $self->getHeadertype . "\n";}else{print "Headertype: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getHeadertype) { } 0 0 0
265 0 ▶ if(defined($self->getAxistype)){print "Axistype: " . $self->getAxistype . "\n";}else{print "Axistype: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getAxistype) { } 0 0 0
266 0 ▶ if(defined($self->getValuetype)){print "Valuetype: " . $self->getValuetype . "\n";}else{print "Valuetype: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getValuetype) { } 0 0 0
267 0 ▶ if(defined($self->getBackgroundcolor)){print "Backgroundcolor: " . $self->getBackgroundcolor . "\n";}else{print "Backgroundcolor: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getBackgroundcolor) { } 0 0 0
268 0 ▶ if(defined($self->getHeadercolor)){print "Headercolor: " . $self->getHeadercolor . "\n";}else{print "Headercolor: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getHeadercolor) { } 0 0 0
269 0 ▶ if(defined($self->getExplodeoffset)){print "Explodeoffset: " . $self->getExplodeoffset . "\n";}else{print "Explodeoffset: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getExplodeoffset) { } 0 0 0
270 0 ▶ if(defined($self->getInitialdegree)){print "Initialdegree: " . $self->getInitialdegree . "\n";}else{print "Initialdegree: Not Defined\n";}
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->getInitialdegree) { } 0 0 0
271 }
272 1 ▶sub writeGraphic {
Subroutine writeGraphic: called CC=76 SCAR=86.1
Pod undocumented
273 1 my( $self ) = @_;
274 1 ▶ if($self->{Graphic} eq '2Dpie'){
Branch: 3 branches
BranchTrueFalseTotal
if ($self->{'Graphic'} eq '2Dpie') { } 0 1 1
elsif ($self->{'Graphic'} eq '2Dcolumn') { } 0 1 1
elsif ($self->{'Graphic'} eq '2Dbar') { } 0 1 1
275 #translate data into degrees in a circle for pie
276 0 my $transdata=&data2degrees($self->{Data});
277 0 ▶ if(defined($self->{Data}) && defined($self->{LabelandColor})){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'Data'} and defined $self->{'LabelandColor'}) { } 0 0 0
Condition0%0/3
defined $self->{"Data"} and defined $self->{"LabelandColor"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"Data"} and defined $self->{"LabelandColor"}
defined $self->{"Data"} defined $self->{"LabelandColor"}
Truth table0%0/3
A and B
A= defined $self->{"Data"}B= defined $self->{"LabelandColor"}
ABresult
0X0
100
111
278 0 ▶ if(!defined($self->{Hscale})){$self->{Hscale}=1;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Hscale"}) 0 0 0
279 0 ▶ if(!defined($self->{Vscale})){$self->{Vscale}=1;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Vscale"}) 0 0 0
280 0 ▶ if(!defined($self->{Gexport})){$self->{Gexport}='';}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Gexport"}) 0 0 0
281 0 ▶ if(!defined($self->{Valuetype})){$self->{Valuetype}=8;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Valuetype"}) 0 0 0
282 0 ▶ if(!defined($self->{Explodeoffset})){$self->{Expoldeoffset}=12;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Explodeoffset"}) 0 0 0
283 0 ▶ if(!defined($self->{Initialdegree})){$self->{Initialdegree}=120;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Initialdegree"}) 0 0 0
284 0 ▶ if((defined($self->{Subtype}) && $self->{Subtype}==1) || !defined($self->{Subtype})){
Branch: 6 branches
BranchTrueFalseTotal
if (defined $self->{'Subtype'} and $self->{'Subtype'} == 1 or not defined $self->{'Subtype'}) { } 0 0 0
elsif (defined $self->{'Subtype'} and $self->{'Subtype'} == 2) { } 0 0 0
elsif (defined $self->{'Subtype'} and $self->{'Subtype'} == 3 || $self->{'Subtype'} == 31 || $self->{'Subtype'} == 4) { } 0 0 0
elsif ($self->{'Subtype'} == 41) { } 0 0 0
elsif (defined $self->{'Subtype'} and $self->{'Subtype'} == 5) { } 0 0 0
elsif (defined $self->{'Subtype'} and $self->{'Subtype'} == 6 or not defined $self->{'Subtype'}) { } 0 0 0
Condition0%0/6
defined $self->{"Subtype"} and $self->{"Subtype"} == 1 or not defined $self->{"Subtype"}
l!l&&r!l&&!r
000
defined $self->{"Subtype"} and $self->{"Subtype"} == 1
!ll&&!rl&&r
000
MC/DC0%0/3
defined $self->{"Subtype"} and $self->{"Subtype"} == 1 or not defined $self->{"Subtype"}
defined $self->{"Subtype"} $self->{"Subtype"} == 1 not defined $self->{"Subtype"}
Truth table0%0/5
A and B or not(C)
A= defined $self->{"Subtype"}B= $self->{"Subtype"} == 1C= not defined $self->{"Subtype"}
ABCresult
11X1
0X11
1011
0X00
1000
285 0 return &pie1($self->{Initialdegree},$self->{PS}, $transdata, $self->{LabelandColor}, $self->{Hscale}, $self->{Vscale}, $self->{Gexport}, $self->{Valuetype});
286 ▶ }elsif((defined($self->{Subtype}) && $self->{Subtype}==2)){
Condition0%0/3
defined $self->{"Subtype"} and $self->{"Subtype"} == 2
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"Subtype"} and $self->{"Subtype"} == 2
defined $self->{"Subtype"} $self->{"Subtype"} == 2
Truth table0%0/3
A and B
A= defined $self->{"Subtype"}B= $self->{"Subtype"} == 2
ABresult
0X0
100
111
287 0 return &pie2($self->{Initialdegree},$self->{PS}, $transdata, $self->{LabelandColor}, $self->{Hscale}, $self->{Vscale}, $self->{Gexport}, $self->{Valuetype});
288 ▶ }elsif(defined($self->{Subtype}) && ($self->{Subtype}==3 || $self->{Subtype}==31 || $self->{Subtype}==4)){
Condition0%0/9
defined $self->{"Subtype"} and $self->{"Subtype"} == 3 || $self->{"Subtype"} == 31 || $self->{"Subtype"} == 4
!ll&&!rl&&r
000
$self->{"Subtype"} == 3 or $self->{"Subtype"} == 31 or $self->{"Subtype"} == 4
l!l&&r!l&&!r
000
$self->{"Subtype"} == 3 or $self->{"Subtype"} == 31
l!l&&r!l&&!r
000
MC/DC0%0/4
defined $self->{"Subtype"} and $self->{"Subtype"} == 3 || $self->{"Subtype"} == 31 || $self->{"Subtype"} == 4
defined $self->{"Subtype"} $self->{"Subtype"} == 3 $self->{"Subtype"} == 31 $self->{"Subtype"} == 4
Truth table0%0/5
A and B or C or D
A= defined $self->{"Subtype"}B= $self->{"Subtype"} == 3C= $self->{"Subtype"} == 31D= $self->{"Subtype"} == 4
ABCDresult
0XXX0
10000
11XX1
101X1
10011
289 0 ▶ if(!defined($self->{Legend})){$self->setLegend('right');}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Legend"}) 0 0 0
290 0 my $leg=$self->getLegend;
291 0 ▶ if($leg eq 'right' || $leg eq 'left' || $leg eq 'bottom'){
Branch: 1 branch
BranchTrueFalseTotal
if ($leg eq 'right' or $leg eq 'left' or $leg eq 'bottom') { } 0 0 0
Condition0%0/6
$leg eq "right" or $leg eq "left" or $leg eq "bottom"
l!l&&r!l&&!r
000
$leg eq "right" or $leg eq "left"
l!l&&r!l&&!r
000
MC/DC0%0/3
$leg eq "right" or $leg eq "left" or $leg eq "bottom"
$leg eq "right" $leg eq "left" $leg eq "bottom"
Truth table0%0/4
A or B or C
A= $leg eq "right"B= $leg eq "left"C= $leg eq "bottom"
ABCresult
1XX1
01X1
0011
0000
292 0 ▶ if($self->{Subtype}==3){
Branch: 3 branches
BranchTrueFalseTotal
if ($self->{'Subtype'} == 3) { } 0 0 0
elsif ($self->{'Subtype'} == 31) { } 0 0 0
elsif ($self->{'Subtype'} == 4) { } 0 0 0
293 0 return &pie3($self->{Initialdegree},$self->{PS}, $transdata, $self->{LabelandColor}, $self->{Hscale}, $self->{Vscale}, $self->{Gexport}, $self->getLegend, $self->{Valuetype});
294 }elsif($self->{Subtype}==31){
295 0 return &pie31($self->{Initialdegree},$self->{PS}, $transdata, $self->{LabelandColor}, $self->{Hscale}, $self->{Vscale}, $self->{Gexport}, $self->getLegend, $self->{Valuetype});
296 }elsif($self->{Subtype}==4){
297 0 return &pie4($self->{Initialdegree},$self->{PS}, $transdata, $self->{LabelandColor}, $self->{Hscale}, $self->{Vscale}, $self->{Gexport}, $self->getLegend, $self->{Valuetype});
298 }
299 }else{
300 0 return "Legend must be right, left or bottom.";
301 }
302 }elsif($self->{Subtype}==41){
303 0 return &pie41($self->{Initialdegree},$self->{PS}, $transdata, $self->{LabelandColor}, $self->{Hscale}, $self->{Vscale}, $self->{Gexport}, $self->{Valuetype});
304 ▶ }elsif((defined($self->{Subtype}) && $self->{Subtype}==5)){
Condition0%0/3
defined $self->{"Subtype"} and $self->{"Subtype"} == 5
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"Subtype"} and $self->{"Subtype"} == 5
defined $self->{"Subtype"} $self->{"Subtype"} == 5
Truth table0%0/3
A and B
A= defined $self->{"Subtype"}B= $self->{"Subtype"} == 5
ABresult
0X0
100
111
305 #set centers for section translations for exploded pies
306 #step through slices and add degrees to combine them into sections
307 0 my $sectionends="";
308 0 my @sectionarray="";
309 0 my $sectionend;
310 my $sectioncenters;
311 0 my $currentsection=1;
312 0 my $currentslice=0;
313 0 my @lc;
314 my @da;
315 0 my $dalength;
316 0 my $transdata1='trans1';
317 #create an string, comma delimited, with the field numbers of the end sections
318 0 ▶ open(LC,$self->{LabelandColor}) || die "Cannot open LabelAndColor!\n";
Branch: 1 branch
BranchTrueFalseTotal
open LC, $self->{"LabelandColor"} or die "Cannot open LabelAndColor!\n" 0 0 0
319 0 ▶ while(<LC>){
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline LC)) 0 0 0
320 0 @lc = split/\t/;
321 0 chomp;
322 0 $currentslice++;
323 0 ▶ if($lc[5] != $currentsection){
Branch: 1 branch
BranchTrueFalseTotal
if ($lc[5] != $currentsection) 0 0 0
324 0 $sectionend=int($currentslice)-1;
325 0 ▶ if(length($sectionends)>0){$sectionends.=",";}
Branch: 1 branch
BranchTrueFalseTotal
if (length $sectionends > 0) 0 0 0
326 0 $sectionends.=$sectionend;
327 0 $currentsection=$lc[5];
328 }
329 }
330 0 $sectionends.="," . $currentslice;
331 #add the halfangles of the sections in a comma delimited string to the end of the row in transdata
332 0 ▶ open(TRANS, "<$transdata") || die "Cannot open transdata for reading!\n";
Branch: 1 branch
BranchTrueFalseTotal
open TRANS, "<$transdata" or die "Cannot open transdata for reading!\n" 0 0 0
333 0 ▶ open(TRANSPLUS, ">$transdata1") || die "Cannot open transdata1 for writing!\n";
Branch: 1 branch
BranchTrueFalseTotal
open TRANSPLUS, ">$transdata1" or die "Cannot open transdata1 for writing!\n" 0 0 0
334 0 my $sectionmiddle="";
335 0 ▶ while(<TRANS>){
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline TRANS)) 0 0 0
336 0 chomp;
337 0 my $dataline=$_;
338 0 @da = split/\t/;
339 0 $dalength=@da;
340 0 @sectionarray=split/,/,$sectionends;
341 0 my $salength=@sectionarray;
342 0 my $secdegrees=0;
343 0 my $lastsection=0;
344 0 my $thissection=0;
345 0 my $jj=$sectionarray[$thissection];
346 0 ▶ for(my $ii=0; $ii<$dalength ; $ii++){
Branch: 1 branch
BranchTrueFalseTotal
if ($ii < $dalength) 0 0 0
347 0 ▶ if($ii==$jj){
Branch: 1 branch
BranchTrueFalseTotal
if ($ii == $jj) 0 0 0
348 0 ▶ if(length($sectionmiddle)>0){$sectionmiddle.=',';}
Branch: 1 branch
BranchTrueFalseTotal
if (length $sectionmiddle > 0) 0 0 0
349 0 $sectionmiddle.=(.5)*($secdegrees+$lastsection);
350 0 $lastsection=$secdegrees;
351 0 $thissection++;
352 0 $jj=$sectionarray[$thissection];
353 0 ▶ if($thissection==($salength-1)){
Branch: 1 branch
BranchTrueFalseTotal
if ($thissection == $salength - 1) 0 0 0
354 0 $sectionmiddle.="," . (.5)*(360+$secdegrees);
355 0 last;
356 }
357 }
358 0 $secdegrees+=$da[$ii];
359 }
360 0 print TRANSPLUS $dataline . "\t$sectionmiddle\n";
361 0 $sectionmiddle="";
362 }
363 0 close TRANSPLUS;
364 0 return &pie5($self->{Initialdegree},$self->{PS}, $transdata1, $self->{LabelandColor}, $self->{Hscale}, $self->{Vscale}, $self->{Gexport}, $self->{Valuetype}, $self->{Explodeoffset}, $sectionends);
365 ▶ }elsif((defined($self->{Subtype}) && $self->{Subtype}==6) || !defined($self->{Subtype})){
Condition0%0/6
defined $self->{"Subtype"} and $self->{"Subtype"} == 6 or not defined $self->{"Subtype"}
l!l&&r!l&&!r
000
defined $self->{"Subtype"} and $self->{"Subtype"} == 6
!ll&&!rl&&r
000
MC/DC0%0/3
defined $self->{"Subtype"} and $self->{"Subtype"} == 6 or not defined $self->{"Subtype"}
defined $self->{"Subtype"} $self->{"Subtype"} == 6 not defined $self->{"Subtype"}
Truth table0%0/5
A and B or not(C)
A= defined $self->{"Subtype"}B= $self->{"Subtype"} == 6C= not defined $self->{"Subtype"}
ABCresult
11X1
0X11
1011
0X00
1000
366 0 return &pie6($self->{Initialdegree},$self->{PS}, $transdata, $self->{LabelandColor}, $self->{Hscale}, $self->{Vscale}, $self->{Gexport}, $self->{Valuetype});
367 }
368 }else{
369 0 return "Both the data file (setData) and the color file (setLabelandColor) must be defined.";
370 }
371 }elsif($self->{Graphic} eq '2Dcolumn'){
372 0 ▶ if(defined($self->{Data}) && defined($self->{LabelandColor})){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'Data'} and defined $self->{'LabelandColor'}) { } 0 0 0
Condition0%0/3
defined $self->{"Data"} and defined $self->{"LabelandColor"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"Data"} and defined $self->{"LabelandColor"}
defined $self->{"Data"} defined $self->{"LabelandColor"}
Truth table0%0/3
A and B
A= defined $self->{"Data"}B= defined $self->{"LabelandColor"}
ABresult
0X0
100
111
373 0 ▶ if(!defined($self->{Hscale})){$self->{Hscale}=1;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Hscale"}) 0 0 0
374 0 ▶ if(!defined($self->{Vscale})){$self->{Vscale}=1;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Vscale"}) 0 0 0
375 0 ▶ if(!defined($self->{Gexport})){$self->{Gexport}='';}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Gexport"}) 0 0 0
376 0 ▶ if(!defined($self->{Columnwidth})){$self->{Columnwidth}=36;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Columnwidth"}) 0 0 0
377 0 ▶ if(!defined($self->{Format})){$self->{Format}="money";}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Format"}) 0 0 0
378 0 ▶ if(!defined($self->{Headertype})){$self->{Headertype}=9;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Headertype"}) 0 0 0
379 0 ▶ if(!defined($self->{Valuetype})){$self->{Valuetype}=9;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Valuetype"}) 0 0 0
380 0 ▶ if(!defined($self->{Axistype})){$self->{Axistype}=8;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Axistype"}) 0 0 0
381 0 ▶ if(!defined($self->{Backgroundcolor})){$self->{Backgroundcolor}='.3 0 .15 .09';}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Backgroundcolor"}) 0 0 0
382 0 ▶ if(!defined($self->{Headercolor})){$self->{Headercolor}='0 0 0 1';}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Headercolor"}) 0 0 0
383 0 ▶ if((defined($self->{Subtype}) && $self->{Subtype}==1) || !defined($self->{Subtype})){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"Subtype"} and $self->{"Subtype"} == 1 or not defined $self->{"Subtype"}) 0 0 0
Condition0%0/6
defined $self->{"Subtype"} and $self->{"Subtype"} == 1 or not defined $self->{"Subtype"}
l!l&&r!l&&!r
000
defined $self->{"Subtype"} and $self->{"Subtype"} == 1
!ll&&!rl&&r
000
MC/DC0%0/3
defined $self->{"Subtype"} and $self->{"Subtype"} == 1 or not defined $self->{"Subtype"}
defined $self->{"Subtype"} $self->{"Subtype"} == 1 not defined $self->{"Subtype"}
Truth table0%0/5
A and B or not(C)
A= defined $self->{"Subtype"}B= $self->{"Subtype"} == 1C= not defined $self->{"Subtype"}
ABCresult
11X1
0X11
1011
0X00
1000
384 0 return &column1($self->{PS}, $self->{Data}, $self->{LabelandColor}, $self->{Hscale}, $self->{Vscale}, $self->{Gexport},$self->{Columnwidth}, $self->{Format}, $self->{Headertype}, $self->{Axistype}, $self->{Valuetype}, $self->{Backgroundcolor}, $self->{Headercolor});
385 }
386 }else{
387 0 return "Both the data file (setData) and the color file (setLabelandColor) must be defined.";
388 }
389 }elsif($self->{Graphic} eq '2Dbar'){
390 0 ▶ if(defined($self->{Data}) && defined($self->{LabelandColor})){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{'Data'} and defined $self->{'LabelandColor'}) { } 0 0 0
Condition0%0/3
defined $self->{"Data"} and defined $self->{"LabelandColor"}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $self->{"Data"} and defined $self->{"LabelandColor"}
defined $self->{"Data"} defined $self->{"LabelandColor"}
Truth table0%0/3
A and B
A= defined $self->{"Data"}B= defined $self->{"LabelandColor"}
ABresult
0X0
100
111
391 0 ▶ if(!defined($self->{Hscale})){$self->{Hscale}=1;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Hscale"}) 0 0 0
392 0 ▶ if(!defined($self->{Vscale})){$self->{Vscale}=1;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Vscale"}) 0 0 0
393 0 ▶ if(!defined($self->{Gexport})){$self->{Gexport}='';}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Gexport"}) 0 0 0
394 0 ▶ if(!defined($self->{Columnwidth})){$self->{Columnwidth}=36;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Columnwidth"}) 0 0 0
395 0 ▶ if(!defined($self->{Format})){$self->{Format}="money";}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Format"}) 0 0 0
396 0 ▶ if(!defined($self->{Headertype})){$self->{Headertype}=9;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Headertype"}) 0 0 0
397 0 ▶ if(!defined($self->{Valuetype})){$self->{Valuetype}=9;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Valuetype"}) 0 0 0
398 0 ▶ if(!defined($self->{Valuecolor})){$self->{Valuecolor}=0;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Valuecolor"}) 0 0 0
399 0 ▶ if(!defined($self->{Axistype})){$self->{Axistype}=8;}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Axistype"}) 0 0 0
400 0 ▶ if(!defined($self->{Backgroundcolor})){$self->{Backgroundcolor}='.3 0 .15 .09';}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Backgroundcolor"}) 0 0 0
401 0 ▶ if(!defined($self->{Headercolor})){$self->{Headercolor}='0 0 0 1';}
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->{"Headercolor"}) 0 0 0
402 0 ▶ if((defined($self->{Subtype}) && $self->{Subtype}==1) || !defined($self->{Subtype})){
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"Subtype"} and $self->{"Subtype"} == 1 or not defined $self->{"Subtype"}) 0 0 0
Condition0%0/6
defined $self->{"Subtype"} and $self->{"Subtype"} == 1 or not defined $self->{"Subtype"}
l!l&&r!l&&!r
000
defined $self->{"Subtype"} and $self->{"Subtype"} == 1
!ll&&!rl&&r
000
MC/DC0%0/3
defined $self->{"Subtype"} and $self->{"Subtype"} == 1 or not defined $self->{"Subtype"}
defined $self->{"Subtype"} $self->{"Subtype"} == 1 not defined $self->{"Subtype"}
Truth table0%0/5
A and B or not(C)
A= defined $self->{"Subtype"}B= $self->{"Subtype"} == 1C= not defined $self->{"Subtype"}
ABCresult
11X1
0X11
1011
0X00
1000
403 0 return &bar1($self->{PS}, $self->{Data}, $self->{LabelandColor}, $self->{Hscale}, $self->{Vscale}, $self->{Gexport},$self->{Columnwidth}, $self->{Format}, $self->{Headertype}, $self->{Axistype}, $self->{Valuetype}, $self->{Backgroundcolor}, $self->{Headercolor}, $self->{Valuecolor});
404 }
405 }else{
406 0 return "Both the data file (setData) and the color file (setLabelandColor) must be defined.";
407 }
408 }else{
409 1 return "Cannot write undefined graphic!";
410 }
411 }
412 0 ▶sub data2degrees {
Subroutine data2degrees: not called CC=14 SCAR=53.5
Pod undocumented
413 0 my ($data) = @_;
414 0 my $trans="trans";
415 0 my @totaldata;
416 0 ▶ open(DATA, "./" . $data) || die "Could not open ./$data file!\n";
Branch: 1 branch
BranchTrueFalseTotal
open DATA, './' . $data or die "Could not open ./$data file!\n" 0 0 0
417 0 ▶ open(TRANS, ">$trans") || die "Could not open trans file for writing!\n";
Branch: 1 branch
BranchTrueFalseTotal
open TRANS, ">$trans" or die "Could not open trans file for writing!\n" 0 0 0
418 0 ▶ open(DATA1, "+>data1") || die "Could not open data1 file for writing!\n";
Branch: 1 branch
BranchTrueFalseTotal
open DATA1, "+>data1" or die "Could not open data1 file for writing!\n" 0 0 0
419 #sum the slices to create a totals field
420 0 my @sum;
421 my @drow1;
422 0 ▶ while(<DATA>){
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline DATA)) 0 0 0
423 0 my @drow=split ("\t", $_);
424 0 my $total=0;
425 0 my $drow1='';
426 0 my $ddd=@drow-1;
427 0 chomp($ddd);
428 #find the largest slice
429 0 ▶ for(my $a=0; $a<@drow-1; $a++){
Branch: 1 branch
BranchTrueFalseTotal
if ($a < @drow - 1) 0 0 0
430 0 $sum[$a]+=$drow[$a];
431 0 $total+=$drow[$a];
432 0 ▶ if($drow1 eq ''){
Branch: 1 branch
BranchTrueFalseTotal
if ($drow1 eq '') { } 0 0 0
433 0 $drow1.=$drow[$a];
434 }else{
435 0 $drow1.="\t" . $drow[$a];
436 }
437 }
438 #chomp($drow[@drow-1]);
439 0 $drow1.="\t" . $drow[$ddd];
440 0 chomp($drow1);
441 0 $drow1.="\t" . $total;
442 0 print DATA1 $drow1 . "\n";
443 }
444 0 my $largest;
445 0 my $lvalue=0;
446 0 ▶ for($b=0; $b<@sum; $b++){
Branch: 1 branch
BranchTrueFalseTotal
if ($b < @sum) 0 0 0
447 0 ▶ if($sum[$b]>$lvalue){
Branch: 1 branch
BranchTrueFalseTotal
if ($sum[$b] > $lvalue) 0 0 0
448 0 $lvalue=$sum[$b];
449 0 $largest=$b;
450 }
451 }
452 0 seek DATA1, 0, 0;
453 0 ▶ while(<DATA1>){
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline DATA1)) 0 0 0
454 0 my @crow=split ("\t", $_);
455 0 my @d;
456 0 my $otherdegrees=0;
457 0 ▶ for(my $c=0; $c<@crow-2; $c++){
Branch: 1 branch
BranchTrueFalseTotal
if ($c < @crow - 2) 0 0 0
458 0 ▶ if($c!=$largest){
Branch: 1 branch
BranchTrueFalseTotal
if ($c != $largest) 0 0 0
459 0 $d[$c]=360*$crow[$c]/$crow[@crow-1];
460 0 ▶ if($d[$c]>0){
Branch: 1 branch
BranchTrueFalseTotal
if ($d[$c] > 0) 0 0 0
461 0 ▶ if($d[$c]<3.6){$d[$c]=3.6;}
Branch: 1 branch
BranchTrueFalseTotal
if ($d[$c] < "3.6") 0 0 0
462 0 $otherdegrees+=$d[$c];
463 }
464 }
465 }
466 0 $d[$largest]=360-$otherdegrees;
467 0 push @d, $crow[@crow-2];
468 0 print TRANS join("\t",@d) . "\n";
469 0 print join("\t",@d) . "\n";
470 }
471 0 close TRANS;
472 0 return $trans;
473 }
474 0 ▶sub pie1{
Subroutine pie1: not called CC=12 SCAR=50.5
Pod undocumented
475 0 my ($startingangle,$ps, $data, $labelandcolor, $hscale, $vscale, $gexport, $valuetype) = @_;
476 0 ▶ my $slicecounter; my $piefile; my $piececount; my $thisdate = scalar localtime; my $piedirectory="pies/"; my @slice; my $slicecnt; my $piefileextension="eps"; my $hsize=$hscale; my $vsize=$vscale; my $yend; my $labelmax=0; my $labelx; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); while(<LABELANDCOLOR>) {$_=~s/\t.*//; $_=~s/ *$//; chomp; $labelx=length($_)+10; if($labelx>$labelmax){$labelmax=$labelx; } $piececount++;} close(LABELANDCOLOR); my $xstart=int(306-($hsize*350/2)-($labelmax*$hsize)); my $xend=int(306+($hsize*350/2)+($labelmax*$hsize)); my $ystart=int(396-($vsize*350/2)-($labelmax*$vsize)); $yend=int(396+($vsize*350/2)+($labelmax*$vsize)); my @lclines; my $lclines; my $label; my $c; my $m; my $y; my $k; my $thisendangle; my $thisslice; my $thisstartangle; my $filewithdir; my $thispiefile; open(PIECHARTDATA, "<$data") || die "Couldn't open $data\n"; while(<PIECHARTDATA>) {chomp; @slice=split/\t/,$_; $slicecnt=@slice; $piefile=$slice[$slicecnt-1]; $thisslice=$slice[0]; $slicecounter=0; $thispiefile=$piefile.".".$piefileextension; $filewithdir=$piedirectory.$thispiefile; open(PIE, ">$filewithdir") or die("Couldn't create output file: ".$thispiefile); print PIE "%!PS-ADOBE 3.0 EPSF-3.0\n"; print PIE "%%Title: ".$thispiefile."\n"; print PIE "%%Creator: createpies.pl (c)Ken Owen 1999-2016\n"; print PIE "%%Creationdate: ".$thisdate."\n"; print PIE "%%BoundingBox: $xstart $ystart $xend $yend\n\n"; print PIE "/typesize " . $valuetype . " def\n"; print PIE $ps; print PIE "gsave 1 $hscale div 1 $vscale div scale label dup stringwidth pop checkangle 110 lt {2 div}if checkangle 250 gt {2 div}if -1 mul 2 rmoveto show grestore c m y k setcmykcolor 2 setlinejoin 0 0 moveto 0 0 radius startangle endangle arc closepath gsave fill grestore 0 0 0 0 setcmykcolor 1.5 setlinewidth stroke /slicecount slicecount 1 add def} def\n"; print PIE "\n%%set scale and translation\n"; print PIE "306 396 translate $hsize $vsize scale\n"; $thisstartangle=$startingangle; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor"); my $counter=0; while (<LABELANDCOLOR>) { chomp; $lclines[$counter]=$_; $counter++; } foreach $lclines(@lclines){ ($label, $c, $m, $y, $k)=split/\t/,$lclines; print PIE "%%draw pie chart\n"; $thisendangle=$thisstartangle+eval($thisslice); if(eval($thisslice)>0){ print PIE "$c $m $y $k $thisstartangle $thisendangle ($label) pieslice\n"; } $thisstartangle=$thisendangle; $slicecounter++; $thisslice=$slice[$slicecounter]; } my $exportstr="convert $filewithdir -density 1200x1200 $piedirectory$piefile.$gexport"; print PIE "\n"; print PIE "showpage\n"; print PIE "grestore\n"; print PIE "%%trailer\n"; print PIE "%%EOF"; close LABELANDCOLOR; close PIE; if(length($gexport)>0){`$exportstr`;}
Branch: 10 branches
BranchTrueFalseTotal
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if ($labelx > $labelmax) 0 0 0
open PIECHARTDATA, "<$data" or die "Couldn't open $data\n" 0 0 0
if (defined($_ = readline PIECHARTDATA)) 0 0 0
open PIE, ">$filewithdir" or die q[Couldn't create output file: ] . $thispiefile 0 0 0
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if (eval $thisslice > 0) 0 0 0
if (length $gexport > 0) 0 0 0
477 }}
478 0 ▶sub pie2{
Subroutine pie2: not called CC=12 SCAR=50.5
Pod undocumented
479 0 my ($startingangle, $ps, $data, $labelandcolor, $hsize, $vsize, $gexport, $valuetype) = @_;
480 0 ▶my $piefileextension="eps"; my $xstart=int(306-($hsize*385/2)); my $xend=int(306+($hsize*385/2 + 10)); my $ystart=int(396-($vsize*350/2) - 8); my $yend=int(396+($vsize*350/2)); my @slice; my $slice; my $piefile; my $piedirectory="pies/"; my $thisdate = scalar localtime; my $thisslice; my $slicecounter; my $filewithdir; my $thisstartangle; my $thisendangle; my $percent1; my $no_slices; my $piename; open(PIECHARTDATA, "<$data") or die("Couldn't open $data"); while (<PIECHARTDATA>) {chomp; @slice=split(/\t/,$_); $no_slices=@slice; $piefile=$slice[$no_slices-1]; $piename=$piefile; $piefile.="\.".$piefileextension; $thisslice=$slice[0]; $slicecounter=0; $filewithdir=$piedirectory.$piefile; open(PIE, ">$filewithdir") or die("Couldn't create output file: ".$piefile); print PIE "%!PS-ADOBE 3.0 EPSF-3.0\n"; print PIE "%%Title: ".$piefile."\n"; print PIE "%%Creator: createpies.pl (c)Ken Owen 1999-2016\n"; print PIE "%%Creationdate: ".$thisdate."\n"; print PIE "%%BoundingBox: $xstart $ystart $xend $yend\n\n"; print PIE "/typesize " . $valuetype . " def\n"; print PIE $ps; print PIE "%%set scale and translation\n"; print PIE "306 396 translate $hsize $vsize scale\n"; $thisstartangle=$startingangle; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor"); my $counter=0; my @lclines; my $lclines; while (<LABELANDCOLOR>) {chomp; $lclines[$counter]=$_; $counter++; } $counter=@lclines; my $labelx=0; my $labely=$counter*$vsize*9+50; $counter=0; my $wholepercent=0; my $percent1num=0; foreach $lclines(@lclines){my ($label, $c, $m, $y, $k)=split(/\t/,$lclines); print PIE "%%draw pie chart\n"; $thisendangle=$thisstartangle+eval($thisslice); if(eval($thisslice)>0){$percent1num=int(100*eval($thisslice)/360); if(((100*eval($thisslice)/36) % 10) >= 5){$percent1num++;} $percent1=substr($percent1num,0)."%"; if($percent1num == 0){$percent1num=1;} $wholepercent+=$percent1num; if($wholepercent == 101){$percent1num--; $percent1=substr($percent1num,0) . "%"; } print PIE "$c $m $y $k $thisstartangle $thisendangle ($label) ($percent1) pieslice\n"; } $thisstartangle=$thisendangle; $slicecounter++; $thisslice=$slice[$slicecounter]; } my $exportstr="convert $filewithdir -density 1200x1200 $piedirectory$piename.$gexport"; print PIE "\n"; print PIE "showpage\n"; print PIE "grestore\n"; print PIE "%%trailer\n"; print PIE "%%EOF"; close LABELANDCOLOR; close PIE; if(length($gexport)>0){`$exportstr`;} }
Branch: 10 branches
BranchTrueFalseTotal
open PIECHARTDATA, "<$data" or die "Couldn't open $data" 0 0 0
if (defined($_ = readline PIECHARTDATA)) 0 0 0
open PIE, ">$filewithdir" or die q[Couldn't create output file: ] . $piefile 0 0 0
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if (eval $thisslice > 0) 0 0 0
if (100 * eval($thisslice) / 36 % 10 >= 5) 0 0 0
if ($percent1num == 0) 0 0 0
if ($wholepercent == 101) 0 0 0
if (length $gexport > 0) 0 0 0
481 }
482 0 ▶sub pie3{
Subroutine pie3: not called CC=22 SCAR=62.3
Pod undocumented
483 0 ▶ my ($startingangle, $ps, $data, $labelandcolor, $hsize, $vsize, $gexport, $legend, $valuetype) = @_; my $piececount=0; my @slice; my $piename; my $slicecnt; my $filecounter; my @pclines; my $c; my $y; my $m; my $k; my $pclines; my $piefile; my $piedirectory; my $thisslice; my $thispiefile; my $leftright; my $lclines; my @lclines; my $slicecounter; my $thisdate; my $filewithdir; my $thisstartangle; my $thisendangle; my $label; my $piefileextension="eps"; my $legend_right; my $boundingxend; my $boundingxstart; my $xstart; my $xend; my $ystart; my $yend; my $labelmax=0; my $labelx; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); while(<LABELANDCOLOR>) { $_=~s/\t.*//; $_=~s/ *$//; chomp; $labelx=length($_); if($labelx>$labelmax){$labelmax=$labelx; } $piececount++;} close(LABELANDCOLOR); if($legend eq "right"){ $boundingxend=int(306+($hsize*321/2)+($labelmax*9)*$hsize); $boundingxstart=int(306-($hsize*321/2)); $xstart=int(306-($hsize*260/2)); $xend=int(306+($hsize*260/2)); $ystart=int(396-($vsize*308/2)); $yend=int(396+($vsize*308/2)); }elsif($legend eq "left"){ $boundingxstart=int(306-($hsize*321/2)-($labelmax*9)*$hsize); $boundingxend=int(306+($hsize*321/2)*$hsize); $xstart=int(306-($hsize*260/2)); $xend=int(306+($hsize*260/2)); $ystart=int(396-($vsize*308/2)); $yend=int(396+($vsize*308/2)); }elsif($legend eq "bottom"){ $boundingxstart=int(306-($hsize*315/2)); $boundingxend=int(306+($hsize*315/2)); $xstart=int(306-($hsize*315/2)); $xend=int(306+($hsize*315/2)); $ystart=int(396-150-($piececount)*($vsize*25)); $yend=int(396+($vsize*130)); }else{ $xstart=int(306-($hsize*315/2)); $xend=int(306+($hsize*315/2)); $ystart=int(396-($vsize*315/2)-30); $yend=int(396+($vsize*350/2)); } open(PIECHARTDATA, "<$data") or die("Couldn't open $data"); my $counter=0; while (<PIECHARTDATA>) { $pclines[$counter]=$_; $counter++; } foreach $pclines(@pclines){@slice=split(/\t/,$pclines); chomp($slice[2]); $slicecnt=@slice; $piefile=$slice[$slicecnt-1]; chomp($piefile); $piename=$piefile; $piefile.="\.".$piefileextension; $piedirectory="pies/"; $thisdate = scalar localtime; $thisslice=$slice[0]; $slicecounter=0; $filewithdir=$piedirectory.$piefile; open(PIE, ">$filewithdir") or die("Couldn't create output file: ".$thispiefile); print PIE "%!PS-ADOBE 3.0 EPSF-3.0\n"; print PIE "%%Title: ".$piefile."\n"; print PIE "%%Creator: createpies.pl (c)Ken Owen 1999-2016\n"; print PIE "%%Creationdate: ".$thisdate."\n"; if($legend eq "right" || $legend eq "left") { print PIE "%%BoundingBox: $boundingxstart $ystart $boundingxend $yend\n\n"; }elsif($legend eq "bottom") { print PIE "%%BoundingBox: $boundingxstart $ystart $boundingxend $yend\n\n"; }else{ print PIE "%%BoundingBox: $xstart $ystart $xend $yend\n\n"; } print PIE "<< /PageSize [1000 1000] >> setpagedevice \n gsave\n"; print PIE $ps; print PIE "%%set scale and translation\n"; print PIE "306 396 translate $hsize $vsize scale\n"; $thisstartangle=$startingangle; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); $counter=0; while (<LABELANDCOLOR>) { chomp; $lclines[$counter]=$_; $counter++; } $counter=@lclines; $labelx=0; my $labely=$counter*$vsize*$valuetype; $counter=0; foreach $lclines(@lclines){ ($label, $c, $m, $y, $k)=split(/\t/,$lclines); print PIE "%%draw pie chart\n"; $thisendangle=$thisstartangle+eval($thisslice); if(eval($thisslice)>0){ print PIE "$c $m $y $k $thisstartangle $thisendangle ($label) pieslice\n"; if($legend eq "bottom"){ $leftright=0; $labelx=-100; $labely=-150-($slicecounter*25); print PIE "$c $m $y $k ($label) $labelx $labely $leftright $hsize $vsize legend\n"; $thisstartangle=$thisendangle; $thisslice=$slice[$slicecounter]; }elsif($legend eq "right"){ $labelx=(260/2) + 10; $labely=$labely-28; $counter++; print PIE "$c $m $y $k ($label) $labelx $labely $hsize $vsize legend_right\n"; }elsif($legend eq "left"){ $labelx=-((260/2) + 10); $labely=$labely-28; $counter++; print PIE "$c $m $y $k ($label) $labelx $labely $hsize $vsize legend_left\n"; } } $thisstartangle=$thisendangle; $slicecounter++; $thisslice=$slice[$slicecounter]; } my $exportstr="convert $filewithdir -density 1200x1200 $piedirectory$piename.$gexport"; print PIE "\n"; print PIE "showpage\n"; print PIE "grestore\n"; print PIE "%%trailer\n"; print PIE "%%EOF"; if(length($gexport)>0){ `$exportstr`; } } close LABELANDCOLOR; close PIE;
Branch: 18 branches
BranchTrueFalseTotal
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if ($labelx > $labelmax) 0 0 0
if ($legend eq 'right') { } 0 0 0
elsif ($legend eq 'left') { } 0 0 0
elsif ($legend eq 'bottom') { } 0 0 0
open PIECHARTDATA, "<$data" or die "Couldn't open $data" 0 0 0
if (defined($_ = readline PIECHARTDATA)) 0 0 0
open PIE, ">$filewithdir" or die q[Couldn't create output file: ] . $thispiefile 0 0 0
if ($legend eq 'right' or $legend eq 'left') { } 0 0 0
elsif ($legend eq 'bottom') { } 0 0 0
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if (eval $thisslice > 0) 0 0 0
if ($legend eq 'bottom') { } 0 0 0
elsif ($legend eq 'right') { } 0 0 0
elsif ($legend eq 'left') { } 0 0 0
if (length $gexport > 0) 0 0 0
Condition0%0/3
$legend eq "right" or $legend eq "left"
l!l&&r!l&&!r
000
MC/DC0%0/2
$legend eq "right" or $legend eq "left"
$legend eq "right" $legend eq "left"
Truth table0%0/3
A or B
A= $legend eq "right"B= $legend eq "left"
ABresult
1X1
011
000
484 }
485 0 ▶sub pie31{
Subroutine pie31: not called CC=25 SCAR=64.8
Pod undocumented
486 0 ▶my ($startingangle, $ps, $data, $labelandcolor, $hsize, $vsize, $gexport, $legend, $valuetype) = @_; my $piececount=0; my @slice; my $piename; my $slicecnt; my $filecounter; my @pclines; my $c; my $y; my $m; my $k; my $pclines; my $piefile; my $piedirectory; my $thisslice; my $thispiefile; my $leftright; my $lclines; my @lclines; my $slicecounter; my $thisdate; my $filewithdir; my $thisstartangle; my $thisendangle; my $label; my $piefileextension="eps"; my $legend_right; my $boundingxend; my $boundingxstart; my $xstart; my $xend; my $ystart; my $yend; my $labelmax=0; my $labelx; my $percent1num; my $percent1; my $wholepercent; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); while(<LABELANDCOLOR>) { $_=~s/\t.*//; $_=~s/ *$//; chomp; $labelx=length($_); if($labelx>$labelmax){ $labelmax=$labelx; } $piececount++; } close(LABELANDCOLOR); if($legend eq "right"){ $boundingxend=int(306+130+($labelmax*9)*$hsize); $boundingxstart=int(306-($hsize*200)); $xstart=int(306-($hsize*260/2)); $xend=int(306+($hsize*260/2)); $ystart=int(396-($vsize*308/2)-($vsize*30)); $yend=int(396+($vsize*308/2)+($vsize*30)); }elsif($legend eq "left"){ $boundingxstart=int(306-120-($labelmax*9)*$hsize); $boundingxend=int(306+(321/2)*$hsize); $xstart=int(306-($hsize*280/2)); $xend=int(306+($hsize*260/2)); $ystart=int(396-($vsize*308/2)-($vsize*30)); $yend=int(396+($vsize*308/2)+($vsize*30)); print "labelmax=$labelmax boundingxstart=$boundingxstart xstart=$xstart\n"; }elsif($legend eq "bottom"){ $boundingxstart=int(306-($hsize*315/2)-30); $boundingxend=int(306+($hsize*315/2)+30); $xstart=int(306-($hsize*315/2)); $xend=int(306+($hsize*315/2)); $ystart=int(396-100-($piececount)*($vsize*25)); $yend=int(396+($vsize*180)); }else{ $xstart=int(306-($hsize*315/2)); $xend=int(306+($hsize*315/2)); $ystart=int(396-($vsize*315/2)-30); $yend=int(396+($vsize*350/2)); } open(PIECHARTDATA, "<$data") or die("Couldn't open $data"); my $counter=0; while (<PIECHARTDATA>) { $pclines[$counter]=$_; $counter++; } foreach $pclines(@pclines){ @slice=split(/\t/,$pclines); chomp($slice[2]); $slicecnt=@slice; $piefile=$slice[$slicecnt-1]; chomp($piefile); $piename=$piefile; $piefile.="\.".$piefileextension; $piedirectory="pies/"; $thisdate = scalar localtime; $thisslice=$slice[0]; $slicecounter=0; $filewithdir=$piedirectory.$piefile; open(PIE, ">$filewithdir") or die("Couldn't create output file: ".$thispiefile); print PIE "%!PS-ADOBE 3.0 EPSF-3.0\n"; print PIE "%%Title: ".$piefile."\n"; print PIE "%%Creator: createpies.pl (c)Ken Owen 1999-2016\n"; print PIE "%%Creationdate: ".$thisdate."\n"; if($legend eq "right" || $legend eq "left") { print PIE "%%BoundingBox: $boundingxstart $ystart $boundingxend $yend\n\n"; }elsif($legend eq "bottom") { print PIE "%%BoundingBox: $boundingxstart $ystart $boundingxend $yend\n\n"; }else{ print PIE "%%BoundingBox: $xstart $ystart $xend $yend\n\n"; } print PIE "<< /PageSize [1000 1000] >> setpagedevice \n gsave\n"; print PIE "/typesize " . $valuetype . " def\n"; print PIE "/legendtype " . $valuetype . " def\n"; print PIE $ps; print PIE "%%set scale and translation\n"; print PIE "306 396 translate $hsize $vsize scale\n"; $thisstartangle=$startingangle; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); $counter=0; while (<LABELANDCOLOR>) { chomp; $lclines[$counter]=$_; $counter++; } $counter=@lclines; $labelx=0; my $labely=$counter*$vsize*9; $counter=0; foreach $lclines(@lclines){ ($label, $c, $m, $y, $k)=split(/\t/,$lclines); print PIE "%%draw pie chart\n"; $thisendangle=$thisstartangle+eval($thisslice); if(eval($thisslice)>0){ $percent1num=int(100*eval($thisslice)/360); if(((100*eval($thisslice)/36) % 10) >= 5){ $percent1num++; } $percent1=substr($percent1num,0)."%"; if($percent1num == 0){ $percent1num=1; } $wholepercent+=$percent1num; if($wholepercent == 101){ $percent1num--; $percent1=substr($percent1num,0) . "%"; } print "percent1=$percent1\n"; print PIE "$c $m $y $k $thisstartangle $thisendangle pieslice\n"; if($legend eq "bottom"){ $leftright=0; $labelx=-100; $labely=-200-($slicecounter*$vsize*$valuetype*3); print PIE "$c $m $y $k ($label) $labelx $labely $leftright $hsize $vsize ( " . $percent1 . ") legend\n"; $thisstartangle=$thisendangle; $thisslice=$slice[$slicecounter]; }elsif($legend eq "right"){ $labelx=(260/2) + 55; $labely=$labely-28; $counter++; print PIE "$c $m $y $k ($label) $labelx $labely $hsize $vsize ( " . $percent1 . ") legend_right\n"; }elsif($legend eq "left"){ $leftright=1; $labelx=-((260/2) + 140); $labely=$labely-28; $counter++; print PIE "$c $m $y $k ($label) $labelx $labely $leftright $hsize $vsize ( " . $percent1 . ") legend\n"; } } $thisstartangle=$thisendangle; $slicecounter++; $thisslice=$slice[$slicecounter]; } my $exportstr="convert $filewithdir -density 1200x1200 $piedirectory$piename.$gexport"; print PIE "\n"; print PIE "showpage\n"; print PIE "grestore\n"; print PIE "%%trailer\n"; print PIE "%%EOF"; if(length($gexport)>0){ `$exportstr`; } } close LABELANDCOLOR; close PIE;
Branch: 21 branches
BranchTrueFalseTotal
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if ($labelx > $labelmax) 0 0 0
if ($legend eq 'right') { } 0 0 0
elsif ($legend eq 'left') { } 0 0 0
elsif ($legend eq 'bottom') { } 0 0 0
open PIECHARTDATA, "<$data" or die "Couldn't open $data" 0 0 0
if (defined($_ = readline PIECHARTDATA)) 0 0 0
open PIE, ">$filewithdir" or die q[Couldn't create output file: ] . $thispiefile 0 0 0
if ($legend eq 'right' or $legend eq 'left') { } 0 0 0
elsif ($legend eq 'bottom') { } 0 0 0
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if (eval $thisslice > 0) 0 0 0
if (100 * eval($thisslice) / 36 % 10 >= 5) 0 0 0
if ($percent1num == 0) 0 0 0
if ($wholepercent == 101) 0 0 0
if ($legend eq 'bottom') { } 0 0 0
elsif ($legend eq 'right') { } 0 0 0
elsif ($legend eq 'left') { } 0 0 0
if (length $gexport > 0) 0 0 0
Condition0%0/3
$legend eq "right" or $legend eq "left"
l!l&&r!l&&!r
000
MC/DC0%0/2
$legend eq "right" or $legend eq "left"
$legend eq "right" $legend eq "left"
Truth table0%0/3
A or B
A= $legend eq "right"B= $legend eq "left"
ABresult
1X1
011
000
487 }
488 0 ▶sub pie41{
Subroutine pie41: not called CC=16 SCAR=56.1
Pod undocumented
489 0 ▶my ($startingangle, $ps, $data, $labelandcolor, $hsize, $vsize, $gexport, $valuetype) = @_; my $piececount=0; my @slice; my $piename; my $slicecnt; my $filecounter; my @pclines; my $c; my $y; my $m; my $k; my $pclines; my $piefile; my $piedirectory; my $thisslice; my $thispiefile; my $leftright; my $lclines; my @lclines; my $slicecounter; my $thisdate; my $filewithdir; my $thisstartangle; my $thisendangle; my $label; my $piefileextension="eps"; my $boundingxend; my $boundingxstart; my $labelmax=0; my $labelx; my $percent1num; my $percent1; my $wholepercent; my $xstart=int(306-($hsize*350/2)-($labelmax*$hsize)); my $xend=int(306+($hsize*350/2)+($labelmax*$hsize)); my $ystart=int(396-($vsize*350/2)-($labelmax*$vsize)); my $yend=int(396+($vsize*350/2)+($labelmax*$vsize)); open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); while(<LABELANDCOLOR>) { $_=~s/\t.*//; $_=~s/ *$//; chomp; $labelx=length($_); if($labelx>$labelmax){$labelmax=$labelx; } $piececount++; } close(LABELANDCOLOR); open(PIECHARTDATA, "<$data") or die("Couldn't open $data"); my $counter=0; while (<PIECHARTDATA>) { $pclines[$counter]=$_; $counter++; } foreach $pclines(@pclines){ @slice=split(/\t/,$pclines); chomp($slice[2]); $slicecnt=@slice; $piefile=$slice[$slicecnt-1]; chomp($piefile); $piename=$piefile; $piefile.="\.".$piefileextension; $piedirectory="pies/"; $thisdate = scalar localtime; $thisslice=$slice[0]; $slicecounter=0; $filewithdir=$piedirectory.$piefile; open(PIE, ">$filewithdir") or die("Couldn't create output file: ".$thispiefile); print PIE "%!PS-ADOBE 3.0 EPSF-3.0\n"; print PIE "%%Title: ".$piefile."\n"; print PIE "%%Creator: createpies.pl (c)Ken Owen 1999-2016\n"; print PIE "%%Creationdate: ".$thisdate."\n"; print PIE "%%BoundingBox: $xstart $ystart $xend $yend\n\n"; print PIE "<< /PageSize [1000 1000] >> setpagedevice \n gsave\n"; print PIE "/typesize " . $valuetype . " def\n"; print PIE $ps; print PIE "%%set scale and translation\n"; print PIE "306 396 translate $hsize $vsize scale\n"; $thisstartangle=$startingangle; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); $counter=0; while (<LABELANDCOLOR>) { chomp; $lclines[$counter]=$_; $counter++; } $counter=@lclines; $labelx=0; my $labely=$counter*$vsize*9; $counter=0; foreach $lclines(@lclines){ ($label, $c, $m, $y, $k)=split(/\t/,$lclines); print PIE "%%draw pie chart\n"; $thisendangle=$thisstartangle+eval($thisslice); if(eval($thisslice)>0){ $percent1num=int(100*eval($thisslice)/360); if(((100*eval($thisslice)/36) % 10) >= 5){ $percent1num++; } $percent1=substr($percent1num,0)."%"; if($percent1num == 0){$percent1num=1;} $wholepercent+=$percent1num; if($wholepercent == 101){ $percent1num--; $percent1=substr($percent1num,0) . "%"; } print PIE "$c $m $y $k $thisstartangle $thisendangle ($percent1) pieslice\n"; } $thisstartangle=$thisendangle; $slicecounter++; $thisslice=$slice[$slicecounter]; } my $exportstr="convert $filewithdir -density 1200x1200 $piedirectory$piename.$gexport"; print PIE "\n"; print PIE "showpage\n"; print PIE "grestore\n"; print PIE "%%trailer\n"; print PIE "%%EOF"; if(length($gexport)>0){`$exportstr`;} } close LABELANDCOLOR; close PIE;
Branch: 13 branches
BranchTrueFalseTotal
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if ($labelx > $labelmax) 0 0 0
open PIECHARTDATA, "<$data" or die "Couldn't open $data" 0 0 0
if (defined($_ = readline PIECHARTDATA)) 0 0 0
open PIE, ">$filewithdir" or die q[Couldn't create output file: ] . $thispiefile 0 0 0
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if (eval $thisslice > 0) 0 0 0
if (100 * eval($thisslice) / 36 % 10 >= 5) 0 0 0
if ($percent1num == 0) 0 0 0
if ($wholepercent == 101) 0 0 0
if (length $gexport > 0) 0 0 0
490 }
491 0 ▶sub pie4{
Subroutine pie4: not called CC=25 SCAR=64.8
Pod undocumented
492 0 ▶my ($startingangle, $ps, $data, $labelandcolor, $hsize, $vsize, $gexport, $legend, $valuetype) = @_; my $piececount=0; my @slice; my $piename; my $slicecnt; my $filecounter; my @pclines; my $c; my $y; my $m; my $k; my $pclines; my $piefile; my $piedirectory; my $thisslice; my $thispiefile; my $leftright; my $lclines; my @lclines; my $slicecounter; my $thisdate; my $filewithdir; my $thisstartangle; my $thisendangle; my $label; my $piefileextension="eps"; my $legend_right; my $boundingxend; my $boundingxstart; my $xstart; my $xend; my $ystart; my $yend; my $labelmax=0; my $labelx; my $percent1num; my $percent1; my $wholepercent; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); while(<LABELANDCOLOR>) { $_=~s/\t.*//; $_=~s/ *$//; chomp; $labelx=length($_); if($labelx>$labelmax){$labelmax=$labelx; } $piececount++; } close(LABELANDCOLOR); if($legend eq "right"){ $boundingxend=int(306+($hsize*321/2)+($labelmax*9+30)*$hsize); $boundingxstart=int(306-(30+$hsize*321/2)); $xstart=int(306-($hsize*260/2)); $xend=int(306+($hsize*260/2)); $ystart=int(396-($vsize*308/2)-($vsize*30)); $yend=int(396+($vsize*308/2)+($vsize*30)); }elsif($legend eq "left"){ $boundingxstart=int(306-($hsize*321/2)-($labelmax*9+30)*$hsize); $boundingxend=int(306+(30+$hsize*321/2)*$hsize); $xstart=int(306-($hsize*280/2)); $xend=int(306+($hsize*260/2)); $ystart=int(396-($vsize*308/2)-($vsize*30)); $yend=int(396+($vsize*308/2)+($vsize*30)); }elsif($legend eq "bottom"){ $boundingxstart=int(306-($hsize*315/2)-30); $boundingxend=int(306+($hsize*315/2)+30); $xstart=int(306-($hsize*315/2)); $xend=int(306+($hsize*315/2)); $ystart=int(396-200-($piececount)*($vsize*25)); $yend=int(396+($vsize*180)); }else{ $xstart=int(306-($hsize*315/2)); $xend=int(306+($hsize*315/2)); $ystart=int(396-($vsize*315/2)-30); $yend=int(396+($vsize*350/2)); } open(PIECHARTDATA, "<$data") or die("Couldn't open $data"); my $counter=0; while (<PIECHARTDATA>) { $pclines[$counter]=$_; $counter++; } foreach $pclines(@pclines){ @slice=split(/\t/,$pclines); chomp($slice[2]); $slicecnt=@slice; $piefile=$slice[$slicecnt-1]; chomp($piefile); $piename=$piefile; $piefile.="\.".$piefileextension; $piedirectory="pies/"; $thisdate = scalar localtime; $thisslice=$slice[0]; $slicecounter=0; $filewithdir=$piedirectory.$piefile; open(PIE, ">$filewithdir") or die("Couldn't create output file: ".$thispiefile); print PIE "%!PS-ADOBE 3.0 EPSF-3.0\n"; print PIE "%%Title: ".$piefile."\n"; print PIE "%%Creator: createpies.pl (c)Ken Owen 1999-2016\n"; print PIE "%%Creationdate: ".$thisdate."\n"; if($legend eq "right" || $legend eq "left") { print PIE "%%BoundingBox: $boundingxstart $ystart $boundingxend $yend\n\n"; }elsif($legend eq "bottom") { print PIE "%%BoundingBox: $boundingxstart $ystart $boundingxend $yend\n\n"; }else{ print PIE "%%BoundingBox: $xstart $ystart $xend $yend\n\n"; } print PIE "<< /PageSize [1000 1000] >> setpagedevice \n gsave\n"; print PIE "/typesize " . $valuetype . " def\n"; print PIE $ps; print PIE "%%set scale and translation\n"; print PIE "306 396 translate $hsize $vsize scale\n"; $thisstartangle=$startingangle; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); $counter=0; while (<LABELANDCOLOR>) { chomp; $lclines[$counter]=$_; $counter++; } $counter=@lclines; $labelx=0; my $labely=$counter*$vsize*9; $counter=0; foreach $lclines(@lclines){ ($label, $c, $m, $y, $k)=split(/\t/,$lclines); print PIE "%%draw pie chart\n"; $thisendangle=$thisstartangle+eval($thisslice); if(eval($thisslice)>0){ $percent1num=int(100*eval($thisslice)/360); if(((100*eval($thisslice)/36) % 10) >= 5){ $percent1num++; } $percent1=substr($percent1num,0)."%"; if($percent1num == 0){$percent1num=1;} $wholepercent+=$percent1num; if($wholepercent == 101){ $percent1num--; $percent1=substr($percent1num,0) . "%"; } print PIE "$c $m $y $k $thisstartangle $thisendangle ($percent1) pieslice\n"; if($legend eq "bottom"){ $leftright=0; $labelx=-100; $labely=-220-($slicecounter*$vsize*25); print PIE "$c $m $y $k ($label) $labelx $labely $leftright $hsize $vsize legend\n"; $thisstartangle=$thisendangle; $thisslice=$slice[$slicecounter]; }elsif($legend eq "right"){ $labelx=(260/2) + 55; $labely=$labely-28; $counter++; print PIE "$c $m $y $k ($label) $labelx $labely $hsize $vsize legend_right\n"; }elsif($legend eq "left"){ $labelx=-((260/2) + 70); $labely=$labely-28; $counter++; print PIE "$c $m $y $k ($label) $labelx $labely $hsize $vsize legend_left\n"; } } $thisstartangle=$thisendangle; $slicecounter++; $thisslice=$slice[$slicecounter]; } my $exportstr="convert $filewithdir -density 1200x1200 $piedirectory$piename.$gexport"; print PIE "\n"; print PIE "showpage\n"; print PIE "grestore\n"; print PIE "%%trailer\n"; print PIE "%%EOF"; if(length($gexport)>0){`$exportstr`;} } close LABELANDCOLOR; close PIE;
Branch: 21 branches
BranchTrueFalseTotal
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if ($labelx > $labelmax) 0 0 0
if ($legend eq 'right') { } 0 0 0
elsif ($legend eq 'left') { } 0 0 0
elsif ($legend eq 'bottom') { } 0 0 0
open PIECHARTDATA, "<$data" or die "Couldn't open $data" 0 0 0
if (defined($_ = readline PIECHARTDATA)) 0 0 0
open PIE, ">$filewithdir" or die q[Couldn't create output file: ] . $thispiefile 0 0 0
if ($legend eq 'right' or $legend eq 'left') { } 0 0 0
elsif ($legend eq 'bottom') { } 0 0 0
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if (eval $thisslice > 0) 0 0 0
if (100 * eval($thisslice) / 36 % 10 >= 5) 0 0 0
if ($percent1num == 0) 0 0 0
if ($wholepercent == 101) 0 0 0
if ($legend eq 'bottom') { } 0 0 0
elsif ($legend eq 'right') { } 0 0 0
elsif ($legend eq 'left') { } 0 0 0
if (length $gexport > 0) 0 0 0
Condition0%0/3
$legend eq "right" or $legend eq "left"
l!l&&r!l&&!r
000
MC/DC0%0/2
$legend eq "right" or $legend eq "left"
$legend eq "right" $legend eq "left"
Truth table0%0/3
A or B
A= $legend eq "right"B= $legend eq "left"
ABresult
1X1
011
000
493 }
494 0 ▶sub pie5{
Subroutine pie5: not called CC=13 SCAR=52.0
Pod undocumented
495 0 ▶my ($startingangle, $ps, $data, $labelandcolor, $hscale, $vscale, $gexport, $valuetype, $explodeoffset, $sections) = @_; my $slicecounter; my $piefile; my $piececount; my $thisdate = scalar localtime; my $piedirectory="pies/"; my @slice; my $slicecnt; my $piefileextension="eps"; my $hsize=$hscale; my $vsize=$vscale; my $yend; my $labelmax=0; my $labelx; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); while(<LABELANDCOLOR>) { $_=~s/\t.*//; $_=~s/ *$//; chomp; $labelx=length($_); if($labelx>$labelmax){ $labelmax=$labelx; } $piececount++; } close(LABELANDCOLOR); my $xstart=int(306-($hsize*350/2)-($labelmax*$hsize)-(2*$explodeoffset)); my $xend=int(306+($hsize*350/2)+($labelmax*$hsize)+(2*$explodeoffset)); my $ystart=int(396-($vsize*321/2)-($labelmax*$vsize)); $yend=int(396+($vsize*321/2)+($labelmax*$vsize)); my @lclines; my $lclines; my $label; my $c; my $m; my $y; my $k; my $sectionnum; my $oldsectionnum=0; my $sectionoffset=0; my $thisendangle; my $thisslice; my $thisstartangle; my $filewithdir; my $thispiefile; my $sectionanchor=0; my @anchors; my $anchorcnt=0; my @sectionarray; my $sectionarr; my $sectioncnt=0; my $initialangle=$startingangle; open(PIECHARTDATA, "<$data") || print "Cannot open data for reading\n"; while(<PIECHARTDATA>) { chomp; @slice=split/\t/,$_; @anchors=split/,/,$slice[6]; @sectionarray=split/,/,$sections; $sectionarr=@sectionarray; $sectioncnt=0; $slicecnt=@slice; $piefile=$slice[$slicecnt-2]; $thisslice=$slice[0]; $slicecounter=0; $thispiefile=$piefile . "." . $piefileextension; $filewithdir=$piedirectory.$thispiefile; open(PIE, ">$filewithdir") || print ("Couldn't create output file: ".$thispiefile); print PIE "%!PS-ADOBE 3.0 EPSF-3.0\n"; print PIE "%%Title: ".$thispiefile."\n"; print PIE "%%Creator: createpies.pl (c)Ken Owen 1999-2016\n"; print PIE "%%Creationdate: ".$thisdate."\n"; print PIE "%%BoundingBox: $xstart $ystart $xend $yend\n\n"; print PIE "/typesize " . $valuetype . " def\n"; print PIE $ps; print PIE "c m y k setcmykcolor 2 setlinejoin 0 0 moveto 0 0 radius startangle endangle arc closepath gsave fill grestore "; print PIE "0 0 0 0 setcmykcolor 1.5 setlinewidth stroke "; print PIE "/slicecount slicecount 1 add def} def\n"; print PIE "\n%%set scale and translation\n"; print PIE "306 396 translate $hsize $vsize scale\n"; $thisstartangle=$startingangle; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor"); my $counter=0; while (<LABELANDCOLOR>) { chomp; $lclines[$counter]=$_; $counter++; } foreach $lclines(@lclines){ ($label, $c, $m, $y, $k, $sectionnum)=split/\t/,$lclines; print PIE "%%draw pie chart\n"; $thisendangle=$thisstartangle+eval($thisslice); if($slicecounter<$sectionarray[$sectioncnt]){ $sectionanchor=$anchors[$sectioncnt]+$initialangle; }else{ $sectioncnt++; $sectionanchor=$anchors[$sectioncnt]+$initialangle; } if(eval($thisslice)>0){ print PIE "$c $m $y $k $thisstartangle $thisendangle ($label) $explodeoffset $sectionanchor pieslice\n"; print PIE "grestore\n"; } $thisstartangle=$thisendangle; $slicecounter++; $thisslice=$slice[$slicecounter]; } $sectionanchor=""; my $exportstr="convert $filewithdir -density 1200x1200 $piedirectory$piefile.$gexport"; print PIE "\n"; print PIE "showpage\n"; print PIE "grestore\n"; print PIE "%%trailer\n"; print PIE "%%EOF"; close LABELANDCOLOR; close PIE; if(length($gexport)>0){`$exportstr`;}}
Branch: 11 branches
BranchTrueFalseTotal
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if ($labelx > $labelmax) 0 0 0
open PIECHARTDATA, "<$data" or print "Cannot open data for reading\n" 0 0 0
if (defined($_ = readline PIECHARTDATA)) 0 0 0
open PIE, ">$filewithdir" or print q[Couldn't create output file: ] . $thispiefile 0 0 0
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if ($slicecounter < $sectionarray[$sectioncnt]) { } 0 0 0
if (eval $thisslice > 0) 0 0 0
if (length $gexport > 0) 0 0 0
496 }
497 0 ▶sub pie6{
Subroutine pie6: not called CC=12 SCAR=50.5
Pod undocumented
498 0 my ($startingangle,$ps, $data, $labelandcolor, $hscale, $vscale, $gexport, $valuetype) = @_;
499 0 ▶my $slicecounter; my $piefile; my $piececount; my $thisdate = scalar localtime; my $piedirectory="pies/"; my @slice; my $slicecnt; my $piefileextension="eps"; my $hsize=$hscale; my $vsize=$vscale; my $yend; my $labelmax=0; my $labelx; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); while(<LABELANDCOLOR>) {$_=~s/\t.*//; $_=~s/ *$//; chomp; $labelx=length($_)+10; if($labelx>$labelmax){$labelmax=$labelx; } $piececount++;} close(LABELANDCOLOR); my $xstart=int(306-($hsize*350/2)-($labelmax*$hsize)); my $xend=int(306+($hsize*350/2)+($labelmax*$hsize)); my $ystart=int(396-($vsize*350/2)-($labelmax*$vsize)); $yend=int(396+($vsize*350/2)+($labelmax*$vsize)); my @lclines; my $lclines; my $label; my $c; my $m; my $y; my $k; my $thisendangle; my $thisslice; my $thisstartangle; my $filewithdir; my $thispiefile; open(PIECHARTDATA, "<$data") || die "Couldn't open $data\n"; while(<PIECHARTDATA>) {chomp; @slice=split/\t/,$_; $slicecnt=@slice; $piefile=$slice[$slicecnt-1]; $thisslice=$slice[0]; $slicecounter=0; $thispiefile=$piefile.".".$piefileextension; $filewithdir=$piedirectory.$thispiefile; open(PIE, ">$filewithdir") or die("Couldn't create output file: ".$thispiefile); print PIE "%!PS-ADOBE 3.0 EPSF-3.0\n"; print PIE "%%Title: ".$thispiefile."\n"; print PIE "%%Creator: createpies.pl (c)Ken Owen 1999-2016\n"; print PIE "%%Creationdate: ".$thisdate."\n"; print PIE "%%BoundingBox: $xstart $ystart $xend $yend\n\n"; print PIE "/typesize " . $valuetype . " def\n"; print PIE $ps; print PIE "\n%%set scale and translation\n"; print PIE "306 396 translate $hsize $vsize scale\n"; $thisstartangle=$startingangle; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor"); my $counter=0; while (<LABELANDCOLOR>) { chomp; $lclines[$counter]=$_; $counter++; } foreach $lclines(@lclines){ ($label, $c, $m, $y, $k)=split/\t/,$lclines; print PIE "%%draw pie chart\n"; $thisendangle=$thisstartangle+eval($thisslice); if(eval($thisslice)>0){ print PIE "$c $m $y $k $thisstartangle $thisendangle ($label) pieslice\n"; } $thisstartangle=$thisendangle; $slicecounter++; $thisslice=$slice[$slicecounter]; } my $exportstr="convert $filewithdir -density 1200x1200 $piedirectory$piefile.$gexport"; print PIE "\n"; print PIE "showpage\n"; print PIE "grestore\n"; print PIE "%%trailer\n"; print PIE "%%EOF"; close LABELANDCOLOR; close PIE; if(length($gexport)>0){`$exportstr`;} }
Branch: 10 branches
BranchTrueFalseTotal
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if ($labelx > $labelmax) 0 0 0
open PIECHARTDATA, "<$data" or die "Couldn't open $data\n" 0 0 0
if (defined($_ = readline PIECHARTDATA)) 0 0 0
open PIE, ">$filewithdir" or die q[Couldn't create output file: ] . $thispiefile 0 0 0
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if (eval $thisslice > 0) 0 0 0
if (length $gexport > 0) 0 0 0
500 }
501 0 ▶sub column1{
Subroutine column1: not called CC=16 SCAR=56.1
Pod undocumented
502 0 my ($ps, $data, $labelandcolor, $hsize, $vsize, $gexport, $columnwidth, $format, $headertype, $axistype, $valuetype, $backgroundcolor, $headercolor) = @_;
503 0 ▶my $l1; my $l2; my $number; my $colfileextension="eps"; my $roundto; my $topscale=0; my $coldirectory="columns/"; my $thisdate; my @cols; my $cols; my $number_columns=0; $columnwidth=$columnwidth; my $thiscolfile; my $colname; my $filewithdir; my $xstart; my $xend; my $ystart; my $yend; my $labeldepth=36; my $valuedepth=36; my $chartdepth=217; my $totaldepth; my $chartwidth; my $labelpos; my $i; my $maxval; my $yaxis=72; my $c; my $m; my $y; my $k; my $label; my $cstart; open(COLCHARTDATA, "<$data") or die("Couldn't open $data"); while (<COLCHARTDATA>) { chomp; @cols=split/\t/,$_; $number_columns=@cols - 1; $labelpos=@cols; $chartwidth=$yaxis + $columnwidth/2 + 1.5*$number_columns*$columnwidth; my $cwidth=$columnwidth*$hsize; $xstart=int(306 - $hsize*$chartwidth/2); $xend=int(306 + $hsize*$chartwidth/2); $totaldepth=($chartdepth+$valuedepth+$labeldepth) * $vsize + 1; $ystart=int(396 - $vsize*$totaldepth/2 - 2); $yend=int(396 + $vsize*$totaldepth/2 + 1); $thisdate = scalar localtime; $colname=$cols[$number_columns]; $thiscolfile=$colname . "." . $colfileextension; $filewithdir=$coldirectory.$thiscolfile; open(COL, ">$filewithdir") || die "Couldn't create output file: " . $thiscolfile . "\n"; print COL "%!PS-ADOBE 3.0 EPSF-3.0\n"; print COL "%%Title: ".$thiscolfile."\n"; print COL "%%Creator: createcolumns.pl (c)Ken Owen 2001 - 2014\n"; print COL "%%Creationdate: ".$thisdate."\n"; print COL "%%BoundingBox: $xstart $ystart $xend $yend\n"; print COL "<< /PageSize [1000 1000] >> setpagedevice \n gsave\n"; print COL "$xstart $ystart translate $hsize $vsize scale\n"; print COL "/cwidth $cwidth def\n" . $ps; print COL "%%background areas\n"; print COL "/bkground {$backgroundcolor setcmykcolor} def\n";print COL "0 $yaxis add 2 sub $chartdepth $valuedepth add $vsize mul $chartwidth $yaxis sub $labeldepth bkgroundbox\n"; print COL "0 $yaxis add 2 sub 0 $chartwidth $yaxis sub $chartdepth $vsize mul bkgroundbox\n"; print COL "/headertype {$headercolor setcmykcolor /Helvetica-Bold findfont $headertype vsize mul scalefont setfont} def\n/axistype {/Helvetica-Bold findfont $axistype vsize mul scalefont setfont} def\n/valuetype {/Helvetica-Bold findfont $valuetype vsize mul scalefont setfont} def\n"; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); print COL "%%draw column chart\n"; $maxval=0; for ($i=0; $i<@cols-1;$i++){ if($cols[$i]>$maxval){$maxval=$cols[$i];} } if($maxval<10){ $roundto=1; }elsif($maxval<100){ $roundto=10; }elsif($maxval<1000){ $roundto=100; }elsif($maxval<10000){ $roundto=1000; }elsif($maxval<100000){ $roundto=10000; }else{ $roundto=25000; } if(($maxval%$roundto)==0){ $topscale=$maxval; }else{ $topscale=($roundto-($maxval%$roundto)+$maxval); } print COL "gsave (".&makedollars(0, $format, 1).") (".&makedollars($topscale/5, $format, 1).") (".&makedollars($topscale*2/5, $format, 1).") (".&makedollars($topscale*3/5, $format, 1).") (".&makedollars($topscale*4/5, $format, 1).") (".&makedollars($topscale, $format, 1).") $chartwidth $yaxis sub $hsize $vsize chartscale grestore\n"; $i=0; while(<LABELANDCOLOR>){ chomp; ($label, $c, $m, $y, $k)=split/\t/,$_; $l1=""; $l2=""; if(length($label)>15){ $l1=$label; $l2=$label; $l1=~s/ \S*$//; $l2=substr($label, length($l1)); }else{ $l2=$label; } $cstart=$yaxis + $columnwidth/2 + $i*1.5*$columnwidth; print COL "$c $m $y $k $i " . 215*$vsize*$cols[$i]/$topscale . " (" . &makedollars($cols[$i], $format, 0) . ") ($l1) ($l2) $cstart $columnwidth column\n"; $i++; } my $exportstr="convert $filewithdir -density 1200x1200 $coldirectory$colname.$gexport"; print COL "showpage\n"; print COL "grestore\n"; print COL "%%trailer\n"; print COL "%%EOF"; if(length($gexport)>0){`$exportstr`; }} close LABELANDCOLOR; close COL;
Branch: 15 branches
BranchTrueFalseTotal
open COLCHARTDATA, "<$data" or die "Couldn't open $data" 0 0 0
if (defined($_ = readline COLCHARTDATA)) 0 0 0
open COL, ">$filewithdir" or die q[Couldn't create output file: ] . $thiscolfile . "\n" 0 0 0
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if ($i < @cols - 1) 0 0 0
if ($cols[$i] > $maxval) 0 0 0
if ($maxval < 10) { } 0 0 0
elsif ($maxval < 100) { } 0 0 0
elsif ($maxval < 1000) { } 0 0 0
elsif ($maxval < 10000) { } 0 0 0
elsif ($maxval < 100000) { } 0 0 0
if ($maxval % $roundto == 0) { } 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if (length $label > 15) { } 0 0 0
if (length $gexport > 0) 0 0 0
504 }
505 0 ▶sub bar1{
Subroutine bar1: not called CC=16 SCAR=56.1
Pod undocumented
506 0 ▶my ($ps, $data, $labelandcolor, $hsize, $vsize, $gexport, $columnwidth, $format, $headertype, $axistype, $valuetype, $backgroundcolor, $headercolor, $valuecolor) = @_; my $l1; my $l2; my $number; my $colfileextension="eps"; my $roundto; my $topscale=0; my $coldirectory="bars/"; print "coldirectory=$coldirectory\n"; my $thisdate; my @cols; my $cols; my $number_columns=0; $columnwidth=$columnwidth; my $thiscolfile; my $colname; my $filewithdir; my $xstart; my $xend; my $ystart; my $ystartb; my $yend; my $labeldepth=36; my $valuedepth=36; my $chartdepth; my $totaldepth; my $chartwidth; my $labelpos; my $i; my $maxval; my $yaxis=72; my $c; my $m; my $y; my $k; my $label; my $cstart; my $extrawidth=0; my $barwidth; my $chartscale; open(BARCHARTDATA, "<$data") or die("Couldn't open $data"); while (<BARCHARTDATA>) { chomp; @cols=split/\t/,$_; $number_columns=@cols - 1; $labelpos=@cols; $chartdepth=$columnwidth/2 + 1.5*$number_columns*$columnwidth; $totaldepth=$chartdepth * $vsize + 1; $ystart=int(396 - $vsize*$totaldepth/2); $ystartb=int($ystart - 24); $yend=int(396 + $vsize*$totaldepth/2 + 1); $thisdate = scalar localtime; $colname=$cols[$number_columns]; $thiscolfile=$colname . "." . $colfileextension; $filewithdir=$coldirectory.$thiscolfile; $maxval=0; $extrawidth=0; for ($i=0; $i<@cols-1;$i++){ if($cols[$i]>$maxval){$maxval=$cols[$i];} } if($maxval<10){ $roundto=1; }elsif($maxval<100){ $roundto=10; }elsif($maxval<1000){ $roundto=100; }elsif($maxval<10000){ $roundto=1000; }elsif($maxval<100000){ $roundto=10000; }else{ $roundto=25000; } if(($maxval%$roundto)==0){ $topscale=$maxval; }else{ $topscale=($roundto-($maxval%$roundto)+$maxval); } $extrawidth=35; $chartscale=259/$topscale; $chartwidth=$yaxis + $chartscale * $topscale + $extrawidth; $barwidth=$chartwidth-$yaxis; $xstart=int(306 - $hsize*$chartwidth/2); $xend=int(306 + $hsize*$chartwidth/2 + $extrawidth); open(BAR, ">$filewithdir") || die "Couldn't create output file: " . $thiscolfile . "\n"; print BAR "%!PS-ADOBE 3.0 EPSF-3.0\n"; print BAR "%%Title: ".$thiscolfile."\n"; print BAR "%%Creator: createbars.pl (c)Ken Owen 2014\n"; print BAR "%%Creationdate: ".$thisdate."\n"; print BAR "%%BoundingBox: $xstart $ystartb $xend $yend\n"; print BAR "%%%Debug maxval=$maxval topscale=$topscale extrawidth=$extrawidth chartwidth=$chartwidth chartscale=$chartscale\n"; print BAR "<< /PageSize [1000 1000] >> setpagedevice \n gsave\n"; print BAR "$xstart $ystart translate $hsize $vsize scale\n"; print BAR "/bwidth $columnwidth def\n"; print BAR $ps; print BAR "%%background areas\n"; print BAR "/bkground {$backgroundcolor setcmykcolor} def\n"; print BAR "0 $yaxis add 2 sub 0 $chartwidth $extrawidth add $yaxis sub $chartdepth bkgroundbox\n"; print BAR "/headertype {$headercolor setcmykcolor /Helvetica-Bold findfont $headertype vsize mul scalefont setfont} def\n/axistype {/Helvetica-Bold findfont $axistype vsize mul scalefont setfont} def\n/valuetype {/Helvetica-Bold findfont $valuetype vsize mul scalefont setfont} def\n"; print BAR "/valuecolor {$valuecolor setgray} def\n"; open(LABELANDCOLOR, "<$labelandcolor") or die("Couldn't open $labelandcolor\n"); print BAR "%%draw bar chart\n"; print BAR "gsave (".&makedollars(0, $format, 1).") (".&makedollars($topscale/5, $format, 1).") (".&makedollars($topscale*2/5, $format, 1).") (".&makedollars($topscale*3/5, $format, 1).") (".&makedollars($topscale*4/5, $format, 1).") (".&makedollars($topscale, $format, 1).") $chartdepth $chartwidth $yaxis sub $hsize $vsize chartscale grestore\n"; $i=0; while(<LABELANDCOLOR>){ chomp; ($label, $c, $m, $y, $k)=split/\t/,$_; $l1=""; $l2=""; if(length($label)>15){ $l1=$label; $l2=$label; $l1=~s/ \S*$//; $l2=substr($label, length($l1)); }else{ $l2=$label; } $cstart=$columnwidth/2 + $i*1.5*$columnwidth; print BAR "$c $m $y $k $i " . $barwidth*$cols[$i]/$topscale . " (" . &makedollars($cols[$i], $format, 0) . ") ($l1) ($l2) $cstart $columnwidth bar\n"; print BAR "% barwidth=$barwidth cstart=$cstart\n"; $i++; } my $exportstr="convert $filewithdir -density 1200x1200 $coldirectory$colname.$gexport"; print BAR "showpage\n"; print BAR "grestore\n"; print BAR "%%trailer\n"; print BAR "%%EOF"; if(length($gexport)>0){`$exportstr`; } } close LABELANDCOLOR; close BAR;
Branch: 15 branches
BranchTrueFalseTotal
open BARCHARTDATA, "<$data" or die "Couldn't open $data" 0 0 0
if (defined($_ = readline BARCHARTDATA)) 0 0 0
if ($i < @cols - 1) 0 0 0
if ($cols[$i] > $maxval) 0 0 0
if ($maxval < 10) { } 0 0 0
elsif ($maxval < 100) { } 0 0 0
elsif ($maxval < 1000) { } 0 0 0
elsif ($maxval < 10000) { } 0 0 0
elsif ($maxval < 100000) { } 0 0 0
if ($maxval % $roundto == 0) { } 0 0 0
open BAR, ">$filewithdir" or die q[Couldn't create output file: ] . $thiscolfile . "\n" 0 0 0
open LABELANDCOLOR, "<$labelandcolor" or die "Couldn't open $labelandcolor\n" 0 0 0
if (defined($_ = readline LABELANDCOLOR)) 0 0 0
if (length $label > 15) { } 0 0 0
if (length $gexport > 0) 0 0 0
507 }
508 0 ▶sub makedollars{ my $number=shift; my $format=shift; my $scale=shift; my $decimal=0; my $decimal1=0; if($number < 1000000){ if($number<100000){ if($number<10000){ if($number<1000){}else{ $number=substr($number,0,1).",".substr($number,1); }}else{ $number=substr($number,0,2).",".substr($number,2); } }else{ $number=substr($number,0,3).",".substr($number,3); } }else{ $number=substr($number,0,1).",".substr($number,1,3).",".substr($number,4);} if($scale==1){$number=int($number); if($format eq "money"){$number="\$".$number;}}else{if($format eq "money"){$number=int($number);$number="\$".$number;}elsif(substr($format,0,1) eq "d"){$decimal1=substr($format,1,1);$decimal=10**$decimal1; $number=$number*$decimal; $number=int($number);$number=$number/$decimal;$decimal1="%." . $decimal1 . "f";$number=sprintf($decimal1, $number);}else{$number="Illegal Format!";}} return $number;
Subroutine makedollars: not called CC=9 SCAR=45.0
Pod undocumented
Branch: 8 branches
BranchTrueFalseTotal
if ($number < 1000000) { } 0 0 0
if ($number < 100000) { } 0 0 0
if ($number < 10000) { } 0 0 0
if ($number < 1000) { } 0 0 0
if ($scale == 1) { } 0 0 0
if ($format eq "money") 0 0 0
if ($format eq 'money') { } 0 0 0
elsif (substr($format, 0, 1) eq 'd') { } 0 0 0
509 }
510 1 1;
511  
512  
513 1 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=3 SCAR=12.0
514 # This AUTOLOAD is used to 'autoload' constants from the constant()
515 # XS function.
516  
517 1 my $constname;
518 1 our $AUTOLOAD;
519 1 ($constname = $AUTOLOAD) =~ s/.*:://;
520 1 ▶ croak "&PSGRAPH::constant not defined" if $constname eq 'constant';
Branch: 1 branch
BranchTrueFalseTotal
if $constname eq "constant" 0 1 1
521 1 my ($error, $val) = constant($constname);
522 1 ▶ if ($error) { croak $error; }
Branch: 1 branch
BranchTrueFalseTotal
if ($error) 1 0 1
523 {
524 0 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.2
525 # Fixed between 5.005_53 and 5.005_61
526 #XXX if ($] >= 5.00561) {
527 #XXX *$AUTOLOAD = sub () { $val };
528 #XXX }
529 #XXX else {
530 0 ▶ *$AUTOLOAD = sub { $val };
Subroutine __ANON__: not called CC=1 SCAR=6.9
531 #XXX }
532 }
533 0 goto &$AUTOLOAD;
534 }
535  
536 1 require XSLoader;
537 1 XSLoader::load('PSGRAPH', $VERSION);
538  
539 # Preloaded methods go here.
540  
541 # Autoload methods go after =cut, and are processed by the autosplit program.
542  
543 1 1;
544 __END__
↑ Summary const-xs.inc »