| 1 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | =encoding utf8 | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | Quiq::Gnuplot::Process - Gnuplot-Prozess | ||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | =head1 BASE CLASS | ||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | L<Quiq::Hash> | ||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | Ein Objekt der Klasse repräsentiert einen Gnuplot-Prozess. | ||||||||||||||||||||||||||||
| 16 | Ein Gnuplot-Prozess erzeugt Plots. | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =cut | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | package Quiq::Gnuplot::Process; | ||||||||||||||||||||||||||||
| 23 | 1 | ▶ | use base qw/Quiq::Hash/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 1 | ▶ | use v5.10; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 26 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 27 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 1 | our $VERSION = '1.240'; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 1 | ▶ | use Quiq::Gnuplot::Plot; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 32 | 1 | ▶ | use Quiq::FileHandle; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 33 | 1 | ▶ | use Quiq::Path; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =head1 METHODS | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | =head2 Konstruktor | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | =head3 new() - Instantiiere Gnuplot-Prozess | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | $gnu = Quiq::Gnuplot::Process->new; | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =cut | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 52 | 0 | my $class = shift; | |||||||||||||||||||||||||||
| 53 | # @_: @keyVal | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | 0 | my $fh = Quiq::FileHandle->new('|-','gnuplot'); | |||||||||||||||||||||||||||
| 56 | 0 | $fh->autoFlush; | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | my $self = $class->SUPER::new( | |||||||||||||||||||||||||||
| 59 | debug => 0, | ||||||||||||||||||||||||||||
| 60 | fh => $fh, | ||||||||||||||||||||||||||||
| 61 | ); | ||||||||||||||||||||||||||||
| 62 | 0 | $self->set(@_); | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | return $self; | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | =head2 Objektmethoden | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =head3 render() - Rendere Plot | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | $gnu->render($plt); | ||||||||||||||||||||||||||||
| 76 | $img = $gnu->render($plt); # funktioniert nicht | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | =head4 Description | ||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | Rendere den Plot und speichere ihn auf auf der angebenen Bilddatei | ||||||||||||||||||||||||||||
| 81 | oder liefere die Bilddaten zurück. Werden die Bilddaten zurückgeliefert, | ||||||||||||||||||||||||||||
| 82 | wird die Bilddatei automatisch gelöscht. | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | =cut | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub render { | ||||||||||||||||||||||||||
|
Subroutine
render: not called CC=49 SCAR=78.0
Pod
documented
| |||||||||||||||||||||||||||||
| 89 | 0 | my ($self,$plt) = @_; | |||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 0 | my $fh = $self->fh; | |||||||||||||||||||||||||||
| 92 | 0 | my $timeSeries = $plt->timeSeries; | |||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | 0 | ▶ | if (my $terminal = $plt->terminal) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 95 | 0 | my $cmd = "set terminal $terminal"; | |||||||||||||||||||||||||||
| 96 | 0 | my $width = $plt->width; | |||||||||||||||||||||||||||
| 97 | 0 | my $height = $plt->height; | |||||||||||||||||||||||||||
| 98 | 0 | ▶ | if ($width && $height) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$width and $height
MC/DC0%0/2
$width and $height
$width
$height
Truth table0%0/3
A and B
A= $widthB= $height
| |||||||||||||||||||||||||||||
| 99 | 0 | $cmd .= " size $width, $height"; | |||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||
| 101 | # $cmd .= ' small'; # globaler font s. S. 2006 | ||||||||||||||||||||||||||||
| 102 | 0 | $self->print("$cmd\n"); | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | 0 | $self->print("set lmargin 12\n"); | |||||||||||||||||||||||||||
| 105 | # $self->print("set size 0.5\n"); | ||||||||||||||||||||||||||||
| 106 | # $self->print("set origin 0.5,0.5\n"); | ||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||
| 108 | 0 | my $output = $plt->output; | |||||||||||||||||||||||||||
| 109 | 0 | ▶ | if ($output) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 110 | 0 | $self->print("set output '$output'\n"); | |||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if ($timeSeries) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 114 | 0 | $self->print("set xdata time\n"); | |||||||||||||||||||||||||||
| 115 | # $self->print("unset autoscale x\n"); | ||||||||||||||||||||||||||||
| 116 | 0 | $self->print(qq|set timefmt "%Y-%m-%d %H:%M:%S"\n|); | |||||||||||||||||||||||||||
| 117 | 0 | ▶ | if (my $formatX = $plt->formatX || '%H:%M') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/2
$plt->formatX || '%H:%M'
MC/DC0%0/1
$plt->formatX || '%H:%M'
$plt->formatX
Truth table0%0/2
A
A= $plt->formatX
| |||||||||||||||||||||||||||||
| 118 | 0 | $self->print(qq|set format x "$formatX"\n|); | |||||||||||||||||||||||||||
| 119 | # $self->print("set format x '%H:%M'\n"); | ||||||||||||||||||||||||||||
| 120 | # $self->print("set format x '%Y-%m-%d %H:%M'\n"); | ||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | 0 | my $xMin = $plt->xMin; | |||||||||||||||||||||||||||
| 125 | 0 | my $xMax = $plt->xMax; | |||||||||||||||||||||||||||
| 126 | 0 | ▶ | if (defined $xMin || defined $xMax) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $xMin or defined $xMax
MC/DC0%0/2
defined $xMin or defined $xMax
defined $xMin
defined $xMax
Truth table0%0/3
A or B
A= defined $xMinB= defined $xMax
| |||||||||||||||||||||||||||||
| 127 | 0 | my $cmd = 'set xrange ['; | |||||||||||||||||||||||||||
| 128 | 0 | ▶ | if (defined $xMin) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 129 | 0 | $cmd .= "'$xMin'"; | |||||||||||||||||||||||||||
| 130 | } | ||||||||||||||||||||||||||||
| 131 | 0 | $cmd .= ':'; | |||||||||||||||||||||||||||
| 132 | 0 | ▶ | if (defined $xMax) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 133 | 0 | $cmd .= "'$xMax'"; | |||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||
| 135 | 0 | $cmd .= ']'; | |||||||||||||||||||||||||||
| 136 | 0 | $self->print("$cmd\n"); | |||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||
| 139 | 0 | my $yMin = $plt->yMin; | |||||||||||||||||||||||||||
| 140 | 0 | my $yMax = $plt->yMax; | |||||||||||||||||||||||||||
| 141 | 0 | ▶ | if (defined $yMin || defined $yMax) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $yMin or defined $yMax
MC/DC0%0/2
defined $yMin or defined $yMax
defined $yMin
defined $yMax
Truth table0%0/3
A or B
A= defined $yMinB= defined $yMax
| |||||||||||||||||||||||||||||
| 142 | 0 | my $cmd = 'set yrange ['; | |||||||||||||||||||||||||||
| 143 | 0 | ▶ | if (defined $yMin) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 144 | 0 | $cmd .= $yMin; | |||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||
| 146 | 0 | $cmd .= ':'; | |||||||||||||||||||||||||||
| 147 | 0 | ▶ | if (defined $yMax) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 148 | 0 | $cmd .= $yMax; | |||||||||||||||||||||||||||
| 149 | } | ||||||||||||||||||||||||||||
| 150 | 0 | $cmd .= ']'; | |||||||||||||||||||||||||||
| 151 | 0 | $self->print("$cmd\n"); | |||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||
| 154 | 0 | ▶ | if (my $title = $plt->title) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | 0 | my $cmd = qq|set title "$title"|; | |||||||||||||||||||||||||||
| 156 | 0 | ▶ | if (my $titleFont = $plt->titleFont) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 157 | 0 | $cmd .= qq| font "$titleFont"|; | |||||||||||||||||||||||||||
| 158 | } | ||||||||||||||||||||||||||||
| 159 | 0 | $self->print("$cmd\n"); | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | 0 | ▶ | if (my $xlabel = $plt->xlabel) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 162 | 0 | $self->print(qq|set xlabel "$xlabel"\n|); | |||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||
| 164 | 0 | ▶ | if (my $ylabel = $plt->ylabel) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 165 | 0 | $self->print(qq|set ylabel "$ylabel"\n|); | |||||||||||||||||||||||||||
| 166 | } | ||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||
| 168 | 0 | ▶ | if (my $ytics = $plt->ytics) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 169 | 0 | $self->print("set ytics $ytics\n"); | |||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||
| 172 | 0 | ▶ | if ($plt->mxTics) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 173 | 0 | $self->print("set mxtics\n"); | |||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||
| 175 | 0 | ▶ | if ($plt->myTics) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 176 | 0 | $self->print("set mytics\n"); | |||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 0 | my $legendPos = $plt->legendPosition; | |||||||||||||||||||||||||||
| 180 | 0 | $self->print("set key $legendPos reverse Left box linetype 0\n"); | |||||||||||||||||||||||||||
| 181 | 0 | $self->print("set grid xtics mxtics ytics mytics back\n"); | |||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | # Arrows | ||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||
| 185 | 0 | my $arwA = $plt->arrows; | |||||||||||||||||||||||||||
| 186 | 0 | ▶ | if (@$arwA) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 187 | 0 | my $i = 1; | |||||||||||||||||||||||||||
| 188 | 0 | for my $arw (@$arwA) { | |||||||||||||||||||||||||||
| 189 | 0 | my $str = sprintf 'set arrow %d',$i++; | |||||||||||||||||||||||||||
| 190 | 0 | my $fromA = $arw->from; | |||||||||||||||||||||||||||
| 191 | 0 | ▶ | if ($timeSeries) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 192 | 0 | $str .= sprintf " from '%s',%s",@$fromA; | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | else { | ||||||||||||||||||||||||||||
| 195 | 0 | $str .= sprintf " from %s,%s",@$fromA; | |||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||
| 197 | 0 | my $toA = $arw->to; | |||||||||||||||||||||||||||
| 198 | 0 | ▶ | if ($timeSeries) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 0 | $str .= sprintf " to '%s',%s",@$toA; | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | else { | ||||||||||||||||||||||||||||
| 202 | 0 | $str .= sprintf " to %s,%s",@$toA; | |||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||
| 204 | 0 | ▶ | if (my $heads = $arw->heads) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 205 | 0 | $str .= " $heads"; | |||||||||||||||||||||||||||
| 206 | } | ||||||||||||||||||||||||||||
| 207 | 0 | ▶ | if (my $lineType = $arw->lineType) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 208 | 0 | $str .= " linetype $lineType"; | |||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | 0 | ▶ | if (my $lineWidth = $arw->lineWidth) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 211 | 0 | $str .= " linewidth $lineWidth"; | |||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||
| 213 | 0 | ▶ | if (my $lineStyle = $arw->lineStyle) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 214 | 0 | $str .= " linestyle $lineStyle"; | |||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||
| 216 | 0 | $str .= "\n"; | |||||||||||||||||||||||||||
| 217 | 0 | $self->print($str); | |||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||
| 221 | # Labels | ||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||
| 223 | 0 | my $labA = $plt->labels; | |||||||||||||||||||||||||||
| 224 | 0 | ▶ | if (@$labA) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 225 | 0 | my $i = 1; | |||||||||||||||||||||||||||
| 226 | 0 | for my $lab (@$labA) { | |||||||||||||||||||||||||||
| 227 | 0 | my $str = sprintf 'set label %d "%s"',$i++,$lab->text; | |||||||||||||||||||||||||||
| 228 | 0 | my $atA = $lab->at; | |||||||||||||||||||||||||||
| 229 | 0 | ▶ | if ($timeSeries) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 230 | 0 | $str .= sprintf " at '%s',%s",@$atA; | |||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||
| 232 | else { | ||||||||||||||||||||||||||||
| 233 | 0 | $str .= sprintf " at %s,%s",@$atA; | |||||||||||||||||||||||||||
| 234 | } | ||||||||||||||||||||||||||||
| 235 | 0 | ▶ | if (my $font = $lab->font) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 236 | 0 | $str .= " font '$font'"; | |||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||
| 238 | 0 | ▶ | if (my $textColor = $lab->textColor) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 239 | 0 | $str .= " tc $textColor"; | |||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||
| 241 | 0 | $str .= "\n"; | |||||||||||||||||||||||||||
| 242 | 0 | $self->print($str); | |||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||
| 246 | # Graphen | ||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||
| 248 | 0 | my $gphA = $plt->graphsWithData; | |||||||||||||||||||||||||||
| 249 | 0 | ▶ | if (@$gphA) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 250 | 0 | my $str; | |||||||||||||||||||||||||||
| 251 | 0 | for my $gph (@$gphA) { | |||||||||||||||||||||||||||
| 252 | 0 | ▶ | if ($str) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 253 | 0 | $str .= ', '; | |||||||||||||||||||||||||||
| 254 | } | ||||||||||||||||||||||||||||
| 255 | 0 | ▶ | my $to = $timeSeries? 3: 2; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 256 | 0 | $str .= "'-' using 1:$to"; | |||||||||||||||||||||||||||
| 257 | 0 | ▶ | if (my $title = $gph->title) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 258 | 0 | $str .= " title '$title'"; | |||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||
| 260 | else { | ||||||||||||||||||||||||||||
| 261 | 0 | $str .= ' notitle'; | |||||||||||||||||||||||||||
| 262 | } | ||||||||||||||||||||||||||||
| 263 | 0 | ▶ | my $with = $gph->with || 'points'; | ||||||||||||||||||||||||||
|
Condition0%0/2
$gph->with || 'points'
MC/DC0%0/1
$gph->with || 'points'
$gph->with
Truth table0%0/2
A
A= $gph->with
| |||||||||||||||||||||||||||||
| 264 | 0 | $str .= " with $with"; | |||||||||||||||||||||||||||
| 265 | 0 | my $style = $gph->style; | |||||||||||||||||||||||||||
| 266 | 0 | ▶ | if (defined $style) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 267 | 0 | $str .= " $style"; | |||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||
| 269 | } | ||||||||||||||||||||||||||||
| 270 | 0 | $self->print("plot $str\n"); | |||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||
| 272 | 0 | for my $gph (@$gphA) { | |||||||||||||||||||||||||||
| 273 | 0 | my $dataA = $gph->data; | |||||||||||||||||||||||||||
| 274 | 0 | ▶ | for (my $i = 0; $i < @$dataA; $i += 2) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 275 | 0 | my $x = $dataA->[$i]; | |||||||||||||||||||||||||||
| 276 | 0 | ▶ | if (!defined $x || $x eq '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $x or $x eq ""
MC/DC0%0/2
not defined $x or $x eq ""
not defined $x
$x eq ""
Truth table0%0/3
not(A) or B
A= not defined $xB= $x eq ""
| |||||||||||||||||||||||||||||
| 277 | 0 | $x = 'NaN'; | |||||||||||||||||||||||||||
| 278 | } | ||||||||||||||||||||||||||||
| 279 | 0 | my $y = $dataA->[$i+1]; | |||||||||||||||||||||||||||
| 280 | 0 | ▶ | if (!defined $y || $y eq '') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $y or $y eq ""
MC/DC0%0/2
not defined $y or $y eq ""
not defined $y
$y eq ""
Truth table0%0/3
not(A) or B
A= not defined $yB= $y eq ""
| |||||||||||||||||||||||||||||
| 281 | 0 | $y = 'NaN'; | |||||||||||||||||||||||||||
| 282 | } | ||||||||||||||||||||||||||||
| 283 | 0 | $self->print("$x $y\n"); | |||||||||||||||||||||||||||
| 284 | } | ||||||||||||||||||||||||||||
| 285 | 0 | $self->print("e\n"); | |||||||||||||||||||||||||||
| 286 | } | ||||||||||||||||||||||||||||
| 287 | } | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | 0 | $self->print("reset\n"); | |||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | # Forcieren, dass Gnuplot die Datei schreibt | ||||||||||||||||||||||||||||
| 292 | 0 | $self->print("unset output\n"); | |||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||
| 294 | # Funktioniert nicht, da wir nicht wissen, wann Gnuplot die Datei | ||||||||||||||||||||||||||||
| 295 | # zuende geschrieben hat | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | #if (defined wantarray) { | ||||||||||||||||||||||||||||
| 298 | # # Wir liefern die Bilddaten zurück und löschen die Datei | ||||||||||||||||||||||||||||
| 299 | # | ||||||||||||||||||||||||||||
| 300 | # my $img = Quiq::Path->read($output); | ||||||||||||||||||||||||||||
| 301 | # Quiq::Path->delete($output); | ||||||||||||||||||||||||||||
| 302 | # return $img; | ||||||||||||||||||||||||||||
| 303 | #} | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | # Wir liefern nichts zurück, die Bilddatei bleibt stehen | ||||||||||||||||||||||||||||
| 306 | 0 | return; | |||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||
| 311 | =head3 print() - Übertrage Daten an den Gnuplot-Prozess | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | =head4 Synopsis | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | $gnu->print(@data); | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | =cut | ||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||
| 319 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||
| 321 | 0 | ▶ | sub print { | ||||||||||||||||||||||||||
|
Subroutine
print: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 322 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 323 | # @_: @data | ||||||||||||||||||||||||||||
| 324 | |||||||||||||||||||||||||||||
| 325 | 0 | my $fh = $self->fh; | |||||||||||||||||||||||||||
| 326 | 0 | $fh->print(@_); | |||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | 0 | ▶ | if (my $debug = $self->debug) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 329 | 0 | warn @_; | |||||||||||||||||||||||||||
| 330 | } | ||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||
| 332 | 0 | return; | |||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | =head1 VERSION | ||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||
| 339 | 1.240 | ||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||
| 341 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | Frank Seitz, L<http://fseitz.de/> | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | Copyright (C) 2026 Frank Seitz | ||||||||||||||||||||||||||||
| 348 | |||||||||||||||||||||||||||||
| 349 | =head1 LICENSE | ||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||
| 351 | This code is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 352 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||
| 354 | =cut | ||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||
| 356 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||
| 358 | 1 | 1; | |||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||
| 360 | # eof | ||||||||||||||||||||||||||||