michelson/lazy_high_charts

Taking data from csv

MarcoDias7 opened this issue · 1 comments

Hi,

I've been using this gem to experiment Highcharts, I've been able to make it work, and now I need to create charts using data from a csv.
Is there a way to do this with this gem ? I'm completely new in Rails and Highcharts.

Thanks !

sure you can , but how you retrieve your data is not lazy high charts concern.
Anyway, to achive that you can use the ruby built in csv library.
Take a look to http://ruby-doc.org/stdlib-1.9.2/libdoc/csv/rdoc/CSV.html , you can call CSV.read or CSV.parse in the controller's action that generates the chart. maybe not the best idea do it the csv processing in the request, but is a start.

to optimize this you could cache the resquest result or do the csv processing in a worker (sidekiq, resque) instead controller action and store the results in a DB record.