var chart = c3.generate({
/* size: {
height: 400
}, */
bindto:"#chart",
data: {
json: [{"<-10":0,"<-8":0,"<-6":3,"<-4":1,"<-2":15,"<0":40,"<2":82,"<4":68,"<6":7,"<8":6,"<10":3,">10":1}],
keys: {
value: ["<-10","<-8","<-6","<-4","<-2","<0","<2","<4","<6","<8","<10",">10"],
},
type: 'bar'
},
bar: {
ratio: 1.5
},
color: {//referred color code from materializecss color palette
// pattern: ['#f44336', '#ef5350', '#e57373', '#ef9a9a', '#ffcdd2', '#ffebee', '#c8e6c9', '#a5d6a7', '#81c784', '#4caf50', '#388e3c', '#1b5e20']
pattern: ['#ffebee', '#ffcdd2', '#ef9a9a', '#e57373', '#ef5350', '#f44336', '#1b5e20', '#388e3c', '#4caf50', '#81c784', '#a5d6a7', '#c8e6c9']
},
tooltip: {
format: {
title: function (d) { return 'Test'; },
value: function (value, ratio, id) {
return value;
}
}
}
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/c3/0.3.0/c3.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script
src="https://cdnjs.cloudflare.com/ajax/libs/c3/0.3.0/c3.min.js"></script>
<div id="chart"></div>