Я черчение диаграммы, и для этого я хочу, чтобы преобразовать ниже 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.