我绘制的图表和我想下面的JSON转换JSON格式
var jsonArray = [{
"tagValueName": "PCI",
"tagValueId": 1,
"priorityAlertsCount": 20,
"investigationAlertsCount": 140,
"incidentAlertsCount": 100,
"otherAlertsCount": 40
}, {
"tagValueName": "ABC",
"tagValueId": 2,
"priorityAlertsCount": 100,
"investigationAlertsCount": 60,
"incidentAlertsCount": 20,
"otherAlertsCount": 20
}];
转换但图表需要在以下格式的数据
var jsonData = [{
"tagValueName" : "PCI",
"type": "priorityAlertsCount",
"count": "20",
},
{
"tagValueName" : "PCI",
"type": "investigationAlertsCount",
"count": "140",
},
{
"tagValueName" : "PCI",
"type": "incidentAlertsCount",
"count": "100",
},
{
"tagValueName" : "PCI",
"type": "otherAlertsCount",
"count": "40",
},{
"tagValueName" : "ABC",
"type": "priorityAlertsCount",
"count": "100",
},{
"tagValueName" : "ABC",
"type": "investigationAlertsCount",
"count": "60",
}];
我怎样才能将JSON从我的格式转换为图表所需的格式?
请帮助,因为我是新来的JS?
我想绘制一个图表,如this。