C3Js Row data example
An example of how to use c3js row data
HTML
<script src="https://rawgit.com/masayuki0812/c3/master/c3.js"></script>
<link rel="stylesheet" href="https://rawgit.com/masayuki0812/c3/master/c3.css">
<div id="chart"></div>
JavaScript
var data = [{
"name": "bob",
"age": 20
}, {
"name": "alice",
"age": 23
}, {
"name": "ushnish",
"age": 200,
"meta": [{
"origin": "Deep in the Himalays"
}, {
"whereabouts": "probably in the Kitchen at eBay"
}]
}]
var chart = c3.generate({
bindto: '#chart',
data: {
json: data, // specify that our above json is the data
keys: {
x: 'name', // specify that the "name" key is the x value
value: ["age"] // specify that the "age" key is the y value
},
type: 'bar' // specfify type of plot
},
grid: {
y: {
show: true
}
},
axis: {
rotated: true, // horizontal bar chart
x: {
type: 'category',
//tick: {outer: false},
//tick: {show: false}
}
}
});