Reputation: 429
I'm trying to make an horizontal bar chart using c3.js , I would like to put the name of the axis by myself for that I use :
tick: {
count: 6,
format: function () {
var label1 = ["[-25 ans]", "[25-29 ans]","[30-34 ans]", "[25-29 ans]","[30-34 ans]","[35-39 ans]"];
for (var i in label1){
return (label1[i]);
}
}
}
but as a result I only get [-25 ans] for all the ticks and in the IDE it says "for statement doesn't loop"
Am I doing something wrong ? How can I correct that ? Thanks
Upvotes: 2
Views: 3828
Reputation: 4876
You should use axis.x.tick.values
tick: {
values: ["[-25 ans]", "[25-29 ans]","[30-34 ans]", "[25-29 ans]","[30-34 ans]","[35-39 ans]"]
}
Upvotes: 2