Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bind additional data to datapoints #1957

Open
eugeneJava opened this issue Feb 8, 2017 · 2 comments
Open

Bind additional data to datapoints #1957

eugeneJava opened this issue Feb 8, 2017 · 2 comments

Comments

@eugeneJava
Copy link

In my application each datapoint is a sum of some recordings values. And I want to use an onclick on the datapoint to render (using ajax) info about each recording included into this datapoint. So I need somehow to bind my recording uuid s to a concrete datapoint. Can I do it somehow with C3 charts?
Thanks

@schwassj
Copy link

schwassj commented Mar 3, 2017

IMO the c3 Library is for rendering charts of your data. If you need to link to data behind some bar or point on a chart through onclick, then a reasonable approach is to pass the requisite data to the page from the server in JSON form alongside the data and configuration details for the c3 chart. Since application flow is in no way consistent across various applications, it is not in the scope of this library to handle this functionality.

There are ways within the library to recognize which element has been clicked. You just need to associate another object that recognizes the index of array behind the chart. I recommend using data.order: null to maintain control over the association between the c3 chart data and your custom array.

@schwassj
Copy link

schwassj commented Mar 3, 2017

Alternatively, you can pass the additional data with chart.data and in the onrendered callback to not show that data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants