react-chartjs icon indicating copy to clipboard operation
react-chartjs copied to clipboard

Allow complex data values

Open francisco4challenge opened this issue 7 years ago • 1 comments

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?

francisco4challenge avatar Sep 11 '18 08:09 francisco4challenge

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.

agent3bood avatar Nov 12 '18 14:11 agent3bood