Home Ask Login Register

Developers Planet

Your answer is one click away!

BigPoppa February 2016

Added X-Axis Labels to C3 Bar Chart

I am trying to add x-axis labels to a bar chart in C3. Getting javascript errors. Is this even possible? I've tried many combinations and cannot find examples of this working.

var _vertChart = c3.generate({
    bindto: '#chart',
    data: {
        x: 'x',
            columns: [
                ['My Numbers',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
                ['Johns Numbers',0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
            type: 'bar'
        bar: {
            width: {
                ratio: 0.8 // this makes bar width 50% of length between ticks
            // or
            //width: 100 // this makes bar width 100px
        axis: {x: {type: 'category', show: true}},
        labels: true,
        tooltip: {
            show: true
        color: {
            pattern: ["#5F3A81","#56AEC7", "#F09348", "#A196A9"]
        grid: {
            x: {
                show: true
            y: {
                show: false,
                lines: []


BigPoppa February 2016

Just realized I had bad data in columns

Post Status

Asked in February 2016
Viewed 3,504 times
Voted 7
Answered 1 times


Leave an answer

Quote of the day: live life