Load multiple json
See original GitHub issueI would like to render the data1 in bar and the data2 in line
It seems the json parameter do not allow to load multiple json data… this is not working
data1 = [{ "label" : "2004", "value" : "3.57" }, { "label" : "2005", "value" : "4.02" }, { "label" : "2006", "value" : "4.41" }, { "label" : "2007", "value" : "4.62" }, { "label" : "2008", "value" : "4.94" }, { "label" : "2009", "value" : "5.32" }, { "label" : "2010", "value" : "5.64" }, { "label" : "2011", "value" : "5.73" } ]
data2 = [{ "label" : "2004", "value" : "6.67" }, { "label" : "2005", "value" : "7.08" }, { "label" : "2006", "value" : "7.46" }, { "label" : "2007", "value" : "8.00" }, { "label" : "2008", "value" : "8.38" }, { "label" : "2009", "value" : "8.76" }, { "label" : "2010", "value" : "9.63" }, { "label" : "2011", "value" : "10.37" } ]
var chart = c3.generate({
bindto: '#chart_panel',
data: {
json: [data1, data2],
keys: {
x: 'label',
value: ['value']
},
types: { data1 : 'bar', data2: 'spline' }
},
axis: {
x: {
type: 'category',
categories: [2004,2005,2006,2007,2008,2009,2010,2011],
label: { text: 'Années', position: 'outer-center'}
}
}
});
Issue Analytics
- State:
- Created 9 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
Reading the JSON File with multiple objects in Python
I was trying hard to overcome that 6 digit numbers at the beginning of each line, but I dont know how can I...
Read more >Efficiently Converting Multiple JSON Files Into A Single ...
In this post, I'm going to show you how to take multiple JSON files and convert them into a single DataFrame. ... data...
Read more >How to Load Multiple JSON Files to SQL Server Table with ...
In this blog post we are going to learn how to load Multiple JSON file to SQL Server Table with File Names in...
Read more >Using Python to Read Multiple JSON Files and Export Values ...
Comparing data from multiple JSON files can get unweildy – unless you leverage Python to give you the data you need. Published: Aug...
Read more >How to manage large JSON efficiently and quickly: multiple files
If you've read the first blog post, you have already learned some tips and tricks on how to handle a large JSON file...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 for this enhancement. Thanks!
The thing is, C3 doesn’t know the first array should be referred to as
data1
(that’s just the variable name it’s stored in); I’m not sure an array works best there. What if the object-to-array syntax of JSON could support objects?To be fair though, you could get this to work with just a bit of JavaScript transformation:
Plunker