I'm using c3.js which is a "D3-based reusable chart library." I have also created my own legend for a donut chart with a pie chart inside. I want to link the legend and charts so that if I click a legend item, it'll trigger animation on both the legend div
and the corresponding path
element on the donut/pie chart, or vice versa (clicking on the pie/donut path will trigger animation on both). I know you can set onclick event listeners for the c3 items, but without any id I can't identify the corresponding legend div
. Also, if I set a click handler on the legend div
s, I won't know the corresponding path
and I also don't know how to trigger c3's built in click animations.
EDIT: I found that you can trigger a selected state (http://c3js.org/reference.html#api-select) but you must pass it an id. On my charts, there are no id's to pass in. Is there a way to set custom id's for each data point?