0

I am trying to create a dashboard from a csv string using google charts and chart.js. I need to modify and add to the dataset; things like category totals, averages, and team (grouped) totals and averages.

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?

Also, how do I create charts in google charts and chart.js with json data?

Bum Son
  • 89
  • 1
  • 7

1 Answers1

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

Community
  • 1
  • 1
potatopeelings
  • 40,709
  • 7
  • 95
  • 119