| 1 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | Quiq::PlotlyJs::TimeSeries - Zeitreihen-Plot auf Basis von Plotly.js | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 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 für | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | Zeitreihen-Plots auf Basis von Plotly.js. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | Dokumentation und Beispiele: L<https://plotly.com/javascript/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | Zeitformate: L<https://github.com/d3/d3/blob/master/API.md#time-formats-d3-time-format> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | =head2 Leeres Diagramm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | Ein Konstuktoraufruf ohne jegliche Angaben, also auch ohne Daten, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | ergibt ein leeres Diagramm. Die X-Achse umfasst den (willkürlich | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | gewählten) Zeitbereich von C<2000-01-01 00:00:00> bis C<2001-01-01 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 00:00:00>. Die Y-Achse umfasst den (willkürlich gewählten) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | Wertebereich C<-1> bis C<4>. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | =head2 Diagramm-Höhe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | Die Diagramm-Höhe kann im div-Container, in der Layout-Konfiguration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | oder in beiden gesetzt werden. Die Auswirkungen: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | =over 2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | =item * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | Wird die Höhe nur beim div-Container gesetzt, füllt Plotly | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | die Höhe immer ganz aus. Wird z.B. der Rangeslider entfernt, rendert | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | Plotly das Diagramm neu, so dass es wieder die gesamte Höhe ausfüllt. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | D.h. der Plotbereich wird höher. Der Inhalt des Diagramms ist | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | nicht statisch. Das wollen wir nicht. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | =item * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | Wird die Höhe nur in der Layout-Konfiguration gesetzt, hat der | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | div-Container zunächst die Höhe 0, bis das Diagramm | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | (typischerweise im ready-Handler) aufgebaut wird. Das wollen wir | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | auch nicht. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | =item * | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | Wird die Höhe im div-Container I<und> in der Layout-Konfiguration | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | gesetzt, ist der Bereich des Diagramms auf der Seite sofort | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | sichtbar, der Inhalt kann aber aber statisch gehalten werden, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | indem beide Angaben gemeinsam geändert werden. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | =head2 Unterer Rand | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | Im unteren Rand ist die Beschriftung der X-Achse und der | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | Rangeslider angesiedelt. Die Beschriftung hat einen Platzbedarf von | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 55 Pixeln, die Dicke des Rangesliders ist auf 20% der Plothöhe | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | eingestellt. Wir nutzen folgende Formel, um aus der Höhe des | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | Diagramms die Höhe des unteren Rands zu berechnen: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | bottomMargin = (height - 300) / 50 * 10 + 110; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | Das ergibt folgende Werte (height->marginBottom): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | 250->100, 300->110, 350->120, 400->130, 450->140,... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | Wenn wir den Rangeslider entfernen, reduzieren wir die Höhe des | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | Diagramms und den unteren Rand um | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | marginBottom - 55 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | =head2 Titel-Positionierung | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | Der Diagramm-Titel wird per Default leider ungünstig positioniert, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | daher positionieren wir ihn selbst. Damit der Titel | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | oberhalb des Plot-Bereichs positioniert werden kann, muss | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | im Layout C<container> als Bezugsbereich vereinbart werden: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | title: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | yref: 'container', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | yanchor => 'top', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | y => $y0, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | Hierbei ist $y0 ein Wert zwischen 0 und 1, der die vertikale | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | Position innerhalb des Diagramms festlegt. 1 -> ganz oben unter dem | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | Rand, 0 -> ganz unten unter (!) dem Rand. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | Ändert sich die Höhe des Diagramms, muss der Wert y auf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | die neue Höhe y1 umgerechnet werden: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | y1 = 1 - (height0 * (1 - y0) / height1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | =head2 Raum unter der Achse einfärben | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | Ist beim Trace-Layout das Füllen unter der Achse angegeben mit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | fill: 'tozeroy', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | fillcolor: '#e0e0e0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | wird der Y-Wertebereich nach unten bis 0 ausgedehnt, wenn kein | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | Y-Wertebereich explizit vorgegeben ist. Ist für die Y-Achse | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | (Diagramm-Layout!) explizit ein Wertebereich vorgegeben | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | range => [900,1000], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | findet die Ausdehnung bis 0 nicht statt, der Raum unter der | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | Kurve wird dennoch wie gewünscht gefüllt. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | =head1 EXAMPLE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | (Folgendes Diagramm erscheint in HTML - außer auf meta::cpan, da der | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | HTML-Code dort gestrippt wird - es zeigt 720 Messwerte einer | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | Windgeschwindigkeits-Messung) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 124 | =begin html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 126 | <script type="text/javascript" src="https://code.jquery.com/jquery-latest.min.js"></script> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 127 | <script type="text/javascript" src="https://cdn.plot.ly/plotly-latest.min.js"></script> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 128 | <div id="plot" class="plotly-timeseries" style="height: 400px; border: 1px dotted #b0b0b0;"></div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 129 | <script type="text/javascript"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 130 | $(function() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 131 | var plot = Plotly.newPlot('plot',[{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 132 | type: 'scatter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 133 | mode: 'lines', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 134 | fill: 'tozeroy', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 135 | fillcolor: '#e0e0e0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 136 | line: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 137 | width: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 138 | color: '#ff0000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 139 | shape: 'linear', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 140 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 141 | marker: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 142 | size: 3, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 143 | color: '#ff0000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 144 | symbol: 'circle', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 145 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 146 | x: [1573167600000,1573168200000,1573168800000,1573169400000,1573170000000,1573170600000,1573171200000,1573171800000,1573172400000,1573173000000,1573173600000,1573174200000,1573174800000,1573175400000,1573176000000,1573176600000,1573177200000,1573177800000,1573178400000,1573179000000,1573179600000,1573180200000,1573180800000,1573181400000,1573182000000,1573182600000,1573183200000,1573183800000,1573184400000,1573185000000,1573185600000,1573186200000,1573186800000,1573187400000,1573188000000,1573188600000,1573189200000,1573189800000,1573190400000,1573191000000,1573191600000,1573192200000,1573192800000,1573193400000,1573194000000,1573194600000,1573195200000,1573195800000,1573196400000,1573197000000,1573197600000,1573198200000,1573198800000,1573199400000,1573200000000,1573200600000,1573201200000,1573201800000,1573202400000,1573203000000,1573203600000,1573204200000,1573204800000,1573205400000,1573206000000,1573206600000,1573207200000,1573207800000,1573208400000,1573209000000,1573209600000,1573210200000,1573210800000,1573211400000,1573212000000,1573212600000,1573213200000,1573213800000,1573214400000,1573215000000,1573215600000,1573216200000,1573216800000,1573217400000,1573218000000,1573218600000,1573219200000,1573219800000,1573220400000,1573221000000,1573221600000,1573222200000,1573222800000,1573223400000,1573224000000,1573224600000,1573225200000,1573225800000,1573226400000,1573227000000,1573227600000,1573228200000,1573228800000,1573229400000,1573230000000,1573230600000,1573231200000,1573231800000,1573232400000,1573233000000,1573233600000,1573234200000,1573234800000,1573235400000,1573236000000,1573236600000,1573237200000,1573237800000,1573238400000,1573239000000,1573239600000,1573240200000,1573240800000,1573241400000,1573242000000,1573242600000,1573243200000,1573243800000,1573244400000,1573245000000,1573245600000,1573246200000,1573246800000,1573247400000,1573248000000,1573248600000,1573249200000,1573249800000,1573250400000,1573251000000,1573251600000,1573252200000,1573252800000,1573253400000,1573254000000,1573254600000,1573255200000,1573255800000,1573256400000,1573257000000,1573257600000,1573258200000,1573258800000,1573259400000,1573260000000,1573260600000,1573261200000,1573261800000,1573262400000,1573263000000,1573263600000,1573264200000,1573264800000,1573265400000,1573266000000,1573266600000,1573267200000,1573267800000,1573268400000,1573269000000,1573269600000,1573270200000,1573270800000,1573271400000,1573272000000,1573272600000,1573273200000,1573273800000,1573274400000,1573275000000,1573275600000,1573276200000,1573276800000,1573277400000,1573278000000,1573278600000,1573279200000,1573279800000,1573280400000,1573281000000,1573281600000,1573282200000,1573282800000,1573283400000,1573284000000,1573284600000,1573285200000,1573285800000,1573286400000,1573287000000,1573287600000,1573288200000,1573288800000,1573289400000,1573290000000,1573290600000,1573291200000,1573291800000,1573292400000,1573293000000,1573293600000,1573294200000,1573294800000,1573295400000,1573296000000,1573296600000,1573297200000,1573297800000,1573298400000,1573299000000,1573299600000,1573300200000,1573300800000,1573301400000,1573302000000,1573302600000,1573303200000,1573303800000,1573304400000,1573305000000,1573305600000,1573306200000,1573306800000,1573307400000,1573308000000,1573308600000,1573309200000,1573309800000,1573310400000,1573311000000,1573311600000,1573312200000,1573312800000,1573313400000,1573314000000,1573314600000,1573315200000,1573315800000,1573316400000,1573317000000,1573317600000,1573318200000,1573318800000,1573319400000,1573320000000,1573320600000,1573321200000,1573321800000,1573322400000,1573323000000,1573323600000,1573324200000,1573324800000,1573325400000,1573326000000,1573326600000,1573327200000,1573327800000,1573328400000,1573329000000,1573329600000,1573330200000,1573330800000,1573331400000,1573332000000,1573332600000,1573333200000,1573333800000,1573334400000,1573335000000,1573335600000,1573336200000,1573336800000,1573337400000,1573338000000,1573338600000,1573339200000,1573339800000,1573340400000,1573341000000,1573341600000,1573342200000,1573342800000,1573343400000,1573344000000,1573344600000,1573345200000,1573345800000,1573346400000,1573347000000,1573347600000,1573348200000,1573348800000,1573349400000,1573350000000,1573350600000,1573351200000,1573351800000,1573352400000,1573353000000,1573353600000,1573354200000,1573354800000,1573355400000,1573356000000,1573356600000,1573357200000,1573357800000,1573358400000,1573359000000,1573359600000,1573360200000,1573360800000,1573361400000,1573362000000,1573362600000,1573363200000,1573363800000,1573364400000,1573365000000,1573365600000,1573366200000,1573366800000,1573367400000,1573368000000,1573368600000,1573369200000,1573369800000,1573370400000,1573371000000,1573371600000,1573372200000,1573372800000,1573373400000,1573374000000,1573374600000,1573375200000,1573375800000,1573376400000,1573377000000,1573377600000,1573378200000,1573378800000,1573379400000,1573380000000,1573380600000,1573381200000,1573381800000,1573382400000,1573383000000,1573383600000,1573384200000,1573384800000,1573385400000,1573386000000,1573386600000,1573387200000,1573387800000,1573388400000,1573389000000,1573389600000,1573390200000,1573390800000,1573391400000,1573392000000,1573392600000,1573393200000,1573393800000,1573394400000,1573395000000,1573395600000,1573396200000,1573396800000,1573397400000,1573398000000,1573398600000,1573399200000,1573399800000,1573400400000,1573401000000,1573401600000,1573402200000,1573402800000,1573404000000,1573404600000,1573405200000,1573405800000,1573406400000,1573407000000,1573407600000,1573408200000,1573408800000,1573409400000,1573410000000,1573410600000,1573411200000,1573411800000,1573412400000,1573413000000,1573413600000,1573414200000,1573414800000,1573415400000,1573416000000,1573416600000,1573417200000,1573417800000,1573418400000,1573419000000,1573419600000,1573420200000,1573420800000,1573421400000,1573422000000,1573422600000,1573423200000,1573423800000,1573424400000,1573425000000,1573425600000,1573426200000,1573426800000,1573427400000,1573428000000,1573428600000,1573429200000,1573429800000,1573430400000,1573431000000,1573431600000,1573432200000,1573432800000,1573433400000,1573434000000,1573434600000,1573435200000,1573435800000,1573436400000,1573437000000,1573437600000,1573438200000,1573438800000,1573439400000,1573440000000,1573440600000,1573441200000,1573441800000,1573442400000,1573443000000,1573443600000,1573444200000,1573444800000,1573445400000,1573446000000,1573446600000,1573447200000,1573447800000,1573448400000,1573449000000,1573449600000,1573450200000,1573450800000,1573451400000,1573452000000,1573452600000,1573453200000,1573453800000,1573454400000,1573455000000,1573455600000,1573456200000,1573456800000,1573457400000,1573458000000,1573458600000,1573459200000,1573459800000,1573460400000,1573461000000,1573461600000,1573462200000,1573462800000,1573463400000,1573464000000,1573464600000,1573465200000,1573465800000,1573466400000,1573467000000,1573467600000,1573468200000,1573468800000,1573469400000,1573470000000,1573470600000,1573471200000,1573471800000,1573472400000,1573473000000,1573473600000,1573474200000,1573474800000,1573475400000,1573476000000,1573476600000,1573477200000,1573477800000,1573478400000,1573479000000,1573479600000,1573480200000,1573480800000,1573481400000,1573482000000,1573482600000,1573483200000,1573483800000,1573484400000,1573485000000,1573485600000,1573486200000,1573486800000,1573487400000,1573488000000,1573488600000,1573489200000,1573489800000,1573490400000,1573491000000,1573491600000,1573492200000,1573492800000,1573493400000,1573494000000,1573494600000,1573495200000,1573495800000,1573496400000,1573497000000,1573497600000,1573498200000,1573498800000,1573499400000,1573500000000,1573500600000,1573501200000,1573501800000,1573502400000,1573503000000,1573503600000,1573504200000,1573504800000,1573505400000,1573506000000,1573506600000,1573507200000,1573507800000,1573508400000,1573509000000,1573509600000,1573510200000,1573510800000,1573511400000,1573512000000,1573512600000,1573513200000,1573513800000,1573514400000,1573515000000,1573515600000,1573516200000,1573516800000,1573517400000,1573518000000,1573518600000,1573519200000,1573519800000,1573520400000,1573521000000,1573521600000,1573522200000,1573522800000,1573523400000,1573524000000,1573524600000,1573525200000,1573525800000,1573526400000,1573527000000,1573527600000,1573528200000,1573528800000,1573529400000,1573530000000,1573530600000,1573531200000,1573531800000,1573532400000,1573533000000,1573533600000,1573534200000,1573534800000,1573535400000,1573536000000,1573536600000,1573537200000,1573537800000,1573538400000,1573539000000,1573539600000,1573540200000,1573540800000,1573541400000,1573542000000,1573542600000,1573543200000,1573543800000,1573544400000,1573545000000,1573545600000,1573546200000,1573546800000,1573547400000,1573548000000,1573548600000,1573549200000,1573549800000,1573550400000,1573551000000,1573551600000,1573552200000,1573552800000,1573553400000,1573554000000,1573554600000,1573555200000,1573555800000,1573556400000,1573557000000,1573557600000,1573558200000,1573558800000,1573559400000,1573560000000,1573560600000,1573561200000,1573561800000,1573562400000,1573563000000,1573563600000,1573564200000,1573564800000,1573565400000,1573566000000,1573566600000,1573567200000,1573567800000,1573568400000,1573569000000,1573569600000,1573570200000,1573570800000,1573571400000,1573572000000,1573572600000,1573573200000,1573573800000,1573574400000,1573575000000,1573575600000,1573576200000,1573576800000,1573577400000,1573578000000,1573578600000,1573579200000,1573579800000,1573580400000,1573581000000,1573581600000,1573582200000,1573582800000,1573583400000,1573584000000,1573584600000,1573585200000,1573585800000,1573586400000,1573587000000,1573587600000,1573588200000,1573588800000,1573589400000,1573590000000,1573590600000,1573591200000,1573591800000,1573592400000,1573593000000,1573593600000,1573594200000,1573594800000,1573595400000,1573596000000,1573596600000,1573597200000,1573597800000,1573598400000,1573599000000,1573599600000], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 147 | y: [11.142,11.524,10.343,10.604,11.824,11.266,10.642,10.093,9.1365,8.6981,8.5784,8.83,8.9365,8.6053,8.0124,9.2907,8.8921,8.4226,8.361,8.3603,9.092,8.8321,9.0572,8.076,8.0475,8.5653,8.5676,7.909,8.3279,8.9462,8.2227,7.4135,7.1417,6.1413,6.1684,6.2048,6.0224,5.8958,6.21,6.0992,6.102,5.7212,5.757,5.6007,5.2626,6.162,6.5931,7.0725,7.9139,7.9366,7.7247,8.1006,8.5755,8.3681,8.9414,8.9655,8.6273,8.8311,8.5993,8.4938,9.0882,8.9791,9.151,8.9804,9.9322,10.229,10.446,9.6706,9.3077,9.2482,9.4737,9.4784,9.4391,10.082,9.593,10.762,12.304,12.765,12.355,12.684,12.551,13.121,12.812,12.482,11.992,12.023,11.725,11.585,10.989,11.135,10.723,11.035,10.564,11.13,11.677,12.908,12.973,12.511,11.842,11.4,11.058,11.949,12.081,12.505,13.937,12.72,13.891,11.878,9.9409,8.8398,8.2837,7.7194,8.6815,9.6036,11.517,14.246,14.132,15.098,13.865,14.74,12.647,12.552,15.178,14.983,13.649,13.731,12.781,15.184,12.77,13.275,13.662,16.822,12.808,12.394,10.968,12.761,17.678,11.119,15.816,15.469,12.171,13.475,14.389,12.486,13.798,15.288,14.633,13.796,14.099,16.695,16.372,13.929,12.818,14.77,14.347,11.71,14.4,14.35,14.865,13.146,13.731,13.54,17.228,13.228,14.566,16.707,13.462,12.916,16.215,15.192,14.956,17.472,17.036,17.063,17.796,18.718,17.825,17.535,17.69,15.962,16.488,17.399,18.279,18.915,17.873,16.229,16.082,19.299,19.502,19.92,19.444,17.233,19.616,19.508,17.576,18.238,18.105,18.993,18.873,17.888,18.362,19.393,17.357,17.944,18.254,19.015,19.95,18.13,18.068,21.423,17.46,18.824,19.862,18.221,17.964,18.402,18.338,17.944,16.168,19.031,20.231,17.822,18.44,20.05,19.13,17.994,16.714,18.015,18.616,18.65,18.101,19.864,18.401,18.731,17.925,18.968,18.625,18.227,20.501,20.798,15.676,16.109,17.362,19.106,17.976,14.419,14.536,18.113,16.115,17.646,18.004,18.452,19.881,16.999,17.11,20.107,16.814,17.585,17.425,17.067,16.98,15.499,16.694,17.567,15.407,16.808,16.86,16.744,15.839,16.125,15.56,17.977,17.873,16.315,14.065,15.391,15.549,15.902,15.84,14.739,14.045,14.311,14.263,13.989,13.39,12.862,12.374,13.646,13.27,12.996,11.484,11.654,12.04,11.471,9.4777,12.092,12.036,12.325,11.26,11.003,11.056,12.653,11.933,13.471,12.743,13.574,12.158,11.509,12.311,12.17,10.343,11.65,13.315,11.003,11.416,12.245,12.275,13.134,12.73,13.051,13.945,11.899,12.51,12.716,10.324,10.266,10.547,9.6788,11.616,10.614,9.5814,9.2896,8.8913,9.8219,10.57,9.1744,11.363,12.469,11.539,12.978,10.694,10.633,11.753,10.084,12.639,13.16,11.916,11.474,11.495,12.465,12.596,12.72,9.3058,10.476,14.968,15.779,12.325,10.371,9.4045,13.507,14.068,10.316,8.244,10.688,14.432,12.589,8.4581,7.2494,12.972,9.4151,10.434,10.813,10.198,8.5745,9.2283,11.764,12.336,11.829,10.962,11.088,11.763,14.134,8.094,7.6789,8.6084,9.0337,9.9814,9.9403,9.6462,10.67,6.4388,3.6575,2.921,9.8455,10.405,7.5777,6.7923,8.4932,7.1617,5.3501,7.4563,7.8523,6.0806,6.4744,6.9166,8.0283,8.3801,7.0883,6.886,7.1645,6.4038,10.769,6.8063,6.3469,5.8389,6.818,7.9767,9.4294,7.7969,6.8951,6.3056,5.4468,4.9926,4.7008,5.1699,5.5655,5.2003,4.3514,4.0715,4.0116,4.9238,5.2118,5.5992,5.3924,5.325,4.3683,5.2034,5.4291,5.9364,6.6686,6.1789,6.8653,7.21,7.7114,9.1491,7.4224,6.8293,9.8983,13.272,14.243,16.132,16.343,17.22,12.471,8.2292,5.1487,3.236,2.6038,1.7618,2.1459,2.0727,1.4333,1.0696,2.7428,4.9414,3.7368,5.319,7.2735,9.6245,9.9489,8.7062,7.7889,8.3732,7.5769,8.6453,8.5449,7.7641,7.8346,7.3066,6.763,7.3616,7.1119,6.4413,6.699,6.5204,6.2435,6.632,5.8984,6.2509,6.5763,7.7363,6.8599,6.7808,8.2888,9.0233,5.3644,7.0148,8.4653,8.5078,9.2944,9.3122,7.9084,8.2096,9.5056,8.0469,6.7035,7.3514,8.2602,13.666,12.81,13.158,11.648,12.011,12.867,11.672,9.1638,8.7104,12.806,15.737,15.89,9.3137,8.025,8.5042,9.5073,9.5958,11.346,8.4166,10.219,11.514,16.394,15.26,13.288,13.135,14.123,13.037,12.673,12.968,12.848,14.419,14.979,15.234,13.138,9.6594,8.2285,7.1744,7.3132,11.892,11.252,11.26,13.4,13.312,12.276,12.161,11.632,11.975,11.783,11.861,11.747,11.193,13.527,14.698,11.937,15.2,13.353,10.386,10.991,10.444,9.6877,9.1259,6.8962,5.8379,8.2692,7.3411,16.74,16.519,12.494,11.721,12.382,13.003,13.546,13.636,10.835,15.534,16.669,14.253,15.002,14.85,16.415,15.733,15.974,14.421,14.208,14.385,16.308,16.622,14.814,13.628,17.777,15.583,16.752,17.047,17.543,17.943,17.24,17.781,18.481,17.531,19.057,19.985,18.644,18.364,15.942,16.249,17.714,18.363,17.126,17.548,14.776,16.845,16.468,15.058,13.342,13.838,15.281,14.377,15.716,15.602,15.187,14.808,13.92,13.606,14.298,15.136,14.49,13.24,11.313,9.1919,8.7701,8.9702,8.8606,7.8012,7.9557,7.4307,11.543,11.374,11.287,7.2281,4.4993,4.9059,10.826,12.45,9.4174,7.4316,8.9589,8.1305,4.4854,5.9888,9.2665,9.6626,9.9196,9.9101,8.8638,9.4765,9.0699,9.6093,9.1072,7.1331,5.7111,4.5949,5.2524,5.1016,7.2966,10.125,10.476,9.26,6.9813,7.2153,7.5221,5.3857,7.3752,7.1289,7.5026,5.7992,5.2273,5.0211,5.1433,5.8475,6.3824,4.7445,4.695,5.0794,4.103,4.5129,4.4942,5.2719,6.5797,6.5465,5.843,5.1389,5.8237,5.1551,4.3657,5.0073,7.0279,7.5665,7.2244,7.0065,5.1047,4.7981,5.6936,6.5205,6.8074,9.2159,9.7935,9.3623,9.6505,10.112,10.003,10.03,8.2422], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 148 | }],{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 149 | plot_bgcolor: '#ffffff', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 150 | paper_bgcolor: '#f8f8f8', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 151 | title: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 152 | text: 'Windspeed', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 153 | font: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 154 | color: '#ff0000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 155 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 156 | yref: 'container', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 157 | yanchor: 'top', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 158 | y: 0.9625, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 159 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 160 | spikedistance: -1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 161 | height: 400, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 162 | margin: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 163 | t: 45, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 164 | b: 130, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 165 | autoexpand: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 166 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 167 | xaxis: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 168 | type: 'date', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 169 | fixedrange: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 170 | mirror: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 171 | linecolor: '#d0d0d0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 172 | autorange: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 173 | gridcolor: '#e8e8e8', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 174 | hoverformat: '%Y-%m-%d %H:%M:%S', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 175 | ticklen: 5, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 176 | tickcolor: '#d0d0d0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 177 | showspikes: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 178 | spikethickness: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 179 | spikesnap: 'data', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 180 | spikecolor: '#000000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 181 | spikedash: 'dot', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 182 | rangeslider: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 183 | autorange: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 184 | bordercolor: '#e0e0e0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 185 | borderwidth: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 186 | thickness: 0.2, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 187 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 188 | zeroline: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 189 | zerolinecolor: '#b0b0b0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 190 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 191 | yaxis: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 192 | type: 'linear', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 193 | fixedrange: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 194 | automargin: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 195 | mirror: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 196 | linecolor: '#d0d0d0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 197 | autorange: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 198 | ticklen: 4, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 199 | tickcolor: '#d0d0d0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 200 | gridcolor: '#e8e8e8', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 201 | showspikes: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 202 | side: 'left', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 203 | spikethickness: 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 204 | spikesnap: 'data', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 205 | spikecolor: '#000000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 206 | spikedash: 'dot', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 207 | title: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 208 | text: 'm/s', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 209 | font: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 210 | color: '#ff0000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 211 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 212 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 213 | zeroline: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 214 | zerolinecolor: '#d0d0d0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 215 | }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 216 | },{ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 217 | displayModeBar: false, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 218 | doubleClickDelay: 1000, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 219 | responsive: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 220 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 221 | $('#plot').attr('originalHeight',400); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 222 | $('#plot').attr('originalBottomMargin',130); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 223 | }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 224 | </script> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 226 | =end html | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 228 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 230 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 232 | package Quiq::PlotlyJs::TimeSeries; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | ▶ | use base qw/Quiq::Hash/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 235 | 1 | ▶ | use v5.10; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 236 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 239 | 1 | our $VERSION = '1.240'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 241 | 1 | ▶ | use Quiq::Json::Code; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 242 | 1 | ▶ | use Quiq::Template; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 244 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 246 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 248 | =head2 Konstruktor | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 250 | =head3 new() - Instantiiere Objekt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 252 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 254 | $plt = $class->new(@attVal); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 256 | =head4 Attributes | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 258 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 260 | =item class => $class (Default: 'plotly-timeseries') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 262 | CSS-Klasse des div-Containers. Kann zur Definition eines Rahmens, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 263 | von Außenabständen usw. genutzt werden. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 265 | =item color => $color (Default: '#ff0000') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 267 | Farbe der Kurve und Titel (Haupttitel, Titel Y-Achse). Alle | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 268 | Schreibweisen, die in CSS erlaubt sind, sind zulässig, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 269 | also NAME, #XXXXXX oder rgb(NNN,NNN,NNN). Dies gilt für alle Farben. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 271 | =item height => $n (Default: 400) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 273 | Höhe des (gesamten) Diagramms in Pixeln. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 275 | =item name => $name (Default: 'plot') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 277 | Name des Plot. Der Name wird als CSS-Id für den Div-Container | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 278 | und als Variablenname für die JavaScript-Instanz verwendet. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 280 | =item title => $str | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 282 | Titel des Plot. Wird über das Diagramm gesetzt. Typischerweise | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 283 | der Name des gemessenen Parameters. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 284 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 285 | =item x => \@x (Default: []) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 287 | Referenz auf Array der Zeit-Werte (bevorzugt in JavaScript-Epoch). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 289 | =item y => \@y (Default: []) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 291 | Referenz auf Array der Y-Werte (in Weltkoordinaten). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 293 | =item yTitle => $str | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 295 | Beschriftung an der Y-Achse. Typischerweise die Einheit des | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 296 | gemessenen Parameters. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 298 | =back | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 300 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 302 | Objekt | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 304 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 306 | Instantiiere ein Objekt der Klasse und liefere eine Referenz auf | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 307 | dieses Objekt zurück. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 309 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 310 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 311 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 313 | 1 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 314 | 1 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 315 | # @_: @attVal | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 317 | 1 | my $self = $class->SUPER::new( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 318 | class => 'plotly-timeseries', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 319 | color => '#ff0000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 320 | height => 400, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 321 | name => 'plot', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 322 | title => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 323 | x => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 324 | xMin => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 325 | xMax => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 326 | y => [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 327 | yMin => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 328 | yMax => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 329 | yTitle => undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 330 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 331 | 1 | $self->set(@_); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 333 | 1 | return $self; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 336 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 337 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 338 | =head2 Klassenmethoden | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 339 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 340 | =head3 cdnUrl() - Liefere CDN URL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 341 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 342 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 344 | $url = $this->cdnUrl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 346 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 348 | URL (String) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 350 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 352 | Liefere den CDN URL der neusten Version von Plotly.js. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 354 | =head4 Example | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 356 | $url = Quiq::PlotlyJs::TimeSeries->cdnUrl; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 357 | ==> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 358 | https://cdn.plot.ly/plotly-latest.min.js | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 359 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 360 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 362 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 364 | 1 | ▶ | sub cdnUrl { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cdnUrl: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 365 | 1 | my $this = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 366 | 1 | return 'https://cdn.plot.ly/plotly-latest.min.js'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 367 | #return 'https://cdn.plot.ly/plotly-1.30.0.min.js'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 368 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 370 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 372 | =head2 Objektmethoden | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 374 | =head3 html() - Generiere HTML | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 376 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 378 | $html = $ch->html($h); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 380 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 382 | HTML-Code (String) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 384 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 386 | Liefere den HTML-Code der Plot-Instanz. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 388 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 390 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 391 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 392 | 1 | ▶ | sub html { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
html: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 393 | 1 | my ($self,$h) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 395 | # Objektattribute | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 396 | 1 | my ($class,$height,$name) = $self->get(qw/class height name/); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 398 | # MEMO: Wir setzen die Höhe im div und nicht im Layout, damit | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 399 | # das div bereits den Raum einnimmt, welcher später durch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 400 | # Plotly befüllt wird | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 402 | 1 | return $h->tag('div', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 403 | id => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 404 | class => $class, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 405 | style => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 406 | height => "${height}px", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 407 | border => '1px dotted #b0b0b0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 408 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 409 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 412 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 414 | =head3 js() - Generiere JavaScript | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 415 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 416 | =head4 Synopsis | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 418 | $js = $ch->js; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 420 | =head4 Returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 422 | JavaScript-Code (String) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 423 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 424 | =head4 Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 426 | Liefere den JavaScript-Code für die Erzeugung Plot-Instanz. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 428 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 430 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 432 | 1 | ▶ | sub js { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
js: called CC=7 SCAR=19.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 433 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 435 | # Zusatz-Attribute (die Plotly nicht kennt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 437 | 1 | my $name = $self->get('name'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 439 | # Multi-Attribute (betreffen mehrere Plotly-Attribute) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 441 | 1 | my $color = $self->get('color'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 442 | # --- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 443 | 1 | my $axisBox = 1; # Zeichne eine Box um den Plotbereich. Die Box hat | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 444 | # die Farbe der Achsen (siehe axisColor). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 445 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 446 | # Einzel-Attribute (betreffen einzelnes Plotly-Attribut) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 448 | 1 | my $height = $self->get('height'); # Höhe des gesamten Diagramms | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 449 | 1 | my $title = $self->get('title'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 450 | 1 | my $xA = $self->get('x'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 451 | 1 | my $yA = $self->get('y'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 452 | 1 | my $yTitle = $self->get('yTitle'); | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 453 | 1 | my $xMin = $self->get('xMin'); # Kleinster Wert auf der X-Achse. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 454 | # Der Default 'undefined' bedeutet, dass der Wert aus den Daten | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 455 | # ermittelt wird. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 456 | 1 | my $xMax = $self->get('xMax'); # Größter Wert auf der X-Achse. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 457 | # Der Default 'undefined' bedeutet, dass der Wert aus den Daten | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 458 | # ermittelt wird. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 459 | 1 | my $yMin = $self->get('yMin'); # Kleinster Wert auf der Y-Achse. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 460 | # Der Default 'undefined' bedeutet, dass der Wert aus den Daten | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 461 | # ermittelt wird. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 462 | 1 | my $yMax = $self->get('yMax'); # Größter Wert auf der Y-Achse. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 463 | # Der Default 'undefined' bedeutet, dass der Wert aus den Daten | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 464 | # ermittelt wird. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 466 | # Maße für die Ränder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 468 | 1 | my $topMargin = 45; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 470 | # 250->100,300->110,350->120,400->130,450->140,... | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 471 | 1 | my $bottomMargin = ($height-300)/50*10+110; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 472 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 473 | # --- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 474 | 1 | my $axisColor = '#d0d0d0'; # Farbe der Achsenlinien | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 475 | 1 | my $fillColor = '#e0e0e0'; # Farbe zwischen Kurve und X-Achse | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 476 | 1 | my $gridColor = '#e8e8e8'; # Farbe des Gitters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 477 | 1 | my $lineColor = $color; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 478 | 1 | my $lineShape = 'linear'; # Linienform: 'spline'|'linear'|'hv'| | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 479 | # 'vh'|'hvh'|'vhv' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 480 | 1 | my $lineWidth = 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 481 | 1 | my $margin = [$topMargin,undef,$bottomMargin,undef]; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 482 | 1 | my $markerColor = $color; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 483 | 1 | my $markerSize = 3; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 484 | 1 | my $markerSymbol = 'circle'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 485 | 1 | my $mode = 'lines'; # Kurvendarstellung: 'lines', 'markers', | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 486 | # 'text', 'none'. Die ersteren drei können auch mit '+' verbunden | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 487 | # werden. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 488 | 1 | my $paperBackground = '#f8f8f8'; # Hintergrund Diagrammbereich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 489 | 1 | my $plotBackground = '#ffffff'; # Hintergrund Plotbereich | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 490 | 1 | my $rangeSliderBorderColor = '#e0e0e0'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 491 | 1 | my $xAxisHoverFormat = '%Y-%m-%d %H:%M:%S'; # Format der | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 492 | # Spike-Beschriftung für die X-Koordinate. Siehe: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 493 | # https://github.com/d3/d3-3.x-api-reference/blob/master/\ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 494 | # Time-Formatting.md#format | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 495 | 1 | my $xAxisTickFormat = '%Y-%m-%d %H:%M'; # Format der | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 496 | # Zeitachsen-Beschriftung | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 497 | 1 | my $xTickLen = 5; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 498 | 1 | my $ySide = 'left'; # Seite, auf der die Y-Achse gezeichnet wird | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 499 | 1 | my $yTickLen = 4; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 500 | 1 | my $zeroLineColor = '#d0d0d0'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 502 | # Instantiiere Objekt zum Erzeugen von JSON-Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 503 | 1 | my $j = Quiq::Json::Code->new; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 505 | # Traces | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 507 | 1 | push my @traces,$j->o( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 508 | type => 'scatter', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 509 | mode => $mode, # lines, markers, lines+markers, none, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 510 | fill => 'tozeroy', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 511 | fillcolor => $fillColor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 512 | line => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 513 | width => $lineWidth, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 514 | color => $lineColor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 515 | shape => $lineShape, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 516 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 517 | marker => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 518 | size => $markerSize, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 519 | color => $markerColor, # [....] Einzelfarben | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 520 | symbol => $markerSymbol, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 521 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 522 | x => $xA, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 523 | y => $yA, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 524 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 526 | # Layout | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 528 | 1 | ▶ | my $layout = $j->o( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
Condition33%2/6
defined $xMin and defined $xMax
defined $yMin and defined $yMax
MC/DC0%0/2
defined $xMin and defined $xMax
defined $xMin
defined $xMax
MC/DC0%0/2
defined $yMin and defined $yMax
defined $yMin
defined $yMax
Truth table33%1/3
A and B
A= defined $xMinB= defined $xMax
Truth table33%1/3
A and B
A= defined $yMinB= defined $yMax
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 529 | plot_bgcolor => $plotBackground, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 530 | paper_bgcolor => $paperBackground, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 531 | title => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 532 | text => $title, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 533 | font => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 534 | color => $color, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 535 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 536 | yref => 'container', # container, paper | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 537 | yanchor => 'top', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 538 | y => 1-(15/$height), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 539 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 540 | spikedistance => -1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 541 | height => $height, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 542 | margin => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 543 | l => $margin->[3], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 544 | r => $margin->[1], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 545 | t => $margin->[0], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 546 | b => $margin->[2], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 547 | autoexpand => \'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 548 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 549 | xaxis => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 550 | type => 'date', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 551 | fixedrange => \'false', # Zoom erlauben | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 552 | mirror => $axisBox? \'true': undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 553 | linecolor => $axisColor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 554 | defined($xMin) && defined($xMax)? (range => [$xMin,$xMax]): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 555 | (autorange => \'true'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 556 | # autorange => \'true', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 557 | gridcolor => $gridColor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 558 | hoverformat => $xAxisHoverFormat, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 559 | # tickformat => $xAxisTickFormat, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 560 | # tickangle => 30, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 561 | ticklen => $xTickLen, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 562 | tickcolor => $axisColor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 563 | #tickformatstops => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 564 | #], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 565 | showspikes => \'true', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 566 | spikethickness => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 567 | spikesnap => 'data', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 568 | spikecolor => '#000000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 569 | spikedash => 'dot', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 570 | rangeslider => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 571 | autorange => \'true', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 572 | bordercolor => $rangeSliderBorderColor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 573 | borderwidth => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 574 | thickness => 0.20, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 575 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 576 | zeroline => \'true', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 577 | zerolinecolor => '#b0b0b0', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 578 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 579 | yaxis => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 580 | type => 'linear', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 581 | fixedrange => \'true', # Zoom verbieten | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 582 | automargin => \'true', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 583 | mirror => $axisBox? \'true': undef, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 584 | linecolor => $axisColor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 585 | defined($yMin) && defined($yMax)? (range => [$yMin,$yMax]): | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 586 | (autorange => \'true'), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 587 | # autorange => \'true', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 588 | ticklen => $yTickLen, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 589 | tickcolor => $axisColor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 590 | gridcolor => $gridColor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 591 | showspikes => \'true', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 592 | side => $ySide, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 593 | spikethickness => 1, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 594 | spikesnap => 'data', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 595 | spikecolor => '#000000', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 596 | spikedash => 'dot', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 597 | title => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 598 | text => $yTitle, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 599 | font => $j->o( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 600 | color => $color, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 601 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 602 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 603 | zeroline => \'true', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 604 | zerolinecolor => $zeroLineColor, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 605 | ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 606 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 607 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 608 | # Config | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 609 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 610 | 1 | my $config = $j->o( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 611 | displayModeBar => \'false', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 612 | doubleClickDelay => 1000, # 1000ms | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 613 | responsive => \'true', | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 614 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 616 | # Erzeuge JavaScript-Code | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 618 | 1 | return Quiq::Template->combine( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 619 | placeholders => [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 620 | __NAME__ => $name, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 621 | __HEIGHT__ => $height, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 622 | __BOTTOM_MARGIN__ => $bottomMargin, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 623 | __TRACES__ => \@traces, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 624 | __LAYOUT__ => $layout, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 625 | __CONFIG__ => $config, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 626 | ], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 627 | template => q~ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 628 | var __NAME__ = Plotly.newPlot('__NAME__',[__TRACES__],__LAYOUT__,__CONFIG__); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 629 | $('#__NAME__').attr('originalHeight',__HEIGHT__); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 630 | $('#__NAME__').attr('originalBottomMargin',__BOTTOM_MARGIN__); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 631 | // __NAME__.then(plot => {console.log(plot._fullLayout)}); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 632 | ~, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 633 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 634 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 636 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 638 | =head1 VERSION | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 639 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 640 | 1.240 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 642 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 644 | Frank Seitz, L<http://fseitz.de/> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 646 | =head1 COPYRIGHT | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 648 | Copyright (C) 2026 Frank Seitz | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 650 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 651 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 652 | This code is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 653 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 655 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 657 | # ----------------------------------------------------------------------------- | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 659 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 661 | # eof | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||