Module: Nyaplot

Defined in:
lib/daru/view/adapters/nyaplot/display.rb,
lib/daru/view/adapters/nyaplot/iruby_notebook.rb

Class Method Summary collapse

Class Method Details

.generate_init_code_offline(dependent_js) ⇒ Object

generate initializing code



3
4
5
6
7
8
# File 'lib/daru/view/adapters/nyaplot/iruby_notebook.rb', line 3

def self.generate_init_code_offline(dependent_js)
  js_dir = File.expand_path('../../js/nyaplot_js', __FILE__)
  path = File.expand_path('../../../templates/nyaplot/init.inline.js.erb', __FILE__)
  template = File.read(path)
  ERB.new(template).result(binding)
end

.generate_init_code_onlineObject

generate initializing code



11
12
13
# File 'lib/daru/view/adapters/nyaplot/iruby_notebook.rb', line 11

def self.generate_init_code_online
  # TODO : better than present Nyaplot.generate_init_code
end

.init_irubyObject

Enable to show plots on IRuby notebook



16
17
18
19
20
21
# File 'lib/daru/view/adapters/nyaplot/iruby_notebook.rb', line 16

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_scriptObject

dependent JS to include in head tag of the web application



3
4
5
6
7
8
# 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', __FILE__)
  template = File.read(path)
  ERB.new(template).result(binding)
end