admin管理员组

文章数量:1415664

I have been using c3.js and cant figure out how to get a JavaScript event for onClick of the Data group labels which is displayed in X Axis.

Basically i need event to which I can register a event handler in the below Circled area.

I have been using c3.js and cant figure out how to get a JavaScript event for onClick of the Data group labels which is displayed in X Axis.

Basically i need event to which I can register a event handler in the below Circled area.

Share Improve this question asked Feb 26, 2015 at 12:34 Guru KaraGuru Kara 6,4823 gold badges40 silver badges51 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 5

There is no method, as of yet, in c3js for adding onClick events on ticks.

But you can directly use d3:

d3.selectAll('.tick')
  .on('click', function(value,index){
      alert('You clicked a tick.');
  });

This will add an event that will fire when you click a tick.

jsfiddle sample : http://jsfiddle/Lc3447Lb/1/

Source: https://github./masayuki0812/c3/issues/761

本文标签: javascriptc3js how to get a onclick event for DataGroupsStack Overflow