I am trying to understand if there is any way to use other json format for chart in nvd3 or d3.
Like if I give,
var modulechart_data = [
{
key : "Passed",
values :[
{ x : "Module A", y : 2},
{ x : "Module B", y : 12},
{ x : "Module C", y : 14},
{ x : "Module D", y : 2}
]
},
{
key : "Failed",
values :[
{ x : "Module A", y : 6},
{ x : "Module B", y : 3},
{ x : "Module C", y : 4},
{ x : "Module D", y : 2}
]
}
];
it will work without any problem.
Now my real json data is coming like this,
var module_data = {
"ModuleExecutionStatus": [
{
"ModuleName": "Module A",
"ExecutionData": {
"Passed": 1,
"Failed": 3
}
},
{
"ModuleName": "Module B",
"ExecutionData": {
"Passed": 3,
"Failed": 1
}
}
]
}
I am creating multiBarHorizontalChart of nvd3. But with real json data, i am not able to deploy it.
I am trying to figure out, do I have to change whole original json data to default json format ? or how can I map this json data for chart ?