formatData.js
460 Bytes
// 格式化数据
export function _dataRelect(data) {
let resetData = {
xdata: [],
namedata: []
}
resetData.namedata = (data.map(function (item) {
return new Date(item.timestamp * 1000).toLocaleString().substring(12, 20);
}))
resetData.xdata = (data.map(function (item) {
if (item.value == null) {
item.value = 0;
}
return (item.value).toFixed(2)
}))
return resetData;
}