chart.resize({
width: getwidth(element)
});
- // chart.flush();
},
transition: {
duration: null
grid: {
y: {
show: true
+ },
+ x: {
+ show: true
}
},
regions: [
]
});
+ // workaround for unrendered dots
+ setTimeout(function () { chart.flush(); }, 5000);
+
// reload data in charts
setInterval(
function() {
if (element.substr(0, 7) == 'chart_w') {
chart.load({
url: api_base_url_sensors + beginend(days),
- mimeType: 'json'
+ mimeType: 'json',
+ unload: true
});
} else {
chart.load({
url: api_base_url_weather + beginend(days),
- mimeType: 'json'
+ mimeType: 'json',
+ unload: true
});
- }
+ };
+ setTimeout(function () { chart.flush(); }, 5000);
}
function beginend(days) {
dayschart('chart_air_31', 'Die Luft (Monat)', 31, '%Y-%m-%d');
dayschart('chart_air_365', 'Die Luft (Jahr)', 365, '%b %Y');
-// reload current values
+// reload current values + owm script
setInterval(
function() {
var airvalue = document.getElementById('currentairvalue');
.catch(function(error) {
console.log(error);
});
+
+ var owmwidget = document.getElementById('openweathermap-widget-15');
+ owmwidget.removeChild(owmwidget.childNodes[0]);
+ var owmscript = document.head.lastElementChild;
+ document.head.removeChild(owmscript);
+ var newowmscript = document.createElement('script');
+ newowmscript.src = '//openweathermap.org/themes/openweathermap/assets/vendor/owm/js/weather-widget-generator.js';
+ document.head.appendChild(newowmscript);
},
refresh_interval
);