Module: Nyaplot

Defined in:
lib/mapnya/core.rb,
lib/mapnya/plot.rb,
lib/bionya/core.rb,
lib/bionya/plot.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/nyaplot3d/core.rb,
lib/bionya/diagram.rb,
lib/nyaplot/diagram.rb,
lib/nyaplot/version.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

VERSION =
"0.1.6"
@@dep_libraries =
{
  d3:'https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min',
  downloadable: 'http://cdn.rawgit.com/domitry/d3-downloadable/master/d3-downloadable'
}
@@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



28
29
30
# File 'lib/nyaplot/core.rb', line 28

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



23
24
25
# File 'lib/nyaplot/core.rb', line 23

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



18
19
20
# File 'lib/nyaplot/core.rb', line 18

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

.extension_listsObject



12
13
14
# File 'lib/nyaplot/core.rb', line 12

def self.extension_lists
  @@extension_lists
end

.generate_init_codeObject

generate initializing code



33
34
35
36
37
38
39
40
# File 'lib/nyaplot/core.rb', line 33

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



43
44
45
46
# File 'lib/nyaplot/core.rb', line 43

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