How To Pass Data To C3 Graph
Here is my JS code: var abc = JSON.stringify(dataObject); var chart = c3.generate({ bindto: '#container', data: { json: abc, keys: { x:'_id',
Solution 1:
i got the Answer , it works fine with me . Remove JSON.stringify(dataObject).
it will already Stringify by the c3.js it self
Solution 2:
Solution 3:
According to c3js documentation here : http://c3js.org/reference.html#data-json
You don't need to convert, You are getting undefined error because your keys are already in double quotes. Your data is already JSON, therefore you don't need to convert it, C3js automatically parse it unless there is syntax error.
If your data is valid JSON/Javascript object then C3js will parse it for you.
[{"_id":1404412200000,"a":6,"b":10,"c":6,"d":20}]
OR
[{
_id:1404412200000,
a:6,
b:10,
c:6,
d:20
}]
Notice the difference first one is JSON and second one is Javascript Object
Solution 4:
I stopped in the same error. I think stringify adds characters c3js no interpret
Post a Comment for "How To Pass Data To C3 Graph"