I want to use google charts to create a graph which looks like:
GoogleChart.pie_400x200('Taco Bell'=>0,'Mediterranean'=>2,'Shivas'=>5)
Given an object say Results(name, count). How can I create an object for GoogleCharts's structure as seen above?
Thanks
Starting with the Results object you listed in your comment as @results
, the following ought to work:
GoogleChart.pie_400x200(@results.map {|r| { r[:title] => r[:percentage] } })
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With