Doplnenie grafov teploty, tlaku, vlhkosti
This commit is contained in:
50
resources/js/app.js
vendored
50
resources/js/app.js
vendored
@@ -29,7 +29,10 @@ Vue.component('example-component', require('./components/ExampleComponent.vue').
|
||||
*/
|
||||
|
||||
import VueThermometer from 'vuejs-thermometer'
|
||||
Vue.use(VueThermometer)
|
||||
Vue.use(VueThermometer);
|
||||
|
||||
import VueDygraphs from 'vue-dygraphs';
|
||||
Vue.use(VueDygraphs);
|
||||
|
||||
//(function () {
|
||||
var app = new Vue({
|
||||
@@ -41,7 +44,32 @@ Vue.use(VueThermometer)
|
||||
humidity: null,
|
||||
pressure: null,
|
||||
voltage: null,
|
||||
time: null
|
||||
time: null,
|
||||
temp_options: {
|
||||
legend: 'always',
|
||||
title: 'Teplotný graf',
|
||||
xlabel: 'Dátum',
|
||||
labels: ['Dátum','Teplota'],
|
||||
ylabel: 'Stupeň',
|
||||
fillGraph: true
|
||||
},
|
||||
hum_options: {
|
||||
legend: 'always',
|
||||
title: 'Vlhkosť graf',
|
||||
xlabel: 'Dátum',
|
||||
labels: ['Dátum','Vlhkosť'],
|
||||
ylabel: 'Percent',
|
||||
fillGraph: true
|
||||
},
|
||||
p_options: {
|
||||
legend: 'always',
|
||||
title: 'Tlak graf',
|
||||
xlabel: 'Dátum',
|
||||
labels: ['Dátum','Tlak'],
|
||||
ylabel: 'Tlak',
|
||||
fillGraph: true
|
||||
},
|
||||
series: { "temperature" : [], "humidity" : [], "pressure": [] },
|
||||
},
|
||||
mounted: function () {
|
||||
console.log('MOUNTED');
|
||||
@@ -74,6 +102,24 @@ Vue.use(VueThermometer)
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
let vts = ["temperature","humidity","pressure"];
|
||||
for (var t in vts) {
|
||||
console.log("t=",vts[t]);
|
||||
axios.get('/data/get', {
|
||||
params: {
|
||||
type: vts[t],
|
||||
}
|
||||
})
|
||||
.then(function (response) {
|
||||
console.log("GET DATA");
|
||||
console.log(response.config.params.type);
|
||||
let data = response.data.map( x => [moment(x[0]).toDate(),x[1]] );
|
||||
app.series[response.config.params.type] = data;
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error);
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user