Module: GoogleVisualr
- Defined in:
- lib/daru/view/adapters/googlecharts/base_chart.rb,
lib/daru/view/adapters/googlecharts/formatters.rb,
lib/daru/view/adapters/googlecharts/google_visualr.rb,
lib/daru/view/adapters/googlecharts/iruby_notebook.rb,
lib/daru/view/adapters/googlecharts/data_table_iruby.rb
Defined Under Namespace
Classes: BaseChart, DataTable, PatternFormat
Class Method Summary collapse
-
.generate_init_code(dependent_js) ⇒ Object
generate initializing code.
-
.init_iruby(dependent_js = GOOGLECHARTS_DEPENDENCIES_IRUBY) ⇒ Object
Enable to show plots on IRuby notebook.
- .init_script(dependent_js = GOOGLECHARTS_DEPENDENCIES_WEB) ⇒ Object
Class Method Details
.generate_init_code(dependent_js) ⇒ Object
generate initializing code
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/daru/view/adapters/googlecharts/iruby_notebook.rb', line 5 def self.generate_init_code(dependent_js) js_dir = File.( '../../../../../vendor/assets/javascripts/googlecharts', __dir__ ) path = File.( '../../templates/googlecharts/init.inline.js.erb', __dir__ ) template = File.read(path) ERB.new(template).result(binding) end |
.init_iruby(dependent_js = GOOGLECHARTS_DEPENDENCIES_IRUBY) ⇒ Object
Enable to show plots on IRuby notebook
17 18 19 20 |
# File 'lib/daru/view/adapters/googlecharts/iruby_notebook.rb', line 17 def self.init_iruby(dependent_js=GOOGLECHARTS_DEPENDENCIES_IRUBY) js = generate_init_code(dependent_js) IRuby.display(IRuby.javascript(js)) end |
.init_script(dependent_js = GOOGLECHARTS_DEPENDENCIES_WEB) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/daru/view/adapters/googlecharts/google_visualr.rb', line 8 def self.init_script( dependent_js=GOOGLECHARTS_DEPENDENCIES_WEB ) js = '' js << "\n<script type='text/javascript'>" js << GoogleVisualr.generate_init_code(dependent_js) js << "\n</script>" js end |