You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Your example shows how to load data from JSON into a line chart, however, pie and donut charts have slightly different column input, as there is only one column only contains one value. How would I go about loading an array of JSONs of the following format:
Actually, I haven't seen an example when you can pass in a json stored in a variable into data. Is this possible?
For example:
var x = a json object, or an array of json objects
data: {
json: 'x'
}
Hi, I think this is what you want to do. http://jsfiddle.net/hQSSn/3/
For unload, please specify the ids (in your case, Label 1, Label 2, etc) as the fiddle.
Your example shows how to load data from JSON into a line chart, however, pie and donut charts have slightly different column input, as there is only one column only contains one value. How would I go about loading an array of JSONs of the following format:
var test_array_JSONs = [
{"label": "Label 1", "amount": 20},
{"label": "Label 2", "amount": 50},
{"label": "Label 3", "amount": 30}
];
into a donut chart?
I tried the following code but it unfortunately doesn't work:
var donutChart = c3.generate ({
data: {
json: 'test_array_JSONs',
keys: {
x: 'label',
value: 'amount'
},
type: 'donut'
}
});
Please let me know if it's possible to do this, thank you!
The text was updated successfully, but these errors were encountered: