25.03.2024, 14:49
(14.03.2024, 07:31)admin Wrote: This function can be used to fetch trend data. Change ids array as needed.
Code:function getdate(offset) {
var date = new Date();
date.setDate(date.getDate() + offset);
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
return { year, month, day };
}
function getdata() {
var ids = [ 1, 3, 5 ];
var data = JSON.stringify({
dates_curr: {
start: getdate(0),
end: getdate(1)
},
ids: ids,
});
$.post('/scada-vis/trends/fetch', { data }, function(trends) {
var result = [];
trends = JSON.parse(trends);
$.each(trends, function(_, trend) {
result.push(trend.data);
});
console.log(result);
});
}
Hi,
Is it possible to get data timestamps using this code?