google_visualr
google_visualr copied to clipboard
How to use in IRuby notebook
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 :
-
Load the JS file when we do
require google_visualr
in iruby notebook . Means load<script src='https://www.google.com/jsapi'></script>
-
When we want to see chart using some method say
chart.show_in_iruby
will generate html code for the chart and usingIRuby.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.