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

How to use in IRuby notebook

Shekharrajak opened this issue · comments

I want to use google_visualr in IRuby notebook. I tried some examples and got the string as output. I see that there is render_chart method defined in ViewHelper module. Is there any way to use it in IRuby notebook (It just need the html code of the chart and dependent JS file initially) ?

Ping @winston

I haven't used IRuby notebook before. Can IRuby notebook embed JS? If you got the string as output, you should be pretty close. You just need to make it into JS somehow.

render_chart is a Rails helper method, so don't think you can use it in IRuby.

If you need to load the charts, you can refer to how it is loaded: https://developers.google.com/chart/interactive/docs/basic_load_libs

Hope this helps.

Thanks for reply. Actually we need to things :

  1. Load the JS file when we do require google_visualr in iruby notebook . Means load <script src='https://www.google.com/jsapi'></script>

  2. When we want to see chart using some method say chart.show_in_iruby will generate html code for the chart and using IRuby.display method we can see the chart on iruby.

I can try it and open PR to make google_visualr usable in iruby notebook

I don't think there is need of any other JS apart from this https://www.google.com/jsapi , right ?

I don't think there is need of any other JS apart from this https://www.google.com/jsapi , right ?

Yes. I believe so.