I want to modify the x-axis position from bottom to top in the graph drawn with C3. Depending on the circumstances may be used to D3.
I refer to this website. ->click here. refer site.
I want to modify the x-axis position from bottom to top in the graph drawn with C3. Depending on the circumstances may be used to D3.
I refer to this website. ->click here. refer site.
Don't know of a method in the c3 api that does it, but a bit of d3 tinkering in the onrendered function (along with a bit of padding) will do the job
var chart = c3.generate({
data: {
columns: [
['data1', 30, 200, 100, 400, 150, 250],
['data2', 50, 20, 10, 40, 15, 25]
],
types: {
data1: 'bar',
}
},
axis: {
rotated: true,
},
padding: {
top: 10,
},
onrendered: function () {
var axis = d3.selectAll(".c3-axis-y");
axis
.attr("transform", "translate(0,0)")
.selectAll(".tick line")
.attr("transform", "translate(0,-6)")
;
axis.selectAll(".tick text")
.attr("transform", "translate(0,-25)")
;
}
});