c3js / c3js/c3

Load multiple json

Open
#839 9 comments 1 reaction 0 assignees View on GitHub
C-feature-request on hold resolved maybe
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

I 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'}
}
}
});
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.