I have large json files with this structure, only a lot more charts in each one:
{
"Name": "test",
"Charts": [
{
"chartName": "Idle Times",
"disk": 0,
"OpCode": "Read",
"xAxis": [0,100,200,300,400,500],
"yAxis": [337487,8565,11419,9704,7598]
},
{
"chartName": "Idle Times",
"disk": 0,
"OpCode": "Read",
"xAxis": [0,100,200,300,400,500],
"yAxis": [337487,8565,11419,9704,7598]
}]
}
The problem is that all the chart data, the x-y data, is in arrays and the the javascript chart tool I'm using needs the json to look like this:
{"chartName":"Idle Times", "disk":0, "OpCode":"Read","xAxis":0, "yAxis":1234},
{"chartName":"Idle Times", "disk":0, "OpCode":"Read","xAxis":100, "yAxis":1234},
{"chartName":"Idle Times", "disk":0, "OpCode":"Read","xAxis":200, "yAxis":1234},
{"chartName":"Idle Times", "disk":0, "OpCode":"Read","xAxis":300, "yAxis":1234},
{"chartName":"Idle Times", "disk":0, "OpCode":"Read","xAxis":400, "yAxis":1234},
{"chartName":"Idle Times", "disk":0, "OpCode":"Read","xAxis":500, "yAxis":1234},
{"chartName":"Idle Times", "disk":0, "OpCode":"Read","xAxis":600, "yAxis":1234}
My app is using AngularJS, JSLINQ, D3JS, and DimpleJS currently. If there is a way to accomplish this with these tools that would be ideal. I'm also open to another open source library, I'm just hoping that I don't have to read in the whole json file and right it back with a pile of complicated for loops basically building the new json by hand line by line.
I'm also open to switching to another chart tool if there is something that will read the json data the way I have it now, DimpleJS is just pretty easy to use and looks really sharp.
Thanks in advance for the help!
yAxisvalue supposed to be when related to thexAxis? 1234 says nothing about it unfortunately ;)