C3: Bar Chart
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 somethingWeLoadedFromTheServer = [
{a:23, b:45, c:12},
{a:34, b:19, c:38},
{a:25, b:62, c:56},
{a:44, b:88, c:74}
];
var chart = c3.generate({
data: {
json: somethingWeLoadedFromTheServer,
keys: {
value: ['a', 'b'],
//x: 'c'
},
type: 'bar'
},
bar: {
width: {
ratio: 0.5 // this makes bar width 50% of length between ticks
}
},
// axis: {
// y: {
// tick: {
// count: 3,
// format: d3.format('.2f')
// }
// }
// }
});
d3.select(chart.internal.config.bindto)
.style ("background-image", "url('https://cdn.pixabay.com/photo/2013/07/13/12/42/do-not-copy-160138_960_720.png')")
.style ("background-size", "160px 160px")
.style("background-repeat", "repeat")
;