c3js / c3js/c3

onclick function callback has no x axis information (category)

Open
#1,194 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
9.3k
Forks
1.4k
Avg merge
6d 16h
Merged PRs (30d)
1

Description

Is there anyway to retrieve the x axis category when click on a point or in a bar?

For example, when I add next code to this category chart (http://c3js.org/samples/categorized.html), object d only has the index of x tick but no category name.

``` javascript
selection: {
enabled:true
},
onselected: function(d, element) {
console.log(d);
}
```

I obtain this:
_Object {**x: 1**, value: 200, id: "data1", index: 1, name: "data1"}_
and i want this
_Object {**x: cat2**, value: 200, id: "data1", index: 1, name: "data1"}_

The same info that tooltip shows on mouse over

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.