Javascript c3.js or billboard.js with JSON data how to get other legend label

Viewed 387

I have this code:

    ... normen is my json object ....               
        $.each(normen, function(item) {
            chartX.push(this.feed_day)
            chartY.push(this.weight)
        });
        createChart(chartX,chartY)
    });


function createChart(chartX,chartY){
    var chart = bb.generate({
        bindto: "#contentarea",
        data: {
            columns: columns:[chartX,chartY],
            names:{
                chartX: 'label for X',
                chartY: "label for Y"
            }
        },    
        title: {
            text: "Blabla"
        },
    });
}

All I want are some custom labels. How can I achieve that? I tried different options but so far I get 43 and null as legend labels

1 Answers

Got it. I had to add the label as first entry to my arrays.

Related