1๐
What would be the most efficient approach with the least amount of
code? Should I convert the string to an array of objects, then work
with that?
Converting the string to a format required by Chart.js would be a necessary step. Chart.js does not accept csv as an input. The appropriate format varies by chart type (line, pieโฆ)
For Google charts โ see How to use Google Chart with data from a csv
Also, how do I create charts in google charts and chart.js with json
data?
For Chart.js, the documentation (http://www.chartjs.org/docs/#line-chart-introduction) has examples for each chart type to get you started.
The same for Google charts โ https://developers.google.com/chart/interactive/docs/quick_start
- Chartjs-How to align bars in bar chart โ Chart.js
- Chartjs-Is it possible to add a click event in chart.js that directs you to a url?
Source:stackexchange.com