Module: Nyaplot

Defined in:
lib/mapnya/plot.rb,
lib/mapnya/core.rb,
lib/bionya/plot.rb,
lib/bionya/core.rb,
lib/nyaplot/core.rb,
lib/nyaplot/plot.rb,
lib/nyaplot/data.rb,
lib/nyaplot/base.rb,
lib/nyaplot/color.rb,
lib/nyaplot/frame.rb,
lib/bionya/diagram.rb,
lib/nyaplot3d/core.rb,
lib/nyaplot/version.rb,
lib/nyaplot/diagram.rb,
lib/mapnya/countries.rb,
lib/nyaplot3d/plot3d.rb,
lib/nyaplot/database.rb,
lib/nyaplot3d/diagram.rb

Defined Under Namespace

Modules: Diagrams, Diagrams3D, Jsonizable Classes: CircularPlot, Color, Colors, Countries, DataBase, DataFrame, Diagram, Diagram3D, Frame, MapPlot, Plot, Plot3D, Series

Constant Summary collapse

VERSION =
"0.1.3"
@@dep_libraries =
{d3:'http://d3js.org/d3.v3.min'}
@@additional_libraries =
{}
@@extension_lists =
[]

Class Method Summary collapse

Class Method Details

.add_additional_library(name, url) ⇒ Object

Load extension library to IRuby notebook before Nyaplotjs is loaded



25
26
27
# File 'lib/nyaplot/core.rb', line 25

def self.add_additional_library(name, url)
  @@additional_libraries[name]=url
end

.add_dependency(name, url) ⇒ Object

Load extension library to IRuby notebook after Nyaplotjs is loaded



20
21
22
# File 'lib/nyaplot/core.rb', line 20

def self.add_dependency(name, url)
  @@dep_libraries[name]=url;
end

.add_extension(name) ⇒ Object

Tell JavaScript back-end library to load some extension libraries

Parameters:

  • name (String)

    The name of JavaScript extension library to load



15
16
17
# File 'lib/nyaplot/core.rb', line 15

def self.add_extension(name)
  @@extension_lists.push(name)
end

.extension_listsObject



9
10
11
# File 'lib/nyaplot/core.rb', line 9

def self.extension_lists
  @@extension_lists
end

.generate_init_codeObject

generate initializing code



30
31
32
33
34
35
36
37
# File 'lib/nyaplot/core.rb', line 30

def self.generate_init_code
  path = File.expand_path("../templates/init.js.erb", __FILE__)
  template = File.read(path)
  dep_libraries = @@dep_libraries
  additional_libraries = @@additional_libraries
  js = ERB.new(template).result(binding)
  js
end

.init_irubyObject

Enable to show plots on IRuby notebook



40
41
42
43
# File 'lib/nyaplot/core.rb', line 40

def self.init_iruby
  js = self.generate_init_code
  IRuby.display(IRuby.javascript(js))
end