1。我的数据如下:
[{
"BatchConfigName": "End1",
"EndDateTime": "2019-01-06T11:10:00"
},
{
"BatchConfigName": "End2 - Non-Gas",
"EndDateTime": "2019-01-07T05:54:00"
},
{
"BatchConfigName": "Secure",
"EndDateTime": "2019-01-07T04:48:00"
}
}
我想创建分配该数据的打字稿功能,例如
var datawebsiteViewsChart = {
labels: ['End1', 'End2 - Non-Gas', 'Secure'],
series: [
[11: 10, 05: 54, 04: 48]
]
};
无
答案 0 :(得分:0)
function map(data) {
const labels = [];
const series = [];
for (itemKey of data) {
labels.push(itemKey);
series.push(data[itemKey]);
}
return {
labels,
series
};
}