| 1 | # ----------------------------------------------------------------------------- | ||||||||||
| 2 | |||||||||||
| 3 | =encoding utf8 | ||||||||||
| 4 | |||||||||||
| 5 | =head1 NAME | ||||||||||
| 6 | |||||||||||
| 7 | Quiq::Axis - Definition einer Plot-Achse (abstrakte Basisklasse) | ||||||||||
| 8 | |||||||||||
| 9 | =head1 BASE CLASS | ||||||||||
| 10 | |||||||||||
| 11 | L<Quiq::Hash> | ||||||||||
| 12 | |||||||||||
| 13 | =cut | ||||||||||
| 14 | |||||||||||
| 15 | # ----------------------------------------------------------------------------- | ||||||||||
| 16 | |||||||||||
| 17 | package Quiq::Axis; | ||||||||||
| 18 | 3 | ▶ | use base qw/Quiq::Hash/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | |||||||||||
| 20 | 3 | ▶ | use v5.10; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 21 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 22 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 23 | |||||||||||
| 24 | 3 | our $VERSION = '1.240'; | |||||||||
| 25 | |||||||||||
| 26 | 3 | ▶ | use Quiq::AxisTick; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 27 | |||||||||||
| 28 | # ----------------------------------------------------------------------------- | ||||||||||
| 29 | |||||||||||
| 30 | =head1 METHODS | ||||||||||
| 31 | |||||||||||
| 32 | =head2 Gemeinsame Methoden | ||||||||||
| 33 | |||||||||||
| 34 | Die folgenden Methoden sind allen Subklassen gemeinsam. | ||||||||||
| 35 | |||||||||||
| 36 | =head3 font() - Label-Font | ||||||||||
| 37 | |||||||||||
| 38 | =head4 Synopsis | ||||||||||
| 39 | |||||||||||
| 40 | $fnt = $ax->font; | ||||||||||
| 41 | |||||||||||
| 42 | =head4 Description | ||||||||||
| 43 | |||||||||||
| 44 | Liefere den Font, in der die Label der Achse gesetzt werden. | ||||||||||
| 45 | |||||||||||
| 46 | =cut | ||||||||||
| 47 | |||||||||||
| 48 | # ----------------------------------------------------------------------------- | ||||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | sub font { | ||||||||
|
Subroutine
font: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 51 | 0 | return shift->{'font'}; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | # ----------------------------------------------------------------------------- | ||||||||||
| 55 | |||||||||||
| 56 | =head3 ticks() - Liste der Haupt-Ticks | ||||||||||
| 57 | |||||||||||
| 58 | =head4 Synopsis | ||||||||||
| 59 | |||||||||||
| 60 | @ticks | $tickA = $ax->ticks; | ||||||||||
| 61 | |||||||||||
| 62 | =head4 Description | ||||||||||
| 63 | |||||||||||
| 64 | Liefere die Liste der Haupt-Ticks der Achse. Im Skalarkontext liefere eine | ||||||||||
| 65 | Referenz auf die Liste. | ||||||||||
| 66 | |||||||||||
| 67 | =cut | ||||||||||
| 68 | |||||||||||
| 69 | # ----------------------------------------------------------------------------- | ||||||||||
| 70 | |||||||||||
| 71 | 0 | ▶ | sub ticks { | ||||||||
|
Subroutine
ticks: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 72 | 0 | my $self = shift; | |||||||||
| 73 | 0 | my $arr = $self->{'tickA'}; | |||||||||
| 74 | 0 | ▶ | return wantarray? @$arr: $arr; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 75 | } | ||||||||||
| 76 | |||||||||||
| 77 | # ----------------------------------------------------------------------------- | ||||||||||
| 78 | |||||||||||
| 79 | =head3 subTicks() - Liste der Unter-Ticks | ||||||||||
| 80 | |||||||||||
| 81 | =head4 Synopsis | ||||||||||
| 82 | |||||||||||
| 83 | @subTicks | $subTickA = $ax->subTicks; | ||||||||||
| 84 | |||||||||||
| 85 | =head4 Description | ||||||||||
| 86 | |||||||||||
| 87 | Liefere die Liste der Unter-Ticks der Achse. Im Skalarkontext liefere eine | ||||||||||
| 88 | Referenz auf die Liste. | ||||||||||
| 89 | |||||||||||
| 90 | =cut | ||||||||||
| 91 | |||||||||||
| 92 | # ----------------------------------------------------------------------------- | ||||||||||
| 93 | |||||||||||
| 94 | 0 | ▶ | sub subTicks { | ||||||||
|
Subroutine
subTicks: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 95 | 0 | my $self = shift; | |||||||||
| 96 | 0 | my $arr = $self->{'subTickA'}; | |||||||||
| 97 | 0 | ▶ | return wantarray? @$arr: $arr; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 98 | } | ||||||||||
| 99 | |||||||||||
| 100 | # ----------------------------------------------------------------------------- | ||||||||||
| 101 | |||||||||||
| 102 | =head3 width() - Breite des breitesten Labels | ||||||||||
| 103 | |||||||||||
| 104 | =head4 Synopsis | ||||||||||
| 105 | |||||||||||
| 106 | $width = $ax->width; | ||||||||||
| 107 | |||||||||||
| 108 | =head4 Description | ||||||||||
| 109 | |||||||||||
| 110 | Ermittele die Breite des breitesten Label in Pixeln und liefere | ||||||||||
| 111 | diesen Wert zurück. | ||||||||||
| 112 | |||||||||||
| 113 | =cut | ||||||||||
| 114 | |||||||||||
| 115 | # ----------------------------------------------------------------------------- | ||||||||||
| 116 | |||||||||||
| 117 | 0 | ▶ | sub width { | ||||||||
|
Subroutine
width: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 118 | 0 | my $self = shift; | |||||||||
| 119 | |||||||||||
| 120 | 0 | my $width = 0; | |||||||||
| 121 | 0 | for my $tik ($self->ticks) { | |||||||||
| 122 | 0 | my $n = $tik->width; | |||||||||
| 123 | 0 | ▶ | if ($n > $width) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 124 | 0 | $width = $n; | |||||||||
| 125 | } | ||||||||||
| 126 | } | ||||||||||
| 127 | 0 | ▶ | if ($width == 0) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 128 | # Keine Ticks. Wir nehmen stattdessen den Wert min. | ||||||||||
| 129 | 0 | $width = Quiq::AxisTick->new($self,$self->get('min'))->width; | |||||||||
| 130 | } | ||||||||||
| 131 | |||||||||||
| 132 | 0 | return $width; | |||||||||
| 133 | } | ||||||||||
| 134 | |||||||||||
| 135 | # ----------------------------------------------------------------------------- | ||||||||||
| 136 | |||||||||||
| 137 | =head3 height() - Höhe des höchsten Labels | ||||||||||
| 138 | |||||||||||
| 139 | =head4 Synopsis | ||||||||||
| 140 | |||||||||||
| 141 | $height = $ax->height; | ||||||||||
| 142 | |||||||||||
| 143 | =head4 Description | ||||||||||
| 144 | |||||||||||
| 145 | Ermittele die Höhe des höchsten Label in Pixeln und liefere | ||||||||||
| 146 | diesen Wert zurück. | ||||||||||
| 147 | |||||||||||
| 148 | =cut | ||||||||||
| 149 | |||||||||||
| 150 | # ----------------------------------------------------------------------------- | ||||||||||
| 151 | |||||||||||
| 152 | 0 | ▶ | sub height { | ||||||||
|
Subroutine
height: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||
| 153 | 0 | my $self = shift; | |||||||||
| 154 | |||||||||||
| 155 | 0 | my $height = 0; | |||||||||
| 156 | 0 | for my $tik ($self->ticks) { | |||||||||
| 157 | 0 | my $n = $tik->height; | |||||||||
| 158 | 0 | ▶ | if ($n > $height) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 159 | 0 | $height = $n; | |||||||||
| 160 | } | ||||||||||
| 161 | } | ||||||||||
| 162 | 0 | ▶ | if ($height == 0) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 163 | # Keine Ticks. Wir nehmen stattdessen den Wert min. | ||||||||||
| 164 | 0 | $height = Quiq::AxisTick->new($self,$self->get('min'))->height; | |||||||||
| 165 | } | ||||||||||
| 166 | |||||||||||
| 167 | 0 | return $height; | |||||||||
| 168 | } | ||||||||||
| 169 | |||||||||||
| 170 | # ----------------------------------------------------------------------------- | ||||||||||
| 171 | |||||||||||
| 172 | =head1 VERSION | ||||||||||
| 173 | |||||||||||
| 174 | 1.240 | ||||||||||
| 175 | |||||||||||
| 176 | =head1 AUTHOR | ||||||||||
| 177 | |||||||||||
| 178 | Frank Seitz, L<http://fseitz.de/> | ||||||||||
| 179 | |||||||||||
| 180 | =head1 COPYRIGHT | ||||||||||
| 181 | |||||||||||
| 182 | Copyright (C) 2026 Frank Seitz | ||||||||||
| 183 | |||||||||||
| 184 | =head1 LICENSE | ||||||||||
| 185 | |||||||||||
| 186 | This code is free software; you can redistribute it and/or modify | ||||||||||
| 187 | it under the same terms as Perl itself. | ||||||||||
| 188 | |||||||||||
| 189 | =cut | ||||||||||
| 190 | |||||||||||
| 191 | # ----------------------------------------------------------------------------- | ||||||||||
| 192 | |||||||||||
| 193 | 3 | 1; | |||||||||
| 194 | |||||||||||
| 195 | # eof | ||||||||||