module Nyaplot
Public Class Methods
generate_init_code_offline(dependent_js)
click to toggle source
generate initializing code
# File lib/daru/view/adapters/nyaplot/iruby_notebook.rb, line 3 def self.generate_init_code_offline(dependent_js) js_dir = File.expand_path( '../../../../../vendor/assets/javascripts/nyaplot', __dir__ ) path = File.expand_path( '../../templates/nyaplot/init.inline.js.erb', __dir__ ) template = File.read(path) ERB.new(template).result(binding) end
generate_init_code_online()
click to toggle source
generate initializing code
# File lib/daru/view/adapters/nyaplot/iruby_notebook.rb, line 15 def self.generate_init_code_online # TODO : better than present Nyaplot.generate_init_code end
init_iruby(*)
click to toggle source
Enable to show plots on IRuby notebook
# File lib/daru/view/adapters/nyaplot/iruby_notebook.rb, line 20 def self.init_iruby(*) # # dependent_js=['d3.min.js', 'd3-downloadable.js', 'nyaplot.js'] js = generate_init_code IRuby.display(IRuby.javascript(js)) end
init_script()
click to toggle source
dependent JS to include in head tag of the web application
# File lib/daru/view/adapters/nyaplot/display.rb, line 3 def self.init_script init = Nyaplot.generate_init_code path = File.expand_path('../../templates/nyaplot/init_script.erb', __dir__) template = File.read(path) ERB.new(template).result(binding) end