Data Color

# data_color.js

var chart = c3.generate({ data: { columns: [ ['data1', 30, 20, 50, 40, 60, 50], ['data2', 200, 130, 90, 240, 130, 220], ['data3', 300, 200, 160, 400, 250, 250] ], type: 'bar', colors: { data1: '#ff0000', data2: '#00ff00', data3: '#0000ff' }, color: function (color, d) { // d will be 'id' when called for legends return d.id && d.id === 'data3' ? d3.rgb(color).darker(d.value / 150) : color; } } });