Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

Allow complex data values #223

Open
francisco4challenge opened this issue Sep 11, 2018 · 1 comment
Open

Allow complex data values #223

francisco4challenge opened this issue Sep 11, 2018 · 1 comment

Comments

@francisco4challenge
Copy link

Hi, is it possible to allow the data property to have an array of objects with a specific structure, like:
{ value: 32, [anything else] } and use the value prop to make the chart? Or define a "render" prop to be a allow a function that determines how to get the value. ( (point) => point.value )

I'm asking this because i need to have a something in the chartElement object that i can link to a structure outside the chart. Example: having an id value for each point so that i can use to query a DB.

Is this possible or i would have to fork the lib and costumize it?

@agent3bood
Copy link

This functionality is part of the chart.js library, react-chartjs is just a wrapper.
According to the docs https://github.com/chartjs/Chart.js/blob/v1.1.1/docs/01-Line-Chart.md you have to pass an array of points, if you are getting complex data from your api you have to arrange it in the way that the library will accept.

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

No branches or pull requests

2 participants