winston / google_visualr

A Ruby Gem for the Google Visualization API. Write Ruby code. Generate Javascript. Display a Google Chart.

Home Page:http://googlevisualr.heroku.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support to add packages

dtelaroli opened this issue · comments

I need to create a detailed chart to the select event.

Eg.:

chart = GoogleVisualr::Interactive::ColumnChart.new
chart.add_package('table')

@dtelaroli Can you elaborate a bit more. Not sure if I understand what you mean by package?

@winston each chart contains one google visualization package, for exemple:
ColumnChart include de corechart (https://github.com/winston/google_visualr/blob/master/lib/google_visualr/interactive/column_chart.rb#L6)

If I want to include others packages to use on callbacks I can't, because the gem just include one package (https://github.com/winston/google_visualr/blob/master/lib/google_visualr/base_chart.rb#L77).

For example, I want the 'table' package to create a table with data details on chart click.
My workaround was load it manualy outside of the gem:

<script>
      google.load('visualization','1', {packages: ['corechart', 'table'], callback: Chart.init});
</script>

Hmm but if you load another chart with the gem, it would load the appropriate package too right?

It's not possible execute load twice, and the gem allows use chart just once.
My workaround outside of the gem works importing the two packages.

Would it be possible to see some code to get a sense of your use case? Doesn't have to be actual code, but I just want to know how things are being called (especially the new chart within the callback part) Thanks!

I did outside of gem a long time and lost de context with gem.
Thanks.