| 1 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||
| 3 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||
| 7 | Quiq::PlotlyJs::XY::DiagramGroup - Gruppe von XY-Diagrammen | ||||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | =head1 BASE CLASS | ||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||
| 11 | L<Quiq::Hash> | ||||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||||
| 13 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||
| 15 | Diese Klasse ist ein Perl-Wrapper für die Erzeugung einer Gruppe | ||||||||||||||||||||||||||||||||||||||||||||
| 16 | von XY-Diagrammen auf Basis von Plotly.js, Beispiel siehe | ||||||||||||||||||||||||||||||||||||||||||||
| 17 | L<Plotly.js: Plotten und analysieren einer Gruppe von Zeitreihen|http://fseitz.de/blog/index.php?/archives/157-Plotly.js-Plotten-und-analysieren-einer-Gruppe-von-Zeitreihen.html>. | ||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | Die Diagrammgruppe zeichnet sich dadurch aus, dass durch alle | ||||||||||||||||||||||||||||||||||||||||||||
| 20 | Plots der Gruppe synchron gescrollt werden kann. In dem Diagramm, | ||||||||||||||||||||||||||||||||||||||||||||
| 21 | dessen Rangeslider aktiviert ist, kann mit der linken Maustaste im | ||||||||||||||||||||||||||||||||||||||||||||
| 22 | Plot ein Zeitbereich ausgewählt und anschließend mit dem | ||||||||||||||||||||||||||||||||||||||||||||
| 23 | Rangeslider durch den Gesamtbereich gescrollt werden. Das Zoomen | ||||||||||||||||||||||||||||||||||||||||||||
| 24 | und Scrollen findet dabei über allen Diagrammen synchron | ||||||||||||||||||||||||||||||||||||||||||||
| 25 | statt. Bei Doppelklick in den Plot-Breich wird der ursprüngliche | ||||||||||||||||||||||||||||||||||||||||||||
| 26 | Zustand wieder hergestellt. Beim Überfahren der Plots mit der Maus | ||||||||||||||||||||||||||||||||||||||||||||
| 27 | wird das Koordinatenpaar des nächstgelegenen Punktes | ||||||||||||||||||||||||||||||||||||||||||||
| 28 | angezeigt. Über das Menü "Shape" kann die Kurvenform eingestellt | ||||||||||||||||||||||||||||||||||||||||||||
| 29 | und mittels des Buttons "Download as PNG" der aktuelle | ||||||||||||||||||||||||||||||||||||||||||||
| 30 | Diagramm-Zustand als Grafik heruntergeladen werden. | ||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | Es gibt zwei Möglichkeiten, die Plot-Daten in die Diagramme zu | ||||||||||||||||||||||||||||||||||||||||||||
| 33 | übertragen: | ||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||
| 35 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||
| 37 | =item 1. | ||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||
| 39 | Die Arrays B<x>, B<y> (und ggf. B<z>) werden dem Parameter-Objekt | ||||||||||||||||||||||||||||||||||||||||||||
| 40 | direkt mitgegeben. | ||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||
| 42 | =item 2. | ||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | Die Arrays B<x>, B<y> (und ggf. B<z>) werden per Ajax-Aufruf | ||||||||||||||||||||||||||||||||||||||||||||
| 45 | besorgt, wenn beim Parameter-Objekt ein URL definiert ist. | ||||||||||||||||||||||||||||||||||||||||||||
| 46 | In diesem Fall sind die Daten sind nicht Teil der Seite, | ||||||||||||||||||||||||||||||||||||||||||||
| 47 | sondern werden per asynchronem Ajax-Request (ggf. via | ||||||||||||||||||||||||||||||||||||||||||||
| 48 | L<Cross-Origin Resource Sharing|http://fseitz.de/blog/index.php?/archives/159-Ajax-Cross-Origin-Resource-Sharing-CORS-implementieren.html>) geladen. | ||||||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||||
| 50 | =back | ||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||
| 52 | Das Laden per Ajax-Request hat den Vorteil, dass das Holen der | ||||||||||||||||||||||||||||||||||||||||||||
| 53 | Daten parallel geschieht während die Diagramme auf der Seite | ||||||||||||||||||||||||||||||||||||||||||||
| 54 | schon (leer) angezeigt werden, d.h. der Seitenaufbau ist schneller | ||||||||||||||||||||||||||||||||||||||||||||
| 55 | und die Daten werden performanter besorgt. | ||||||||||||||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | =head2 Parameter-Objekte | ||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||
| 59 | Bei der Instantiierung des DiagramGroup-Objekts wird dem Konstruktor | ||||||||||||||||||||||||||||||||||||||||||||
| 60 | eine Liste von Parameter-Objekten übergeben. Jeder Parameter wird | ||||||||||||||||||||||||||||||||||||||||||||
| 61 | in ein Diagramm geplottet. Folgende Information wird für die | ||||||||||||||||||||||||||||||||||||||||||||
| 62 | Darstellung des Diagramms ohne Daten benötigt: | ||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||
| 64 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||
| 66 | =item * | ||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||
| 68 | Name (des Parameters) | ||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||
| 70 | =item * | ||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||
| 72 | Einheit | ||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||
| 74 | =item * | ||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | Farbe | ||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||
| 78 | =item * | ||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||
| 80 | Kleinster Wert der X-Achse | ||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | =item * | ||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||
| 84 | Größter Wert der X-Achse | ||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||
| 86 | =item * | ||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||
| 88 | Kleinster Wert der Y-Achse | ||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||
| 90 | =item * | ||||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||||
| 92 | Größter Wert der Y-Achse | ||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||
| 94 | =back | ||||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||||
| 96 | Die Daten selbst werden entweder als Arrays B<x>, B<y> (und ggf. B<z>) | ||||||||||||||||||||||||||||||||||||||||||||
| 97 | übergeben oder, was vorzuziehen ist, per asynchronem Ajax-Aufruf | ||||||||||||||||||||||||||||||||||||||||||||
| 98 | geladen, via B<url>. | ||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||
| 100 | Beispiel für eine Vorab-Selektion der grundlegenden Diagramm-Daten: | ||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||
| 102 | my $parT = $db->select(qq~ | ||||||||||||||||||||||||||||||||||||||||||||
| 103 | SELECT | ||||||||||||||||||||||||||||||||||||||||||||
| 104 | par_id | ||||||||||||||||||||||||||||||||||||||||||||
| 105 | , par_name | ||||||||||||||||||||||||||||||||||||||||||||
| 106 | , par_unit | ||||||||||||||||||||||||||||||||||||||||||||
| 107 | , par_ymin | ||||||||||||||||||||||||||||||||||||||||||||
| 108 | , par_ymax | ||||||||||||||||||||||||||||||||||||||||||||
| 109 | , par_color | ||||||||||||||||||||||||||||||||||||||||||||
| 110 | , MIN(val_time) AS par_time_min | ||||||||||||||||||||||||||||||||||||||||||||
| 111 | , MAX(val_time) AS par_time_max | ||||||||||||||||||||||||||||||||||||||||||||
| 112 | , COALESCE(MIN(val_value), par_ymin, 0) AS par_value_min | ||||||||||||||||||||||||||||||||||||||||||||
| 113 | , COALESCE(MAX(val_value), par_ymax, 1) AS par_value_max | ||||||||||||||||||||||||||||||||||||||||||||
| 114 | FROM | ||||||||||||||||||||||||||||||||||||||||||||
| 115 | parameter AS par | ||||||||||||||||||||||||||||||||||||||||||||
| 116 | LEFT JOIN value AS val | ||||||||||||||||||||||||||||||||||||||||||||
| 117 | ON par_id = val_parameter_id | ||||||||||||||||||||||||||||||||||||||||||||
| 118 | AND val_time >= '__BEGIN__' | ||||||||||||||||||||||||||||||||||||||||||||
| 119 | AND val_time < '__END__' | ||||||||||||||||||||||||||||||||||||||||||||
| 120 | WHERE | ||||||||||||||||||||||||||||||||||||||||||||
| 121 | par_station_id = __STA_ID__ | ||||||||||||||||||||||||||||||||||||||||||||
| 122 | AND par_name IN (__PARAMETERS__) | ||||||||||||||||||||||||||||||||||||||||||||
| 123 | GROUP BY | ||||||||||||||||||||||||||||||||||||||||||||
| 124 | par_id | ||||||||||||||||||||||||||||||||||||||||||||
| 125 | , par_name | ||||||||||||||||||||||||||||||||||||||||||||
| 126 | , par_unit | ||||||||||||||||||||||||||||||||||||||||||||
| 127 | , par_ymin | ||||||||||||||||||||||||||||||||||||||||||||
| 128 | , par_ymax | ||||||||||||||||||||||||||||||||||||||||||||
| 129 | , par_color | ||||||||||||||||||||||||||||||||||||||||||||
| 130 | ~, | ||||||||||||||||||||||||||||||||||||||||||||
| 131 | -placeholders => | ||||||||||||||||||||||||||||||||||||||||||||
| 132 | __STA_ID__ => $sta->sta_id, | ||||||||||||||||||||||||||||||||||||||||||||
| 133 | __PARAMETERS__ => !@parameters? "''": | ||||||||||||||||||||||||||||||||||||||||||||
| 134 | join(', ',map {"'$_'"} @parameters), | ||||||||||||||||||||||||||||||||||||||||||||
| 135 | __BEGIN__ => $begin, | ||||||||||||||||||||||||||||||||||||||||||||
| 136 | __END__ => $end, | ||||||||||||||||||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 138 | $parT->normalizeNumber('par_ymin','par_ymax','par_value_min', | ||||||||||||||||||||||||||||||||||||||||||||
| 139 | 'par_value_max'); | ||||||||||||||||||||||||||||||||||||||||||||
| 140 | my %parI = $parT->index('par_name'); | ||||||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | Vorgegeben ist die Menge der Parameter B<@parameters> und der | ||||||||||||||||||||||||||||||||||||||||||||
| 143 | Zeitbereich B<$begin> und B<$end>. | ||||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||||
| 145 | Die Instantiierung eines Parameters: | ||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||
| 147 | push @par,Quiq::PlotlyJs::XY::Diagram->new( | ||||||||||||||||||||||||||||||||||||||||||||
| 148 | title => $par_name, | ||||||||||||||||||||||||||||||||||||||||||||
| 149 | yTitle => Encode::decode('utf-8',$par->par_unit), | ||||||||||||||||||||||||||||||||||||||||||||
| 150 | color => '#'.$par->par_color, | ||||||||||||||||||||||||||||||||||||||||||||
| 151 | # x => scalar($valT->values('val_time')), | ||||||||||||||||||||||||||||||||||||||||||||
| 152 | xMin => $begin, # $par->par_time_min, | ||||||||||||||||||||||||||||||||||||||||||||
| 153 | xMax => $end, # $par->par_time_max, | ||||||||||||||||||||||||||||||||||||||||||||
| 154 | # y => scalar($valT->values('val_value')), | ||||||||||||||||||||||||||||||||||||||||||||
| 155 | yMin => $par_value_min, | ||||||||||||||||||||||||||||||||||||||||||||
| 156 | yMax => $par_value_max, | ||||||||||||||||||||||||||||||||||||||||||||
| 157 | url => 'http://s31tz.de/timeseries?'.Quiq::Url->queryEncode( | ||||||||||||||||||||||||||||||||||||||||||||
| 158 | name => $par->par_name, | ||||||||||||||||||||||||||||||||||||||||||||
| 159 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 160 | # z => scalar($valT->values('qua_color')), | ||||||||||||||||||||||||||||||||||||||||||||
| 161 | zName => 'Quality', | ||||||||||||||||||||||||||||||||||||||||||||
| 162 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||||
| 164 | Die Daten werden per Ajax geladen. Format der text/plain-Antwort: | ||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||
| 166 | 2009-02-19 00:00:00<TAB>1025.2<TAB>#0000ff | ||||||||||||||||||||||||||||||||||||||||||||
| 167 | ... | ||||||||||||||||||||||||||||||||||||||||||||
| 168 | |||||||||||||||||||||||||||||||||||||||||||||
| 169 | =head2 Aufbau HTML | ||||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||||
| 171 | Der HTML-Code der Diagrammgruppe hat folgenden Aufbau. Hierbei ist | ||||||||||||||||||||||||||||||||||||||||||||
| 172 | B<NAME> der Name der Diagrammgruppe, die beim Konstruktor | ||||||||||||||||||||||||||||||||||||||||||||
| 173 | angegeben wird, und B<N> die laufende Nummer des Diagramms, beginnend | ||||||||||||||||||||||||||||||||||||||||||||
| 174 | mit 1. | ||||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||||
| 176 | <div id="NAME" class="diagramGroup"> | ||||||||||||||||||||||||||||||||||||||||||||
| 177 | <table ...> | ||||||||||||||||||||||||||||||||||||||||||||
| 178 | <tr> | ||||||||||||||||||||||||||||||||||||||||||||
| 179 | <td id="NAME-dN" class="diagram" ...></td> | ||||||||||||||||||||||||||||||||||||||||||||
| 180 | </tr> | ||||||||||||||||||||||||||||||||||||||||||||
| 181 | <tr> | ||||||||||||||||||||||||||||||||||||||||||||
| 182 | <td> | ||||||||||||||||||||||||||||||||||||||||||||
| 183 | ... | ||||||||||||||||||||||||||||||||||||||||||||
| 184 | Rangeslider: <input type="checkbox" id="NAME-rN" class="rangeslider" ... /> | ||||||||||||||||||||||||||||||||||||||||||||
| 185 | Shape: <select id="NAME-sN" ...>... | ||||||||||||||||||||||||||||||||||||||||||||
| 186 | </td> | ||||||||||||||||||||||||||||||||||||||||||||
| 187 | </tr> | ||||||||||||||||||||||||||||||||||||||||||||
| 188 | </table> | ||||||||||||||||||||||||||||||||||||||||||||
| 189 | ... | ||||||||||||||||||||||||||||||||||||||||||||
| 190 | </div> | ||||||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||||
| 192 | Über die Id kann das jeweilige DOM-Objekt von CSS/JavaScript aus | ||||||||||||||||||||||||||||||||||||||||||||
| 193 | eindeutig adressiert werden, über die Klasse die Menge der | ||||||||||||||||||||||||||||||||||||||||||||
| 194 | gleichartigen DOM-Objekte. | ||||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||||
| 196 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | =item id="NAME" | ||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||
| 200 | Id der Diagrammgruppe. | ||||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||||
| 202 | =item class="diagramGroup" | ||||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||||
| 204 | Klasse aller Diagrammgruppen. | ||||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||||
| 206 | =item id="NAME-dN" | ||||||||||||||||||||||||||||||||||||||||||||
| 207 | |||||||||||||||||||||||||||||||||||||||||||||
| 208 | Id des Nten Diagramms der Diagrammgruppe. | ||||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||||
| 210 | =item class="diagram" | ||||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||||
| 212 | Klasse aller Diagramme. | ||||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||||
| 214 | =item id="NAME-rN" | ||||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||||
| 216 | Id der Nten Rangeslider-Checkbox. | ||||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||||
| 218 | =item class="rangeslider" | ||||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||||
| 220 | Klasse aller Rangeslider. | ||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||
| 222 | =back | ||||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||||
| 224 | =cut | ||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||
| 226 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||
| 228 | package Quiq::PlotlyJs::XY::DiagramGroup; | ||||||||||||||||||||||||||||||||||||||||||||
| 229 | 1 | ▶ | use base qw/Quiq::Hash/; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | ▶ | use v5.10; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||||
| 236 | 1 | our $VERSION = '1.240'; | |||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||||
| 238 | 1 | ▶ | use Quiq::Math; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 239 | 1 | ▶ | use Quiq::Json::Code; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 240 | 1 | ▶ | use Quiq::JavaScript; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 241 | 1 | ▶ | use Quiq::Html::Table::Simple; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1 | ▶ | use Quiq::JQuery::Function; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 243 | 1 | ▶ | use Quiq::Html::Widget::CheckBox; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 244 | 1 | ▶ | use Quiq::Html::Widget::SelectMenu; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 245 | 1 | ▶ | use Quiq::Html::Widget::Button; | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||||
| 247 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||||
| 249 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||||||||||||||||||
| 251 | =head2 Konstruktor | ||||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||||
| 253 | =head3 new() - Instantiiere Objekt | ||||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||||
| 255 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||||
| 257 | $dgr = $class->new(@attVal); | ||||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||||
| 259 | =head4 Attributes | ||||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||||
| 261 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||||
| 263 | =item debug => $bool (Default: 0) | ||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||
| 265 | Zeige über dem Diagramm die Formatierungsgrößen an, die bei | ||||||||||||||||||||||||||||||||||||||||||||
| 266 | unterschiedlicher Höhe oder Fontgröße angepasst werden müssen. | ||||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||||
| 268 | =item diagrams => \@diagrams | ||||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||||
| 270 | Liste der Diagramm-Objekte. Die Diagramm-Objekte sind vom Typ | ||||||||||||||||||||||||||||||||||||||||||||
| 271 | B<< Quiq::PlotlyJs::XY::Diagram >> und definieren die Metadaten | ||||||||||||||||||||||||||||||||||||||||||||
| 272 | für die einzelnen Diagramme der Diagramm-Gruppe. | ||||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||||
| 274 | =item downloadPng => $bool (Default: 1) | ||||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||||
| 276 | Biete einen Button zum Herunterladen der Diagramm-Grafik an. | ||||||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||||
| 278 | =item fillArea => $bool (Default: 1) | ||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||
| 280 | Biete eine Checkbox zum An- und Abschalten der Fill Area | ||||||||||||||||||||||||||||||||||||||||||||
| 281 | unter der Kurve an. | ||||||||||||||||||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||||||||||||||||||
| 283 | =item fontSize => $n | ||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||
| 285 | Fontgröße der Achsenbeschriftungen. Aus dieser Größe wird die Größe | ||||||||||||||||||||||||||||||||||||||||||||
| 286 | der sonstigen Fonts (Titel, Y-Titel) abgeleitet. | ||||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||||
| 288 | =item height => $n (Default: 300) | ||||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||||
| 290 | Höhe eines Diagramms in Pixeln. | ||||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||||
| 292 | =item name => $name (Default: 'dgr') | ||||||||||||||||||||||||||||||||||||||||||||
| 293 | |||||||||||||||||||||||||||||||||||||||||||||
| 294 | Name der Diagramm-Gruppe. Der Name wird als CSS-Id für den | ||||||||||||||||||||||||||||||||||||||||||||
| 295 | äußeren div-Container der Diagramm-Gruppe und als Namespace | ||||||||||||||||||||||||||||||||||||||||||||
| 296 | für die Funktionen genutzt. | ||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||
| 298 | =item scaleY => $bool (Default: 1) | ||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||
| 300 | Biete einen Button zur Y-Skalierung der Kurvendaten an. | ||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||
| 302 | =item shape => $shape (Default: scatter: 'Spline', scattergl: 'Linear') | ||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||
| 304 | Anfangsauswahl des Shape-Menüs auf allen Diagrammen. Der Default | ||||||||||||||||||||||||||||||||||||||||||||
| 305 | hängt von Attribut type ab. Mögliche Werte: 'Spline', 'Linear', 'Marker'. | ||||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||||
| 307 | =item strict => $bool (Default: 1) | ||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||
| 309 | Melde Fehler mittels alert(), nicht nur via console.log(). | ||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||
| 311 | =item type => 'scatter'|'scattergl' (Default: 'scatter') | ||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||
| 313 | Art des Diagramms. Bei 'scattergl' ist der Umgang mit größeren Datenmengen | ||||||||||||||||||||||||||||||||||||||||||||
| 314 | performanter, insbesondere bei der Anzeige von Markert. Allerdings wird | ||||||||||||||||||||||||||||||||||||||||||||
| 315 | die Kurvenform 'spline' nicht unterstützt und im Rangeslider | ||||||||||||||||||||||||||||||||||||||||||||
| 316 | wird keine verkleinerte Form des Graphs angezeigt. | ||||||||||||||||||||||||||||||||||||||||||||
| 317 | |||||||||||||||||||||||||||||||||||||||||||||
| 318 | =item xAxisType => 'date'|'linear' (Default: 'date') | ||||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||||
| 320 | Art der X-Achse: date=Zeit, linear=numerisch | ||||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||||
| 322 | =item xTitle => $str | ||||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||||
| 324 | Text unterhalb der X-Achse. | ||||||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||||
| 326 | =back | ||||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||||
| 328 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||||||||||||||||||
| 330 | Objekt | ||||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||||
| 332 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||||
| 334 | Instantiiere ein Objekt der Klasse und liefere eine Referenz auf | ||||||||||||||||||||||||||||||||||||||||||||
| 335 | dieses Objekt zurück. | ||||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||||
| 337 | =cut | ||||||||||||||||||||||||||||||||||||||||||||
| 338 | |||||||||||||||||||||||||||||||||||||||||||||
| 339 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||
| 343 | # @_: @attVal | ||||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | my $self = $class->SUPER::new( | |||||||||||||||||||||||||||||||||||||||||||
| 346 | debug => 0, | ||||||||||||||||||||||||||||||||||||||||||||
| 347 | diagrams => [], | ||||||||||||||||||||||||||||||||||||||||||||
| 348 | downloadPng => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 349 | fillArea => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 350 | fontSize => 11, | ||||||||||||||||||||||||||||||||||||||||||||
| 351 | height => 300, | ||||||||||||||||||||||||||||||||||||||||||||
| 352 | name => 'dgr', | ||||||||||||||||||||||||||||||||||||||||||||
| 353 | scaleY => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 354 | shape => undef, | ||||||||||||||||||||||||||||||||||||||||||||
| 355 | strict => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 356 | type => 'scatter', | ||||||||||||||||||||||||||||||||||||||||||||
| 357 | width => undef, | ||||||||||||||||||||||||||||||||||||||||||||
| 358 | xAxisType => 'date', | ||||||||||||||||||||||||||||||||||||||||||||
| 359 | xAxisHoverFormat => '%Y-%m-%d %H:%M:%S', # Format der | ||||||||||||||||||||||||||||||||||||||||||||
| 360 | # Spike-Beschriftung für die X-Koordinate. Siehe: | ||||||||||||||||||||||||||||||||||||||||||||
| 361 | # https://github.com/d3/d3-3.x-api-reference/blob/master/\ | ||||||||||||||||||||||||||||||||||||||||||||
| 362 | # Time-Formatting.md#format | ||||||||||||||||||||||||||||||||||||||||||||
| 363 | xTitle => undef, | ||||||||||||||||||||||||||||||||||||||||||||
| 364 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | $self->set(@_); | |||||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||
| 370 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||
| 372 | =head2 Objektmethoden | ||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||
| 374 | =head3 html() - Generiere HTML | ||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||
| 376 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||
| 378 | $html = $dgr->html($h); | ||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||
| 380 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||
| 382 | HTML-Code (String) | ||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||
| 384 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||
| 386 | Liefere den HTML-Code der Diagramm-Gruppe. | ||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||
| 388 | B<Leere Diagrammgruppe> | ||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||
| 390 | Wenn die Liste der Parameter leer ist, liefert die Methode html() | ||||||||||||||||||||||||||||||||||||||||||||
| 391 | einen Leerstring. | ||||||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||||
| 393 | B<Leeres Diagramm> | ||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||
| 395 | Besitzt ein Parameter keine Daten (die Arrays x und y sind leer), | ||||||||||||||||||||||||||||||||||||||||||||
| 396 | wird der Plot-Bereich des betreffenden Diagramms leer dargestellt. | ||||||||||||||||||||||||||||||||||||||||||||
| 397 | Die Achsen werden gemäß xMin, xMax, yMin, yMax skaliert. Fehlen | ||||||||||||||||||||||||||||||||||||||||||||
| 398 | auch diese Angaben, nimmt Plotly.js eine Default-Achsen-Skalierung | ||||||||||||||||||||||||||||||||||||||||||||
| 399 | vor (Zeitbereich: C<2000-01-01 00:00:00> bis C<2001-01-01 00:00:00>, | ||||||||||||||||||||||||||||||||||||||||||||
| 400 | Y-Wertebereich: C<-1> bis C<4>). | ||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||
| 402 | =cut | ||||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||||
| 404 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 405 | |||||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | ▶ | sub html { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
html: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 407 | 0 | my ($self,$h) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 408 | |||||||||||||||||||||||||||||||||||||||||||||
| 409 | # Objektattribute | ||||||||||||||||||||||||||||||||||||||||||||
| 410 | |||||||||||||||||||||||||||||||||||||||||||||
| 411 | 0 | my ($debug,$diagramA,$fontSize,$height,$name,$shape,$strict,$type, | |||||||||||||||||||||||||||||||||||||||||||
| 412 | $width,$xAxisType,$xAxisHoverFormat,$xTitle) = | ||||||||||||||||||||||||||||||||||||||||||||
| 413 | $self->get(qw/debug diagrams fontSize height name shape strict type | ||||||||||||||||||||||||||||||||||||||||||||
| 414 | width xAxisType xAxisHoverFormat xTitle/); | ||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||
| 416 | # Default des Attributs shape hängt von type ab | ||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | ▶ | if (!defined $shape) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | $shape = $type eq 'scatter'? 'Spline': 'Linear'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $self->shape($shape); | |||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||||
| 423 | # Kein Code, wenn keine Diagram | ||||||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | ▶ | if (!@$diagramA) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 426 | 0 | return ''; | |||||||||||||||||||||||||||||||||||||||||||
| 427 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||||
| 429 | # Multi-Attribute (betreffen mehrere Plotly-Attribute) | ||||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||||
| 431 | 0 | my $color = '#ff0000'; | |||||||||||||||||||||||||||||||||||||||||||
| 432 | # --- | ||||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my $axisBox = 1; # Zeichne eine Box um den Plotbereich. Die Box hat | |||||||||||||||||||||||||||||||||||||||||||
| 434 | # die Farbe der Achsen (siehe axisColor). | ||||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||||
| 436 | my ($titleFontSize,$xyTitleFontSize,$titleYOffset,$topMargin, | ||||||||||||||||||||||||||||||||||||||||||||
| 437 | 0 | $bottomMargin,$leftRightMargin) = @{{ | |||||||||||||||||||||||||||||||||||||||||||
| 438 | # pt ti xy ty t b lr | ||||||||||||||||||||||||||||||||||||||||||||
| 439 | 10 => [14,12,16,43,104,undef,], | ||||||||||||||||||||||||||||||||||||||||||||
| 440 | 11 => [16,13,18,48,106,undef,], | ||||||||||||||||||||||||||||||||||||||||||||
| 441 | 12 => [18,14,18,50,110,undef,], | ||||||||||||||||||||||||||||||||||||||||||||
| 442 | 14 => [20,16,20,55,118,undef,], | ||||||||||||||||||||||||||||||||||||||||||||
| 443 | 16 => [22,18,20,57,124, 100,], | ||||||||||||||||||||||||||||||||||||||||||||
| 444 | 18 => [24,20,22,61,134, 110,], | ||||||||||||||||||||||||||||||||||||||||||||
| 445 | 20 => [26,20,22,63,138, 120,], | ||||||||||||||||||||||||||||||||||||||||||||
| 446 | 22 => [28,22,22,65,142, 130,], | ||||||||||||||||||||||||||||||||||||||||||||
| 447 | 24 => [30,24,24,70,150, 140,], | ||||||||||||||||||||||||||||||||||||||||||||
| 448 | 28 => [35,28,24,75,168, 150,], | ||||||||||||||||||||||||||||||||||||||||||||
| 449 | 32 => [40,32,24,80,182, 165,], | ||||||||||||||||||||||||||||||||||||||||||||
| 450 | 36 => [45,36,24,85,196, 180,], | ||||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | }->{$fontSize}}; | |||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | ▶ | if ($xAxisType eq 'date') { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | $bottomMargin += $fontSize; | |||||||||||||||||||||||||||||||||||||||||||
| 455 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | if (!$xTitle) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $bottomMargin -= int $xyTitleFontSize*1.5; | |||||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | my $rangeSliderThickness = 25; | |||||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | my $height2 = $height-($rangeSliderThickness+18); | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | my $bottomMargin2 = $bottomMargin-($rangeSliderThickness+18); | |||||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | my $titleY = Quiq::Math->roundTo( | |||||||||||||||||||||||||||||||||||||||||||
| 465 | 1-($titleYOffset/$height),4); # Faktor für Titel-Position | ||||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | my $titleY2 = Quiq::Math->roundTo( | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 1-($height*(1-$titleY)/$height2),4); | ||||||||||||||||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||||||||||||||
| 469 | 0 | my $rangeSliderThicknessAsFraction = Quiq::Math->roundTo( | |||||||||||||||||||||||||||||||||||||||||||
| 470 | $rangeSliderThickness/($height-$topMargin-$bottomMargin),4); | ||||||||||||||||||||||||||||||||||||||||||||
| 471 | |||||||||||||||||||||||||||||||||||||||||||||
| 472 | # Maße für die Ränder | ||||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||||
| 474 | 0 | my $axisColor = '#d0d0d0'; # Farbe der Achsenlinien | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | my $fillColor = '#e0e0e0'; # Farbe zwischen Kurve und X-Achse | |||||||||||||||||||||||||||||||||||||||||||
| 476 | 0 | my $gridColor = '#e8e8e8'; # Farbe des Gitters | |||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | my $lineColor = $color; | |||||||||||||||||||||||||||||||||||||||||||
| 478 | 0 | ▶ | my $lineShape = $shape eq 'Linear'? 'linear': 'spline'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 479 | # Linienform: 'spline'|'linear'|'hv'| | ||||||||||||||||||||||||||||||||||||||||||||
| 480 | # 'vh'|'hvh'|'vhv' | ||||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | my $lineWidth = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | my $margin = [$topMargin,$leftRightMargin,$bottomMargin,$leftRightMargin]; | |||||||||||||||||||||||||||||||||||||||||||
| 483 | 0 | my $markerColor = $color; | |||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | my $markerSize = 3; | |||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | my $markerSymbol = 'circle'; | |||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | my $mode = 'lines'; # Kurvendarstellung: 'lines', 'markers', | |||||||||||||||||||||||||||||||||||||||||||
| 487 | # 'text', 'none'. Die ersteren drei können auch mit '+' verbunden | ||||||||||||||||||||||||||||||||||||||||||||
| 488 | # werden. | ||||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | my $paperBackground = '#f8f8f8'; # Hintergrund Diagrammbereich | |||||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | my $plotBackground = '#ffffff'; # Hintergrund Plotbereich | |||||||||||||||||||||||||||||||||||||||||||
| 491 | 0 | my $rangeSliderBorderColor = '#e0e0e0'; | |||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||||
| 493 | 0 | my $xAxisTickFormat; | |||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | ▶ | if ($xAxisType eq 'date') { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 495 | 0 | $xAxisTickFormat = '%Y-%m-%d %H:%M'; # Format der | |||||||||||||||||||||||||||||||||||||||||||
| 496 | # Zeitachsen-Beschriftung | ||||||||||||||||||||||||||||||||||||||||||||
| 497 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 498 | |||||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | my $xTickLen = 5; | |||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my $ySide = 'left'; # Seite, auf der die Y-Achse gezeichnet wird | |||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | my $yTickLen = 4; | |||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | my $zeroLineColor = '#d0d0d0'; | |||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | my $yTitle = undef; | |||||||||||||||||||||||||||||||||||||||||||
| 505 | 0 | my $xMin = undef; | |||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my $xMax = undef; | |||||||||||||||||||||||||||||||||||||||||||
| 507 | 0 | my $yMin = -1; | |||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | my $yMax = 1; | |||||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||||
| 510 | # JavaScript-Code | ||||||||||||||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | my $j = Quiq::Json::Code->new; | |||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||||
| 514 | # * Namespace mit Datenstrukturen und Funktionen | ||||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||||
| 516 | 0 | ▶ | my $js = Quiq::JavaScript->code(q° | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition0%0/3
defined $yMin and defined $yMax
MC/DC0%0/2
defined $yMin and defined $yMax
defined $yMin
defined $yMax
Truth table0%0/3
A and B
A= defined $yMinB= defined $yMax
| |||||||||||||||||||||||||||||||||||||||||||||
| 517 | var __NAME__ = (function() { | ||||||||||||||||||||||||||||||||||||||||||||
| 518 | // Datenstrukturen | ||||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||||
| 520 | let trace = __TRACE__; | ||||||||||||||||||||||||||||||||||||||||||||
| 521 | let layout = __LAYOUT__; | ||||||||||||||||||||||||||||||||||||||||||||
| 522 | let config = __CONFIG__; | ||||||||||||||||||||||||||||||||||||||||||||
| 523 | let vars = __VARS__; | ||||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||||
| 525 | // Methoden | ||||||||||||||||||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||||||||||||||||||
| 527 | let rescaleY = function (dId,yMinOrig,yMaxOrig) { | ||||||||||||||||||||||||||||||||||||||||||||
| 528 | let d = $('#'+dId)[0]; | ||||||||||||||||||||||||||||||||||||||||||||
| 529 | if (d.layout.yaxis.range[0] != yMinOrig || | ||||||||||||||||||||||||||||||||||||||||||||
| 530 | d.layout.yaxis.range[1] != yMaxOrig) { | ||||||||||||||||||||||||||||||||||||||||||||
| 531 | // Originalen Wertebereich wieder herstellen | ||||||||||||||||||||||||||||||||||||||||||||
| 532 | Plotly.relayout(dId,{'yaxis.range': [yMinOrig,yMaxOrig]}); | ||||||||||||||||||||||||||||||||||||||||||||
| 533 | return; | ||||||||||||||||||||||||||||||||||||||||||||
| 534 | }; | ||||||||||||||||||||||||||||||||||||||||||||
| 535 | let x = d.data[0].x; | ||||||||||||||||||||||||||||||||||||||||||||
| 536 | if (x.length == 0) | ||||||||||||||||||||||||||||||||||||||||||||
| 537 | return; | ||||||||||||||||||||||||||||||||||||||||||||
| 538 | let xMin = Number(d.layout.xaxis.range[0]); | ||||||||||||||||||||||||||||||||||||||||||||
| 539 | let xMax = Number(d.layout.xaxis.range[1]); | ||||||||||||||||||||||||||||||||||||||||||||
| 540 | let y = d.data[0].y; | ||||||||||||||||||||||||||||||||||||||||||||
| 541 | let yMin, yMax; | ||||||||||||||||||||||||||||||||||||||||||||
| 542 | for (let i = 0; i < x.length; i++) { | ||||||||||||||||||||||||||||||||||||||||||||
| 543 | if (x[i] >= xMin && x[i] <= xMax) { | ||||||||||||||||||||||||||||||||||||||||||||
| 544 | if (yMin === undefined || y[i] < yMin) | ||||||||||||||||||||||||||||||||||||||||||||
| 545 | yMin = y[i]; | ||||||||||||||||||||||||||||||||||||||||||||
| 546 | if (yMax === undefined || y[i] > yMax) | ||||||||||||||||||||||||||||||||||||||||||||
| 547 | yMax = y[i]; | ||||||||||||||||||||||||||||||||||||||||||||
| 548 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 550 | // console.log(xMin+' '+xMax+' '+yMin+' '+yMax); | ||||||||||||||||||||||||||||||||||||||||||||
| 551 | Plotly.relayout(dId,{'yaxis.range': [yMin,yMax]}) | ||||||||||||||||||||||||||||||||||||||||||||
| 552 | }; | ||||||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||||
| 554 | let setRangeSlider = function (groupId,i,bool) { | ||||||||||||||||||||||||||||||||||||||||||||
| 555 | let dId = groupId+'-d'+i; | ||||||||||||||||||||||||||||||||||||||||||||
| 556 | if (bool) { | ||||||||||||||||||||||||||||||||||||||||||||
| 557 | Plotly.relayout(dId,{ | ||||||||||||||||||||||||||||||||||||||||||||
| 558 | 'xaxis.rangeslider.visible': true, | ||||||||||||||||||||||||||||||||||||||||||||
| 559 | 'xaxis.fixedrange': false, | ||||||||||||||||||||||||||||||||||||||||||||
| 560 | 'height': vars.height[0], | ||||||||||||||||||||||||||||||||||||||||||||
| 561 | 'margin.b': vars.bottomMargin[0], | ||||||||||||||||||||||||||||||||||||||||||||
| 562 | 'title.y': vars.titleY[0], | ||||||||||||||||||||||||||||||||||||||||||||
| 563 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 564 | $('#'+dId).height(vars.height[0]); | ||||||||||||||||||||||||||||||||||||||||||||
| 565 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 566 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 567 | Plotly.relayout(dId,{ | ||||||||||||||||||||||||||||||||||||||||||||
| 568 | 'xaxis.rangeslider.visible': false, | ||||||||||||||||||||||||||||||||||||||||||||
| 569 | 'xaxis.fixedrange': true, | ||||||||||||||||||||||||||||||||||||||||||||
| 570 | 'height': vars.height[1], | ||||||||||||||||||||||||||||||||||||||||||||
| 571 | 'margin.b': vars.bottomMargin[1], | ||||||||||||||||||||||||||||||||||||||||||||
| 572 | 'title.y': vars.titleY[1], | ||||||||||||||||||||||||||||||||||||||||||||
| 573 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 574 | $('#'+dId).height(vars.height[1]); | ||||||||||||||||||||||||||||||||||||||||||||
| 575 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 576 | let cbId = groupId+'-r'+i; | ||||||||||||||||||||||||||||||||||||||||||||
| 577 | $('#'+cbId).prop('checked',bool); | ||||||||||||||||||||||||||||||||||||||||||||
| 578 | let div = $('#'+dId)[0]; | ||||||||||||||||||||||||||||||||||||||||||||
| 579 | if (bool) { | ||||||||||||||||||||||||||||||||||||||||||||
| 580 | // Event-Listener auf das aktive (es sollte nur | ||||||||||||||||||||||||||||||||||||||||||||
| 581 | // eins geben) Diagramm setzen. Der Event-Handler | ||||||||||||||||||||||||||||||||||||||||||||
| 582 | // überträgt die Änderungen am xrange auf alle | ||||||||||||||||||||||||||||||||||||||||||||
| 583 | // anderen Diagramme. Probleme hierbei: 1) Der Event wird | ||||||||||||||||||||||||||||||||||||||||||||
| 584 | // nicht nur bei der Bereichsauswahl und beim | ||||||||||||||||||||||||||||||||||||||||||||
| 585 | // Scrollen ausgelöst. 2) Die Erkennung des richtigen | ||||||||||||||||||||||||||||||||||||||||||||
| 586 | // Events am Eventdata-Objekt ed ist schwierig, da | ||||||||||||||||||||||||||||||||||||||||||||
| 587 | // der xrange auf verschiedene Weisen dargestellt wird | ||||||||||||||||||||||||||||||||||||||||||||
| 588 | // (siehe console.log()). Daher nutzen wir | ||||||||||||||||||||||||||||||||||||||||||||
| 589 | // ed['height'] === undefined zur Erkennung. | ||||||||||||||||||||||||||||||||||||||||||||
| 590 | div.on('plotly_relayout',function(ed) { | ||||||||||||||||||||||||||||||||||||||||||||
| 591 | if (ed['yaxis.range']) { | ||||||||||||||||||||||||||||||||||||||||||||
| 592 | // Skalierung Y-Achse leiten wir nicht weiter | ||||||||||||||||||||||||||||||||||||||||||||
| 593 | return; | ||||||||||||||||||||||||||||||||||||||||||||
| 594 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 595 | // console.log(ed+JSON.stringify(ed,null,4)); | ||||||||||||||||||||||||||||||||||||||||||||
| 596 | $('#'+groupId+' '+'.diagram').each(function(j) { | ||||||||||||||||||||||||||||||||||||||||||||
| 597 | if (j+1 != i && ed['height'] === undefined) { | ||||||||||||||||||||||||||||||||||||||||||||
| 598 | Plotly.relayout(this,ed); | ||||||||||||||||||||||||||||||||||||||||||||
| 599 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 600 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 601 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 602 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 603 | }; | ||||||||||||||||||||||||||||||||||||||||||||
| 604 | |||||||||||||||||||||||||||||||||||||||||||||
| 605 | let toggleRangeSliders = function (groupId,e) { | ||||||||||||||||||||||||||||||||||||||||||||
| 606 | // Event-Listener von allen Diagrammen entfernen | ||||||||||||||||||||||||||||||||||||||||||||
| 607 | $('#'+groupId+' .diagram').each(function(i) { | ||||||||||||||||||||||||||||||||||||||||||||
| 608 | this.removeAllListeners('plotly_relayout'); | ||||||||||||||||||||||||||||||||||||||||||||
| 609 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 610 | $('#'+groupId+' .rangeslider').each(function(i) { | ||||||||||||||||||||||||||||||||||||||||||||
| 611 | i++; | ||||||||||||||||||||||||||||||||||||||||||||
| 612 | // Beim angeklickten Rangeslider stellen wir den | ||||||||||||||||||||||||||||||||||||||||||||
| 613 | // gewählten Zustand ein, die anderen schalten wir weg | ||||||||||||||||||||||||||||||||||||||||||||
| 614 | let state = this == e? this.checked: false; | ||||||||||||||||||||||||||||||||||||||||||||
| 615 | setRangeSlider(groupId,i,state); | ||||||||||||||||||||||||||||||||||||||||||||
| 616 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 617 | }; | ||||||||||||||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||||||||||||||
| 619 | // Füge Daten zum Diagramm hinzu. Gibt es keine Daten, | ||||||||||||||||||||||||||||||||||||||||||||
| 620 | // zeige "No data found" an und diable Rangeslider | ||||||||||||||||||||||||||||||||||||||||||||
| 621 | // und Shape | ||||||||||||||||||||||||||||||||||||||||||||
| 622 | let setTrace = function (name,i,trace,layout,shape,x,y,z) { | ||||||||||||||||||||||||||||||||||||||||||||
| 623 | trace.x = x; | ||||||||||||||||||||||||||||||||||||||||||||
| 624 | trace.y = y; | ||||||||||||||||||||||||||||||||||||||||||||
| 625 | if (shape == 'Spline') { | ||||||||||||||||||||||||||||||||||||||||||||
| 626 | trace.mode = 'lines'; | ||||||||||||||||||||||||||||||||||||||||||||
| 627 | trace.line.shape = 'spline'; | ||||||||||||||||||||||||||||||||||||||||||||
| 628 | trace.marker.color = trace.line.color; | ||||||||||||||||||||||||||||||||||||||||||||
| 629 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 630 | else if (shape == 'Linear') { | ||||||||||||||||||||||||||||||||||||||||||||
| 631 | trace.mode = 'lines'; | ||||||||||||||||||||||||||||||||||||||||||||
| 632 | trace.line.shape = 'linear'; | ||||||||||||||||||||||||||||||||||||||||||||
| 633 | trace.marker.color = trace.line.color; | ||||||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 635 | else if (shape == 'Marker') { | ||||||||||||||||||||||||||||||||||||||||||||
| 636 | trace.mode = 'markers'; | ||||||||||||||||||||||||||||||||||||||||||||
| 637 | trace.marker.color = trace.line.color; | ||||||||||||||||||||||||||||||||||||||||||||
| 638 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 639 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 640 | trace.mode = 'markers'; | ||||||||||||||||||||||||||||||||||||||||||||
| 641 | trace.marker = { | ||||||||||||||||||||||||||||||||||||||||||||
| 642 | color: z, | ||||||||||||||||||||||||||||||||||||||||||||
| 643 | size: 3, | ||||||||||||||||||||||||||||||||||||||||||||
| 644 | symbol: 'circle', | ||||||||||||||||||||||||||||||||||||||||||||
| 645 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 646 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 647 | if (z.length) { | ||||||||||||||||||||||||||||||||||||||||||||
| 648 | // console.log(z); | ||||||||||||||||||||||||||||||||||||||||||||
| 649 | vars.zArrays[i-1] = z.slice(); | ||||||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 651 | if (!x.length) { | ||||||||||||||||||||||||||||||||||||||||||||
| 652 | layout.annotations = [{ | ||||||||||||||||||||||||||||||||||||||||||||
| 653 | text: 'No data found', | ||||||||||||||||||||||||||||||||||||||||||||
| 654 | xref: 'paper', | ||||||||||||||||||||||||||||||||||||||||||||
| 655 | yref: 'paper', | ||||||||||||||||||||||||||||||||||||||||||||
| 656 | showarrow: false, | ||||||||||||||||||||||||||||||||||||||||||||
| 657 | font: { | ||||||||||||||||||||||||||||||||||||||||||||
| 658 | size: 28, | ||||||||||||||||||||||||||||||||||||||||||||
| 659 | color: '#a0a0a0', | ||||||||||||||||||||||||||||||||||||||||||||
| 660 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 661 | }]; | ||||||||||||||||||||||||||||||||||||||||||||
| 662 | setRangeSlider(name,i,false); | ||||||||||||||||||||||||||||||||||||||||||||
| 663 | $('#'+name+'-r'+i).prop('disabled',true); | ||||||||||||||||||||||||||||||||||||||||||||
| 664 | $('#'+name+'-s'+i).prop('disabled',true); | ||||||||||||||||||||||||||||||||||||||||||||
| 665 | $('#'+name+'-y'+i).prop('disabled',true); | ||||||||||||||||||||||||||||||||||||||||||||
| 666 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 667 | let dId = name+'-d'+i; | ||||||||||||||||||||||||||||||||||||||||||||
| 668 | Plotly.deleteTraces(dId,0); | ||||||||||||||||||||||||||||||||||||||||||||
| 669 | Plotly.addTraces(dId,trace); | ||||||||||||||||||||||||||||||||||||||||||||
| 670 | $('#'+name+'-c'+i).html(x.length.toString()+' data points'); | ||||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||||
| 672 | return; | ||||||||||||||||||||||||||||||||||||||||||||
| 673 | }; | ||||||||||||||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||||||||||||||
| 675 | // Lade Daten asynchron per Ajax und füge sie zum Diagramm hinzu | ||||||||||||||||||||||||||||||||||||||||||||
| 676 | let loadDataSetTrace = function (name,i,trace,layout,shape,url) { | ||||||||||||||||||||||||||||||||||||||||||||
| 677 | // Daten per Ajax besorgen | ||||||||||||||||||||||||||||||||||||||||||||
| 678 | // console.log(url); | ||||||||||||||||||||||||||||||||||||||||||||
| 679 | $.ajax({ | ||||||||||||||||||||||||||||||||||||||||||||
| 680 | type: 'GET', | ||||||||||||||||||||||||||||||||||||||||||||
| 681 | url: url, | ||||||||||||||||||||||||||||||||||||||||||||
| 682 | async: true, | ||||||||||||||||||||||||||||||||||||||||||||
| 683 | beforeSend: function () { | ||||||||||||||||||||||||||||||||||||||||||||
| 684 | $('body').css('cursor','wait'); | ||||||||||||||||||||||||||||||||||||||||||||
| 685 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 686 | complete: function () { | ||||||||||||||||||||||||||||||||||||||||||||
| 687 | $('body').css('cursor','default'); | ||||||||||||||||||||||||||||||||||||||||||||
| 688 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 689 | error: function () { | ||||||||||||||||||||||||||||||||||||||||||||
| 690 | let msg = 'ERROR: Ajax request failed: '+url; | ||||||||||||||||||||||||||||||||||||||||||||
| 691 | if (vars.strict) | ||||||||||||||||||||||||||||||||||||||||||||
| 692 | alert(msg); | ||||||||||||||||||||||||||||||||||||||||||||
| 693 | else | ||||||||||||||||||||||||||||||||||||||||||||
| 694 | console.log(msg); | ||||||||||||||||||||||||||||||||||||||||||||
| 695 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 696 | success: function (data,textStatus,jqXHR) { | ||||||||||||||||||||||||||||||||||||||||||||
| 697 | let x = []; | ||||||||||||||||||||||||||||||||||||||||||||
| 698 | let y = []; | ||||||||||||||||||||||||||||||||||||||||||||
| 699 | let z = []; | ||||||||||||||||||||||||||||||||||||||||||||
| 700 | let rows = data.split('\n'); | ||||||||||||||||||||||||||||||||||||||||||||
| 701 | // length ist mindestens 1 | ||||||||||||||||||||||||||||||||||||||||||||
| 702 | for (let i = 0; i < rows.length-1; i++) { | ||||||||||||||||||||||||||||||||||||||||||||
| 703 | let arr = rows[i].split('\t'); | ||||||||||||||||||||||||||||||||||||||||||||
| 704 | x.push(arr[0]); | ||||||||||||||||||||||||||||||||||||||||||||
| 705 | y.push(parseFloat(arr[1])); | ||||||||||||||||||||||||||||||||||||||||||||
| 706 | if (arr.length > 2) | ||||||||||||||||||||||||||||||||||||||||||||
| 707 | z.push(arr[2]); | ||||||||||||||||||||||||||||||||||||||||||||
| 708 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 709 | setTrace(name,i,trace,layout,shape,x,y,z); | ||||||||||||||||||||||||||||||||||||||||||||
| 710 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 711 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 712 | }; | ||||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||||
| 714 | let generatePlot = function (name,i,title,yTitle,yTitleColor,~ | ||||||||||||||||||||||||||||||||||||||||||||
| 715 | color,xMin,xMax,yMin,yMax,showRangeSlider,shape,url,~ | ||||||||||||||||||||||||||||||||||||||||||||
| 716 | x,y,z) { | ||||||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||||
| 718 | let t = $.extend(true,{},trace); | ||||||||||||||||||||||||||||||||||||||||||||
| 719 | t.line.color = color; | ||||||||||||||||||||||||||||||||||||||||||||
| 720 | t.marker.color = color; | ||||||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||||
| 722 | let l = $.extend(true,{},layout); | ||||||||||||||||||||||||||||||||||||||||||||
| 723 | l.title.text = title; | ||||||||||||||||||||||||||||||||||||||||||||
| 724 | l.title.font.color = color; | ||||||||||||||||||||||||||||||||||||||||||||
| 725 | l.xaxis.range = [xMin,xMax]; | ||||||||||||||||||||||||||||||||||||||||||||
| 726 | l.yaxis.title.text = yTitle; | ||||||||||||||||||||||||||||||||||||||||||||
| 727 | l.yaxis.title.font.color = yTitleColor; | ||||||||||||||||||||||||||||||||||||||||||||
| 728 | l.yaxis.range = [yMin,yMax]; | ||||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||||
| 730 | let dId = name+'-d'+i; | ||||||||||||||||||||||||||||||||||||||||||||
| 731 | Plotly.newPlot(dId,[t],l,config).then( | ||||||||||||||||||||||||||||||||||||||||||||
| 732 | function() { | ||||||||||||||||||||||||||||||||||||||||||||
| 733 | if (url) | ||||||||||||||||||||||||||||||||||||||||||||
| 734 | loadDataSetTrace(name,i,t,l,shape,url); | ||||||||||||||||||||||||||||||||||||||||||||
| 735 | else | ||||||||||||||||||||||||||||||||||||||||||||
| 736 | setTrace(name,i,t,l,shape,x,y,z); | ||||||||||||||||||||||||||||||||||||||||||||
| 737 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 738 | function() { | ||||||||||||||||||||||||||||||||||||||||||||
| 739 | alert('ERROR: plot creation failed: '+title); | ||||||||||||||||||||||||||||||||||||||||||||
| 740 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 741 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 742 | setRangeSlider(name,i,showRangeSlider); | ||||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||||
| 744 | // Bei Doppelklick Y-Skalierung auf allen Diagrammen | ||||||||||||||||||||||||||||||||||||||||||||
| 745 | // in Originalzustand zurückversetzen | ||||||||||||||||||||||||||||||||||||||||||||
| 746 | |||||||||||||||||||||||||||||||||||||||||||||
| 747 | let d = $('#'+dId)[0]; | ||||||||||||||||||||||||||||||||||||||||||||
| 748 | $(d).data('yMinOrig',yMin); | ||||||||||||||||||||||||||||||||||||||||||||
| 749 | $(d).data('yMaxOrig',yMax); | ||||||||||||||||||||||||||||||||||||||||||||
| 750 | d.on('plotly_doubleclick',function (data) { | ||||||||||||||||||||||||||||||||||||||||||||
| 751 | $('#'+name+' .diagram').each(function(i) { | ||||||||||||||||||||||||||||||||||||||||||||
| 752 | let yMin = $(this).data('yMinOrig'); | ||||||||||||||||||||||||||||||||||||||||||||
| 753 | let yMax = $(this).data('yMaxOrig'); | ||||||||||||||||||||||||||||||||||||||||||||
| 754 | Plotly.relayout(this,{'yaxis.range': [yMin,yMax]}); | ||||||||||||||||||||||||||||||||||||||||||||
| 755 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 756 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 757 | }; | ||||||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||||
| 759 | let getZArray = function (i) { | ||||||||||||||||||||||||||||||||||||||||||||
| 760 | // console.log(vars.zArrays[i-1]); | ||||||||||||||||||||||||||||||||||||||||||||
| 761 | return vars.zArrays[i-1]; | ||||||||||||||||||||||||||||||||||||||||||||
| 762 | }; | ||||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||||
| 764 | return { | ||||||||||||||||||||||||||||||||||||||||||||
| 765 | getZArray: getZArray, | ||||||||||||||||||||||||||||||||||||||||||||
| 766 | generatePlot: generatePlot, | ||||||||||||||||||||||||||||||||||||||||||||
| 767 | setRangeSlider: setRangeSlider, | ||||||||||||||||||||||||||||||||||||||||||||
| 768 | toggleRangeSliders: toggleRangeSliders, | ||||||||||||||||||||||||||||||||||||||||||||
| 769 | rescaleY: rescaleY, | ||||||||||||||||||||||||||||||||||||||||||||
| 770 | }; | ||||||||||||||||||||||||||||||||||||||||||||
| 771 | })();°, | ||||||||||||||||||||||||||||||||||||||||||||
| 772 | __NAME__ => $name, | ||||||||||||||||||||||||||||||||||||||||||||
| 773 | __TRACE__ => scalar $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 774 | type => $type, | ||||||||||||||||||||||||||||||||||||||||||||
| 775 | mode => $mode, # lines, markers, lines+markers, none, | ||||||||||||||||||||||||||||||||||||||||||||
| 776 | fill => 'tozeroy', | ||||||||||||||||||||||||||||||||||||||||||||
| 777 | fillcolor => $fillColor, | ||||||||||||||||||||||||||||||||||||||||||||
| 778 | line => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 779 | width => $lineWidth, | ||||||||||||||||||||||||||||||||||||||||||||
| 780 | color => $lineColor, | ||||||||||||||||||||||||||||||||||||||||||||
| 781 | shape => $lineShape, | ||||||||||||||||||||||||||||||||||||||||||||
| 782 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 783 | marker => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 784 | size => $markerSize, | ||||||||||||||||||||||||||||||||||||||||||||
| 785 | color => $color, # [....] Einzelfarben | ||||||||||||||||||||||||||||||||||||||||||||
| 786 | symbol => $markerSymbol, | ||||||||||||||||||||||||||||||||||||||||||||
| 787 | colorscale => undef, | ||||||||||||||||||||||||||||||||||||||||||||
| 788 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 789 | x => [], | ||||||||||||||||||||||||||||||||||||||||||||
| 790 | y => [], | ||||||||||||||||||||||||||||||||||||||||||||
| 791 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 792 | __LAYOUT__ => scalar $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 793 | plot_bgcolor => $plotBackground, | ||||||||||||||||||||||||||||||||||||||||||||
| 794 | paper_bgcolor => $paperBackground, | ||||||||||||||||||||||||||||||||||||||||||||
| 795 | # autosize => \'true', | ||||||||||||||||||||||||||||||||||||||||||||
| 796 | title => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 797 | text => undef, | ||||||||||||||||||||||||||||||||||||||||||||
| 798 | font => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 799 | color => $color, | ||||||||||||||||||||||||||||||||||||||||||||
| 800 | size => $titleFontSize, | ||||||||||||||||||||||||||||||||||||||||||||
| 801 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 802 | yref => 'container', # container, paper | ||||||||||||||||||||||||||||||||||||||||||||
| 803 | yanchor => 'top', | ||||||||||||||||||||||||||||||||||||||||||||
| 804 | y => $titleY, | ||||||||||||||||||||||||||||||||||||||||||||
| 805 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 806 | spikedistance => -1, | ||||||||||||||||||||||||||||||||||||||||||||
| 807 | height => $height, | ||||||||||||||||||||||||||||||||||||||||||||
| 808 | width => $width, | ||||||||||||||||||||||||||||||||||||||||||||
| 809 | margin => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 810 | l => $margin->[3], | ||||||||||||||||||||||||||||||||||||||||||||
| 811 | r => $margin->[1], | ||||||||||||||||||||||||||||||||||||||||||||
| 812 | t => $margin->[0], | ||||||||||||||||||||||||||||||||||||||||||||
| 813 | b => $margin->[2], | ||||||||||||||||||||||||||||||||||||||||||||
| 814 | autoexpand => \'false', | ||||||||||||||||||||||||||||||||||||||||||||
| 815 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 816 | xaxis => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 817 | type => $xAxisType, # 'date', 'linear', | ||||||||||||||||||||||||||||||||||||||||||||
| 818 | fixedrange => \'false', # Zoom erlauben | ||||||||||||||||||||||||||||||||||||||||||||
| 819 | mirror => $axisBox? \'true': undef, | ||||||||||||||||||||||||||||||||||||||||||||
| 820 | linecolor => $axisColor, | ||||||||||||||||||||||||||||||||||||||||||||
| 821 | #defined($xMin) && defined($xMax)? (range => [$xMin,$xMax]): | ||||||||||||||||||||||||||||||||||||||||||||
| 822 | # (autorange => \'true'), | ||||||||||||||||||||||||||||||||||||||||||||
| 823 | # autorange => \'true', | ||||||||||||||||||||||||||||||||||||||||||||
| 824 | gridcolor => $gridColor, | ||||||||||||||||||||||||||||||||||||||||||||
| 825 | hoverformat => $xAxisHoverFormat, | ||||||||||||||||||||||||||||||||||||||||||||
| 826 | # tickformat => $xAxisTickFormat, | ||||||||||||||||||||||||||||||||||||||||||||
| 827 | # tickangle => 30, | ||||||||||||||||||||||||||||||||||||||||||||
| 828 | ticklen => $xTickLen, | ||||||||||||||||||||||||||||||||||||||||||||
| 829 | tickcolor => $axisColor, | ||||||||||||||||||||||||||||||||||||||||||||
| 830 | tickfont => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 831 | size => $fontSize, | ||||||||||||||||||||||||||||||||||||||||||||
| 832 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 833 | #tickformatstops => [ | ||||||||||||||||||||||||||||||||||||||||||||
| 834 | #], | ||||||||||||||||||||||||||||||||||||||||||||
| 835 | showspikes => \'true', | ||||||||||||||||||||||||||||||||||||||||||||
| 836 | spikethickness => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 837 | spikesnap => 'data', | ||||||||||||||||||||||||||||||||||||||||||||
| 838 | spikecolor => '#000000', | ||||||||||||||||||||||||||||||||||||||||||||
| 839 | spikedash => 'dot', | ||||||||||||||||||||||||||||||||||||||||||||
| 840 | rangeslider => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 841 | autorange => \'true', | ||||||||||||||||||||||||||||||||||||||||||||
| 842 | bordercolor => $rangeSliderBorderColor, | ||||||||||||||||||||||||||||||||||||||||||||
| 843 | borderwidth => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 844 | thickness => $rangeSliderThicknessAsFraction, | ||||||||||||||||||||||||||||||||||||||||||||
| 845 | # visible => \'false', | ||||||||||||||||||||||||||||||||||||||||||||
| 846 | visible => \'true', | ||||||||||||||||||||||||||||||||||||||||||||
| 847 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 848 | title => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 849 | text => $xTitle, | ||||||||||||||||||||||||||||||||||||||||||||
| 850 | font => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 851 | size => $xyTitleFontSize, | ||||||||||||||||||||||||||||||||||||||||||||
| 852 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 853 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 854 | zeroline => \'true', | ||||||||||||||||||||||||||||||||||||||||||||
| 855 | zerolinecolor => $zeroLineColor, | ||||||||||||||||||||||||||||||||||||||||||||
| 856 | # visible => \'false', | ||||||||||||||||||||||||||||||||||||||||||||
| 857 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 858 | yaxis => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 859 | type => 'linear', | ||||||||||||||||||||||||||||||||||||||||||||
| 860 | fixedrange => \'true', # Zoom verbieten | ||||||||||||||||||||||||||||||||||||||||||||
| 861 | automargin => \'true', | ||||||||||||||||||||||||||||||||||||||||||||
| 862 | mirror => $axisBox? \'true': undef, | ||||||||||||||||||||||||||||||||||||||||||||
| 863 | linecolor => $axisColor, | ||||||||||||||||||||||||||||||||||||||||||||
| 864 | defined($yMin) && defined($yMax)? (range => [$yMin,$yMax]): | ||||||||||||||||||||||||||||||||||||||||||||
| 865 | (autorange => \'true'), | ||||||||||||||||||||||||||||||||||||||||||||
| 866 | # autorange => \'true', | ||||||||||||||||||||||||||||||||||||||||||||
| 867 | ticklen => $yTickLen, | ||||||||||||||||||||||||||||||||||||||||||||
| 868 | tickcolor => $axisColor, | ||||||||||||||||||||||||||||||||||||||||||||
| 869 | tickfont => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 870 | size => $fontSize, | ||||||||||||||||||||||||||||||||||||||||||||
| 871 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 872 | gridcolor => $gridColor, | ||||||||||||||||||||||||||||||||||||||||||||
| 873 | showspikes => \'true', | ||||||||||||||||||||||||||||||||||||||||||||
| 874 | side => $ySide, | ||||||||||||||||||||||||||||||||||||||||||||
| 875 | spikethickness => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 876 | spikesnap => 'data', | ||||||||||||||||||||||||||||||||||||||||||||
| 877 | spikecolor => '#000000', | ||||||||||||||||||||||||||||||||||||||||||||
| 878 | spikedash => 'dot', | ||||||||||||||||||||||||||||||||||||||||||||
| 879 | title => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 880 | text => $yTitle, | ||||||||||||||||||||||||||||||||||||||||||||
| 881 | font => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 882 | color => $color, | ||||||||||||||||||||||||||||||||||||||||||||
| 883 | size => $xyTitleFontSize, | ||||||||||||||||||||||||||||||||||||||||||||
| 884 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 885 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 886 | zeroline => \'true', | ||||||||||||||||||||||||||||||||||||||||||||
| 887 | zerolinecolor => $zeroLineColor, | ||||||||||||||||||||||||||||||||||||||||||||
| 888 | # visible => \'false', | ||||||||||||||||||||||||||||||||||||||||||||
| 889 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 890 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 891 | __CONFIG__ => scalar $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 892 | displayModeBar => \'false', | ||||||||||||||||||||||||||||||||||||||||||||
| 893 | doubleClickDelay => 1000, # 1000ms | ||||||||||||||||||||||||||||||||||||||||||||
| 894 | responsive => \'true', | ||||||||||||||||||||||||||||||||||||||||||||
| 895 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 896 | __VARS__ => scalar $j->o( | ||||||||||||||||||||||||||||||||||||||||||||
| 897 | height => [$height,$height2], | ||||||||||||||||||||||||||||||||||||||||||||
| 898 | bottomMargin => [$bottomMargin,$bottomMargin2], | ||||||||||||||||||||||||||||||||||||||||||||
| 899 | titleY => [$titleY,$titleY2], | ||||||||||||||||||||||||||||||||||||||||||||
| 900 | strict => $strict? \'true': \'false', | ||||||||||||||||||||||||||||||||||||||||||||
| 901 | zArrays => [], | ||||||||||||||||||||||||||||||||||||||||||||
| 902 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 903 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||||||||||||||
| 905 | # Gesamter HTML-Code | ||||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | my $debugInfo = ''; | |||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | ▶ | if ($debug) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | $debugInfo = Quiq::Html::Table::Simple->html($h, | |||||||||||||||||||||||||||||||||||||||||||
| 910 | border => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 911 | cellpadding => 2, | ||||||||||||||||||||||||||||||||||||||||||||
| 912 | rows => [ | ||||||||||||||||||||||||||||||||||||||||||||
| 913 | [[-tag=>'th','height'],[-tag=>'th','fontSize'], | ||||||||||||||||||||||||||||||||||||||||||||
| 914 | [-tag=>'th','rangeSliderThickness'],[-tag=>'th','height2'], | ||||||||||||||||||||||||||||||||||||||||||||
| 915 | [-tag=>'th','xyTitleFontSize'], | ||||||||||||||||||||||||||||||||||||||||||||
| 916 | [-tag=>'th','titleFontSize'], | ||||||||||||||||||||||||||||||||||||||||||||
| 917 | [-tag=>'th','topMargin'],[-tag=>'th','bottomMargin'], | ||||||||||||||||||||||||||||||||||||||||||||
| 918 | [-tag=>'th','bottomMargin2'],[-tag=>'th','titleY'], | ||||||||||||||||||||||||||||||||||||||||||||
| 919 | [-tag=>'th','titleY2'],[-tag=>'th','leftRightMargin']], | ||||||||||||||||||||||||||||||||||||||||||||
| 920 | [[$height],[$fontSize], | ||||||||||||||||||||||||||||||||||||||||||||
| 921 | [$rangeSliderThickness. | ||||||||||||||||||||||||||||||||||||||||||||
| 922 | " ($rangeSliderThicknessAsFraction)"], | ||||||||||||||||||||||||||||||||||||||||||||
| 923 | [$height2],[$xyTitleFontSize],[$titleFontSize], | ||||||||||||||||||||||||||||||||||||||||||||
| 924 | [$topMargin],[$bottomMargin],[$bottomMargin2],[$titleY], | ||||||||||||||||||||||||||||||||||||||||||||
| 925 | [$titleY2],[$leftRightMargin]], | ||||||||||||||||||||||||||||||||||||||||||||
| 926 | ], | ||||||||||||||||||||||||||||||||||||||||||||
| 927 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 928 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||||
| 930 | return $h->cat( | ||||||||||||||||||||||||||||||||||||||||||||
| 931 | $debugInfo, | ||||||||||||||||||||||||||||||||||||||||||||
| 932 | $h->tag('div', | ||||||||||||||||||||||||||||||||||||||||||||
| 933 | id => $name, | ||||||||||||||||||||||||||||||||||||||||||||
| 934 | class => 'diagramGroup', | ||||||||||||||||||||||||||||||||||||||||||||
| 935 | do { | ||||||||||||||||||||||||||||||||||||||||||||
| 936 | # HTML-Code der Diagramme | ||||||||||||||||||||||||||||||||||||||||||||
| 937 | |||||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | my $tmp = ''; | |||||||||||||||||||||||||||||||||||||||||||
| 939 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 940 | 0 | for my $par (@$diagramA) { | |||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | $tmp .= $self->htmlDiagram($h,++$i,$par, | |||||||||||||||||||||||||||||||||||||||||||
| 942 | $paperBackground,$debug); | ||||||||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 944 | 0 | $tmp; | |||||||||||||||||||||||||||||||||||||||||||
| 945 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 946 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 947 | $h->tag('script', | ||||||||||||||||||||||||||||||||||||||||||||
| 948 | '-', | ||||||||||||||||||||||||||||||||||||||||||||
| 949 | 0 | $js,do { | |||||||||||||||||||||||||||||||||||||||||||
| 950 | # Ready-Handler | ||||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | my $tmp = ''; | |||||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | my $i = 0; | |||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | for my $par (@$diagramA) { | |||||||||||||||||||||||||||||||||||||||||||
| 955 | 0 | $tmp .= $self->jsDiagram($j,++$i,$par); | |||||||||||||||||||||||||||||||||||||||||||
| 956 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||||
| 958 | # $tmp .= Quiq::JavaScript->code(q~ | ||||||||||||||||||||||||||||||||||||||||||||
| 959 | # $('#dgr-d1 rect.nsewdrag').bind('mousemove',function(e){ | ||||||||||||||||||||||||||||||||||||||||||||
| 960 | # console.log(e); | ||||||||||||||||||||||||||||||||||||||||||||
| 961 | # }); | ||||||||||||||||||||||||||||||||||||||||||||
| 962 | # | ||||||||||||||||||||||||||||||||||||||||||||
| 963 | # let e = $.Event('mousemove'); | ||||||||||||||||||||||||||||||||||||||||||||
| 964 | # | ||||||||||||||||||||||||||||||||||||||||||||
| 965 | # // coordinates | ||||||||||||||||||||||||||||||||||||||||||||
| 966 | # e.pageX = 250; | ||||||||||||||||||||||||||||||||||||||||||||
| 967 | # e.pageY = 250; | ||||||||||||||||||||||||||||||||||||||||||||
| 968 | # | ||||||||||||||||||||||||||||||||||||||||||||
| 969 | # // trigger event | ||||||||||||||||||||||||||||||||||||||||||||
| 970 | # $('#dgr-d1 rect.nsewdrag').trigger(e); | ||||||||||||||||||||||||||||||||||||||||||||
| 971 | # ~); | ||||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | Quiq::JQuery::Function->ready($tmp); | |||||||||||||||||||||||||||||||||||||||||||
| 974 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 975 | ), | ||||||||||||||||||||||||||||||||||||||||||||
| 976 | ); | ||||||||||||||||||||||||||||||||||||||||||||
| 977 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 978 | |||||||||||||||||||||||||||||||||||||||||||||
| 979 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||||
| 981 | =head2 Private Methoden | ||||||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||||
| 983 | =head3 htmlDiagram() - Generiere HTML für ein Diagramm | ||||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||||
| 985 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||||||||||||||||||
| 987 | $html = $dgr->htmlDiagram($h,$i,$par,$paperBackground,$debug); | ||||||||||||||||||||||||||||||||||||||||||||
| 988 | |||||||||||||||||||||||||||||||||||||||||||||
| 989 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||||||||||||||||||
| 991 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||
| 992 | |||||||||||||||||||||||||||||||||||||||||||||
| 993 | =item $h | ||||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||||
| 995 | Generator für HTML-Code. | ||||||||||||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||||||||||||
| 997 | =item $i | ||||||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||||
| 999 | Nummer des Diagramms. | ||||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||||
| 1001 | =back | ||||||||||||||||||||||||||||||||||||||||||||
| 1002 | |||||||||||||||||||||||||||||||||||||||||||||
| 1003 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||||
| 1004 | |||||||||||||||||||||||||||||||||||||||||||||
| 1005 | HTML-Code (String) | ||||||||||||||||||||||||||||||||||||||||||||
| 1006 | |||||||||||||||||||||||||||||||||||||||||||||
| 1007 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||||
| 1008 | |||||||||||||||||||||||||||||||||||||||||||||
| 1009 | Genererie den HTML-Code für ein Diagramm und liefere diesen zurück. | ||||||||||||||||||||||||||||||||||||||||||||
| 1010 | |||||||||||||||||||||||||||||||||||||||||||||
| 1011 | =cut | ||||||||||||||||||||||||||||||||||||||||||||
| 1012 | |||||||||||||||||||||||||||||||||||||||||||||
| 1013 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||||
| 1015 | 0 | ▶ | sub htmlDiagram { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
htmlDiagram: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 1016 | 0 | my ($self,$h,$i,$par,$paperBackground,$debug) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||||||||||||||
| 1018 | # Objektattribute | ||||||||||||||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||||||||||||||
| 1020 | 0 | my ($height,$name,$shape,$type,$width) = $self->get(qw/height name | |||||||||||||||||||||||||||||||||||||||||||
| 1021 | shape type width/); | ||||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||||
| 1023 | # HTML erzeugen | ||||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||||
| 1025 | 0 | my $parameterName = $par->title; | |||||||||||||||||||||||||||||||||||||||||||
| 1026 | 0 | ▶ | my $zName = $par->zName // ''; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$par->zName // ""
MC/DC0%0/1
$par->zName // ""
$par->zName
Truth table0%0/2
A
A= $par->zName
| |||||||||||||||||||||||||||||||||||||||||||||
| 1027 | 0 | my $color = $par->color; | |||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||||
| 1029 | return | ||||||||||||||||||||||||||||||||||||||||||||
| 1030 | 0 | ▶ | Quiq::Html::Table::Simple->html($h, | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 7 branches
Condition0%0/2
$par->get("html") // ""
MC/DC0%0/1
$par->get("html") // ""
$par->get("html")
Truth table0%0/2
A
A= $par->get("html")
| |||||||||||||||||||||||||||||||||||||||||||||
| 1031 | border => $debug? 1: undef, | ||||||||||||||||||||||||||||||||||||||||||||
| 1032 | width => $width? "${width}px": '100%', | ||||||||||||||||||||||||||||||||||||||||||||
| 1033 | style => [ | ||||||||||||||||||||||||||||||||||||||||||||
| 1034 | border => '1px dotted #b0b0b0', | ||||||||||||||||||||||||||||||||||||||||||||
| 1035 | 'margin-top' => '0.6em', | ||||||||||||||||||||||||||||||||||||||||||||
| 1036 | 'background-color' => $paperBackground, | ||||||||||||||||||||||||||||||||||||||||||||
| 1037 | position => 'relative', | ||||||||||||||||||||||||||||||||||||||||||||
| 1038 | ], | ||||||||||||||||||||||||||||||||||||||||||||
| 1039 | rows => [ | ||||||||||||||||||||||||||||||||||||||||||||
| 1040 | [[ | ||||||||||||||||||||||||||||||||||||||||||||
| 1041 | id => "$name-d$i", | ||||||||||||||||||||||||||||||||||||||||||||
| 1042 | class => 'diagram', | ||||||||||||||||||||||||||||||||||||||||||||
| 1043 | style => [ | ||||||||||||||||||||||||||||||||||||||||||||
| 1044 | height => "${height}px", | ||||||||||||||||||||||||||||||||||||||||||||
| 1045 | ], | ||||||||||||||||||||||||||||||||||||||||||||
| 1046 | ]], | ||||||||||||||||||||||||||||||||||||||||||||
| 1047 | [[ | ||||||||||||||||||||||||||||||||||||||||||||
| 1048 | $h->tag('span',style=>'margin-left: 10px','Rangeslider:'). | ||||||||||||||||||||||||||||||||||||||||||||
| 1049 | Quiq::Html::Widget::CheckBox->html($h, | ||||||||||||||||||||||||||||||||||||||||||||
| 1050 | id => "$name-r$i", | ||||||||||||||||||||||||||||||||||||||||||||
| 1051 | class => 'rangeslider', | ||||||||||||||||||||||||||||||||||||||||||||
| 1052 | option => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 1053 | value => 0, | ||||||||||||||||||||||||||||||||||||||||||||
| 1054 | # style => 'vertical-align: middle', | ||||||||||||||||||||||||||||||||||||||||||||
| 1055 | title => 'Toggle visibility of range slider', | ||||||||||||||||||||||||||||||||||||||||||||
| 1056 | onClick => "$name.toggleRangeSliders('$name',this)", | ||||||||||||||||||||||||||||||||||||||||||||
| 1057 | ). | ||||||||||||||||||||||||||||||||||||||||||||
| 1058 | ' | Shape: '.Quiq::Html::Widget::SelectMenu->html($h, | ||||||||||||||||||||||||||||||||||||||||||||
| 1059 | id => "$name-s$i", | ||||||||||||||||||||||||||||||||||||||||||||
| 1060 | value => $shape, | ||||||||||||||||||||||||||||||||||||||||||||
| 1061 | options => [ | ||||||||||||||||||||||||||||||||||||||||||||
| 1062 | $type eq 'scatter'? ('Spline'): (), | ||||||||||||||||||||||||||||||||||||||||||||
| 1063 | 'Linear', | ||||||||||||||||||||||||||||||||||||||||||||
| 1064 | 'Marker', | ||||||||||||||||||||||||||||||||||||||||||||
| 1065 | $zName? ($zName): (), | ||||||||||||||||||||||||||||||||||||||||||||
| 1066 | ], | ||||||||||||||||||||||||||||||||||||||||||||
| 1067 | onChange => Quiq::JavaScript->line(qq~ | ||||||||||||||||||||||||||||||||||||||||||||
| 1068 | let shape = \$('#$name-s$i').val(); | ||||||||||||||||||||||||||||||||||||||||||||
| 1069 | if (shape == 'Spline') { | ||||||||||||||||||||||||||||||||||||||||||||
| 1070 | Plotly.restyle('$name-d$i',{ | ||||||||||||||||||||||||||||||||||||||||||||
| 1071 | 'mode': 'lines', | ||||||||||||||||||||||||||||||||||||||||||||
| 1072 | 'line.shape': 'spline', | ||||||||||||||||||||||||||||||||||||||||||||
| 1073 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 1074 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1075 | else if (shape == 'Linear') { | ||||||||||||||||||||||||||||||||||||||||||||
| 1076 | Plotly.restyle('$name-d$i',{ | ||||||||||||||||||||||||||||||||||||||||||||
| 1077 | 'mode': 'lines', | ||||||||||||||||||||||||||||||||||||||||||||
| 1078 | 'line.shape': 'linear', | ||||||||||||||||||||||||||||||||||||||||||||
| 1079 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 1080 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1081 | else if (shape == 'Marker') { | ||||||||||||||||||||||||||||||||||||||||||||
| 1082 | Plotly.restyle('$name-d$i',{ | ||||||||||||||||||||||||||||||||||||||||||||
| 1083 | 'mode': 'markers', | ||||||||||||||||||||||||||||||||||||||||||||
| 1084 | 'marker.color': '$color', | ||||||||||||||||||||||||||||||||||||||||||||
| 1085 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 1086 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1087 | else if (shape == '$zName') { | ||||||||||||||||||||||||||||||||||||||||||||
| 1088 | let z = $name.getZArray($i); | ||||||||||||||||||||||||||||||||||||||||||||
| 1089 | // console.log(z); | ||||||||||||||||||||||||||||||||||||||||||||
| 1090 | Plotly.restyle('$name-d$i',{ | ||||||||||||||||||||||||||||||||||||||||||||
| 1091 | mode: 'markers', | ||||||||||||||||||||||||||||||||||||||||||||
| 1092 | marker: { | ||||||||||||||||||||||||||||||||||||||||||||
| 1093 | color: z, | ||||||||||||||||||||||||||||||||||||||||||||
| 1094 | size: 3, | ||||||||||||||||||||||||||||||||||||||||||||
| 1095 | symbol: 'circle', | ||||||||||||||||||||||||||||||||||||||||||||
| 1096 | }, | ||||||||||||||||||||||||||||||||||||||||||||
| 1097 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 1098 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1099 | ~), | ||||||||||||||||||||||||||||||||||||||||||||
| 1100 | title => 'Connect data points with straight lines,'. | ||||||||||||||||||||||||||||||||||||||||||||
| 1101 | ' splines or show markers', | ||||||||||||||||||||||||||||||||||||||||||||
| 1102 | ). | ||||||||||||||||||||||||||||||||||||||||||||
| 1103 | ( | ||||||||||||||||||||||||||||||||||||||||||||
| 1104 | !$self->fillArea? '': | ||||||||||||||||||||||||||||||||||||||||||||
| 1105 | ' | FillArea:'.Quiq::Html::Widget::CheckBox->html( | ||||||||||||||||||||||||||||||||||||||||||||
| 1106 | $h, | ||||||||||||||||||||||||||||||||||||||||||||
| 1107 | id => "$name-f$i", | ||||||||||||||||||||||||||||||||||||||||||||
| 1108 | option => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 1109 | value => 1, | ||||||||||||||||||||||||||||||||||||||||||||
| 1110 | style => 'vertical-align: middle', | ||||||||||||||||||||||||||||||||||||||||||||
| 1111 | title => 'Toggle colored area above or below'. | ||||||||||||||||||||||||||||||||||||||||||||
| 1112 | ' graph', | ||||||||||||||||||||||||||||||||||||||||||||
| 1113 | onClick => qq~ | ||||||||||||||||||||||||||||||||||||||||||||
| 1114 | let fill = this.checked? 'tozeroy': 'none'; | ||||||||||||||||||||||||||||||||||||||||||||
| 1115 | Plotly.restyle('$name-d$i',{ | ||||||||||||||||||||||||||||||||||||||||||||
| 1116 | 'fill': fill, | ||||||||||||||||||||||||||||||||||||||||||||
| 1117 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 1118 | ~, | ||||||||||||||||||||||||||||||||||||||||||||
| 1119 | ) | ||||||||||||||||||||||||||||||||||||||||||||
| 1120 | ).( | ||||||||||||||||||||||||||||||||||||||||||||
| 1121 | !$self->scaleY? '': | ||||||||||||||||||||||||||||||||||||||||||||
| 1122 | ' | '.Quiq::Html::Widget::Button->html($h, | ||||||||||||||||||||||||||||||||||||||||||||
| 1123 | id => "$name-y$i", | ||||||||||||||||||||||||||||||||||||||||||||
| 1124 | content => 'Scale Y Axis', | ||||||||||||||||||||||||||||||||||||||||||||
| 1125 | onClick => sprintf("%s.rescaleY('%s',%s,%s)", | ||||||||||||||||||||||||||||||||||||||||||||
| 1126 | $name,"$name-d$i",$par->yMin,$par->yMax), | ||||||||||||||||||||||||||||||||||||||||||||
| 1127 | title => 'Rescale Y axis according to visible'. | ||||||||||||||||||||||||||||||||||||||||||||
| 1128 | ' data or original state', | ||||||||||||||||||||||||||||||||||||||||||||
| 1129 | ) | ||||||||||||||||||||||||||||||||||||||||||||
| 1130 | ).( | ||||||||||||||||||||||||||||||||||||||||||||
| 1131 | !$self->downloadPng? '': | ||||||||||||||||||||||||||||||||||||||||||||
| 1132 | ' | '.Quiq::Html::Widget::Button->html($h, | ||||||||||||||||||||||||||||||||||||||||||||
| 1133 | content => 'Download as PNG', | ||||||||||||||||||||||||||||||||||||||||||||
| 1134 | onClick => qq~ | ||||||||||||||||||||||||||||||||||||||||||||
| 1135 | let plot = \$('#$name-d$i'); | ||||||||||||||||||||||||||||||||||||||||||||
| 1136 | Plotly.downloadImage(plot[0],{ | ||||||||||||||||||||||||||||||||||||||||||||
| 1137 | format: 'png', | ||||||||||||||||||||||||||||||||||||||||||||
| 1138 | width: plot.width(), | ||||||||||||||||||||||||||||||||||||||||||||
| 1139 | height: plot.height(), | ||||||||||||||||||||||||||||||||||||||||||||
| 1140 | filename: '$parameterName', | ||||||||||||||||||||||||||||||||||||||||||||
| 1141 | }); | ||||||||||||||||||||||||||||||||||||||||||||
| 1142 | ~, | ||||||||||||||||||||||||||||||||||||||||||||
| 1143 | title => 'Download plot graphic as PNG', | ||||||||||||||||||||||||||||||||||||||||||||
| 1144 | ) | ||||||||||||||||||||||||||||||||||||||||||||
| 1145 | ). | ||||||||||||||||||||||||||||||||||||||||||||
| 1146 | $h->tag('div', | ||||||||||||||||||||||||||||||||||||||||||||
| 1147 | id => "$name-c$i", | ||||||||||||||||||||||||||||||||||||||||||||
| 1148 | style => 'position: absolute; bottom: 7px; right: 10px', | ||||||||||||||||||||||||||||||||||||||||||||
| 1149 | '' | ||||||||||||||||||||||||||||||||||||||||||||
| 1150 | ). | ||||||||||||||||||||||||||||||||||||||||||||
| 1151 | ($par->get('html') // ''), # optionaler HTML-Code | ||||||||||||||||||||||||||||||||||||||||||||
| 1152 | ]] | ||||||||||||||||||||||||||||||||||||||||||||
| 1153 | ]); | ||||||||||||||||||||||||||||||||||||||||||||
| 1154 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1155 | |||||||||||||||||||||||||||||||||||||||||||||
| 1156 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||||
| 1158 | =head3 jsDiagram() - Generiere JavaScript für ein Diagramm | ||||||||||||||||||||||||||||||||||||||||||||
| 1159 | |||||||||||||||||||||||||||||||||||||||||||||
| 1160 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||||
| 1161 | |||||||||||||||||||||||||||||||||||||||||||||
| 1162 | $js = $dgr->jsDiagram($j,$i,$par); | ||||||||||||||||||||||||||||||||||||||||||||
| 1163 | |||||||||||||||||||||||||||||||||||||||||||||
| 1164 | =head4 Arguments | ||||||||||||||||||||||||||||||||||||||||||||
| 1165 | |||||||||||||||||||||||||||||||||||||||||||||
| 1166 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||
| 1167 | |||||||||||||||||||||||||||||||||||||||||||||
| 1168 | =item $j | ||||||||||||||||||||||||||||||||||||||||||||
| 1169 | |||||||||||||||||||||||||||||||||||||||||||||
| 1170 | JSON-Generator | ||||||||||||||||||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||||||||||||||||||
| 1172 | =item $i | ||||||||||||||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||||||||||||||
| 1174 | Nummer des Diagramms. | ||||||||||||||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||||||||||||||
| 1176 | =item $par | ||||||||||||||||||||||||||||||||||||||||||||
| 1177 | |||||||||||||||||||||||||||||||||||||||||||||
| 1178 | Zeitreihen-Objekt. | ||||||||||||||||||||||||||||||||||||||||||||
| 1179 | |||||||||||||||||||||||||||||||||||||||||||||
| 1180 | =back | ||||||||||||||||||||||||||||||||||||||||||||
| 1181 | |||||||||||||||||||||||||||||||||||||||||||||
| 1182 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||||||||||||||||||
| 1184 | JavaScript-Code (String) | ||||||||||||||||||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||||||||||||||||||
| 1186 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||||
| 1187 | |||||||||||||||||||||||||||||||||||||||||||||
| 1188 | Genererie den JavaScript-Code für ein Diagramm und liefere diesen zurück. | ||||||||||||||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||||||||||||||
| 1190 | =cut | ||||||||||||||||||||||||||||||||||||||||||||
| 1191 | |||||||||||||||||||||||||||||||||||||||||||||
| 1192 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||||||||||||||||||
| 1194 | 0 | ▶ | sub jsDiagram { | ||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
jsDiagram: not called CC=11 SCAR=48.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||
| 1195 | 0 | my ($self,$j,$i,$par) = @_; | |||||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||||
| 1197 | # Objektattribute | ||||||||||||||||||||||||||||||||||||||||||||
| 1198 | |||||||||||||||||||||||||||||||||||||||||||||
| 1199 | 0 | my ($name,$shape) = $self->get('name','shape'); | |||||||||||||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||||||||||||||
| 1201 | # JavaScript erzeugen | ||||||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||||
| 1203 | 0 | my $xMin = $par->xMin; | |||||||||||||||||||||||||||||||||||||||||||
| 1204 | 0 | ▶ | if (!defined($xMin) || $xMin eq '') { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $xMin or $xMin eq ""
MC/DC0%0/2
not defined $xMin or $xMin eq ""
not defined $xMin
$xMin eq ""
Truth table0%0/3
not(A) or B
A= not defined $xMinB= $xMin eq ""
| |||||||||||||||||||||||||||||||||||||||||||||
| 1205 | 0 | $xMin = 'undefined'; | |||||||||||||||||||||||||||||||||||||||||||
| 1206 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1207 | 0 | my $xMax = $par->xMax; | |||||||||||||||||||||||||||||||||||||||||||
| 1208 | 0 | ▶ | if (!defined($xMax) || $xMax eq '') { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $xMax or $xMax eq ""
MC/DC0%0/2
not defined $xMax or $xMax eq ""
not defined $xMax
$xMax eq ""
Truth table0%0/3
not(A) or B
A= not defined $xMaxB= $xMax eq ""
| |||||||||||||||||||||||||||||||||||||||||||||
| 1209 | 0 | $xMax = 'undefined'; | |||||||||||||||||||||||||||||||||||||||||||
| 1210 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1211 | 0 | ▶ | my $yMin = $par->yMin // 'undefined'; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$par->yMin // "undefined"
MC/DC0%0/1
$par->yMin // "undefined"
$par->yMin
Truth table0%0/2
A
A= $par->yMin
| |||||||||||||||||||||||||||||||||||||||||||||
| 1212 | 0 | ▶ | my $yMax = $par->yMax // 'undefined'; | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$par->yMax // "undefined"
MC/DC0%0/1
$par->yMax // "undefined"
$par->yMax
Truth table0%0/2
A
A= $par->yMax
| |||||||||||||||||||||||||||||||||||||||||||||
| 1213 | 0 | ▶ | my $showRangeSlider = $i == 1? 'true': 'false'; | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1214 | |||||||||||||||||||||||||||||||||||||||||||||
| 1215 | 0 | my $url = $par->url; | |||||||||||||||||||||||||||||||||||||||||||
| 1216 | 0 | ▶ | if ($url) { | ||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||
| 1217 | 0 | ▶ | return sprintf("$name.generatePlot('%s',%s,'%s','%s',%s,'%s','%s'". | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$par->yTitle // ""
MC/DC0%0/1
$par->yTitle // ""
$par->yTitle
Truth table0%0/2
A
A= $par->yTitle
| |||||||||||||||||||||||||||||||||||||||||||||
| 1218 | ",'%s',%s,%s,%s,'%s','%s');\n", | ||||||||||||||||||||||||||||||||||||||||||||
| 1219 | $name,$i,$par->title,$par->yTitle//'', | ||||||||||||||||||||||||||||||||||||||||||||
| 1220 | $j->encode($par->yTitleColor), | ||||||||||||||||||||||||||||||||||||||||||||
| 1221 | $par->color,$xMin,$xMax,$yMin,$yMax,$showRangeSlider,$shape,$url); | ||||||||||||||||||||||||||||||||||||||||||||
| 1222 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1223 | else { | ||||||||||||||||||||||||||||||||||||||||||||
| 1224 | # mit x,y,z | ||||||||||||||||||||||||||||||||||||||||||||
| 1225 | 0 | ▶ | return sprintf("$name.generatePlot('%s',%s,'%s','%s',%s,'%s','%s'". | ||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$par->yTitle // ""
MC/DC0%0/1
$par->yTitle // ""
$par->yTitle
Truth table0%0/2
A
A= $par->yTitle
| |||||||||||||||||||||||||||||||||||||||||||||
| 1226 | ",'%s',%s,%s,%s,'%s','',%s,%s,%s);\n", | ||||||||||||||||||||||||||||||||||||||||||||
| 1227 | $name,$i,$par->title,$par->yTitle//'', | ||||||||||||||||||||||||||||||||||||||||||||
| 1228 | $j->encode($par->yTitleColor), | ||||||||||||||||||||||||||||||||||||||||||||
| 1229 | $par->color,$xMin,$xMax,$yMin,$yMax,$showRangeSlider,$shape, | ||||||||||||||||||||||||||||||||||||||||||||
| 1230 | scalar($j->encode($par->x)),scalar($j->encode($par->y)), | ||||||||||||||||||||||||||||||||||||||||||||
| 1231 | scalar($j->encode($par->z))); | ||||||||||||||||||||||||||||||||||||||||||||
| 1232 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1233 | } | ||||||||||||||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||||||||||||||
| 1235 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 1236 | |||||||||||||||||||||||||||||||||||||||||||||
| 1237 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||||||||||||||
| 1239 | 1.240 | ||||||||||||||||||||||||||||||||||||||||||||
| 1240 | |||||||||||||||||||||||||||||||||||||||||||||
| 1241 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||
| 1242 | |||||||||||||||||||||||||||||||||||||||||||||
| 1243 | Frank Seitz, L<http://fseitz.de/> | ||||||||||||||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||||||||||||||
| 1245 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||||
| 1247 | Copyright (C) 2026 Frank Seitz | ||||||||||||||||||||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||||||||||||||||||
| 1249 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||||
| 1250 | |||||||||||||||||||||||||||||||||||||||||||||
| 1251 | This code is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||
| 1252 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||||||||||||||||
| 1254 | =cut | ||||||||||||||||||||||||||||||||||||||||||||
| 1255 | |||||||||||||||||||||||||||||||||||||||||||||
| 1256 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||||||||||||||
| 1258 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||||
| 1260 | # eof | ||||||||||||||||||||||||||||||||||||||||||||