add humidity scale
[dweather.git] / templates / index.html.ep
index aad1a36ee416825597708760434a4b0655df99ed..e5a7c09276fb48fadd8f9a014a30096afc3b0b12 100644 (file)
                                                }
                                        },
                                        opposite: true
+                               }, { // Tertiary yAxis
+                                       gridLineWidth: 0,
+                                       floor: 0,
+                                       ceiling: 100,
+                                       title: {
+                                               text: 'Humidity',
+                                               style: {
+                                                       color: '#008800'
+                                               }
+                                       },
+                                       labels: {
+                                               format: '{value} %',
+                                               style: {
+                                                       color: '#008800'
+                                               }
+                                       },
+//                                     opposite: true
                                }],
                                tooltip: {
                                        shared: true
                                legend: {
                                        layout: 'vertical',
                                        align: 'left',
-                                       x: 80,
+                                       x: 120,
                                        verticalAlign: 'top',
                                        y: 55,
                                        floating: true,
                                }, {
                                        name: 'Temperature',
                                        type: 'spline',
+                                       yAxis: 0,
                                        color: '#ff0000',
                                        data: [
                                                <% $s = "";
                                        tooltip: {
                                                valueSuffix: ' °C'
                                        }
+                               }, {
+                                       name: 'Humidity',
+                                       type: 'spline',
+                                       color: '#008800',
+                                       yAxis: 3,
+                                       data: [
+                                               <% $s = "";
+                                                  for (@main::last5daysh) { 
+                                                     my $r = $main::json->decode($_);
+                                                     $s .=  "[" . $r->{t}*1000 . "," . $r->{h}->{Humidity_Out} . "]," if $r && exists $r->{t} && exists $r->{h}->{Humidity_Out};
+                                                  }
+                                                  chop $s if length $s; 
+                                               %><%= $s %>
+                                       ],
+                                       marker: {
+                                               enabled: false
+                                       },
+                                       dashStyle: 'shortdot',
+                                       tooltip: {
+                                               valueSuffix: ' %'
+                                       }
                                }]
                        });
                }
                                                <th>Humidity:</th><td> <span id="Humidity_Out"> </span></td>
                                                <th>Dew Point:</th><td> <span id="Dew_Point"> </span></td>
                                        </tr>
-                                       <tr><th>Wind:</th><td><span id="Wind"> </span> mph @ <span id="Dir"> </span> deg</td>
+                                       <tr><th>Wind:</th><td><span id="Wind"> </span> m/s @ <span id="Dir"> </span> deg</td>
                                                <th>Wind Dir Minute Avg:</th><td> <span id="Dir_1m">  </span></td>
                                                <th>Wind Speed Minute Avg:</th><td> <span id="Wind_1m">  </span></td>
                                        </tr>