Is there a way to extract values from the Company
data array within the onclick
event? Currently, using the api
functions only allows access to the Users
array.
var chartCompany = c3.generate({
bindto: '#users-chart',
data: {
x: 'Company',
url: '/ajax_call',
mimeType: 'json',
type: 'bar',
axes: {
Company: 'x'
},
onclick: function (d, i) { console.log(chartCompany.data()); }
},
axis: {
x: {
type: 'category',
show: false
},
}
});
The json response received from the server is as follows:
{
"Company": ["Company 1", "Company 2", "Company 2"],
"Users" : [10, 20, 30]
}
Any assistance or ideas on this matter would be greatly valued.
[Edit 1] Further details on my inquiry: When clicking on a bar representing Users, I aim to retrieve the associated Company information.
[Edit 2] Here's a functional static example: http://jsfiddle.net/et37a9t2/