Class: Nyaplot::Diagram Abstract

Inherits:
Object
  • Object
show all
Includes:
Jsonizable
Defined in:
lib/nyaplot/diagram.rb

Overview

This class is abstract.

extended using a module included in Nyaplot::Diagrams

Diagram

Instance Method Summary collapse

Methods included from Jsonizable

#before_to_json, #get_property, included, #init_properties, #set_property, #to_json

Constructor Details

#initialize(df, type, labels) ⇒ Diagram

Returns a new instance of Diagram.



9
10
11
12
13
14
15
16
17
18
# File 'lib/nyaplot/diagram.rb', line 9

def initialize(df, type, labels)
  init_properties
  mod = Kernel.const_get("Nyaplot").const_get("Diagrams").const_get(type.to_s.capitalize)
  self.extend(mod)
  set_property(:type, type)
  set_property(:options, {})
  set_property(:data, df.name)
  self.process_data(df, labels)
  DataBase.instance.add(df)
end

Instance Method Details

#configure(&block) ⇒ Object



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

def configure(&block)
  self.instance_eval(&block) if block_given?
end

#df_nameString

Returns the name of dataframe from which this diagram is generated.

Returns:

  • (String)

    the name of dataframe from which this diagram is generated



33
34
35
# File 'lib/nyaplot/diagram.rb', line 33

def df_name
  get_property(:data)
end

#xrangeObject



24
25
26
# File 'lib/nyaplot/diagram.rb', line 24

def xrange
  @xrange
end

#yrangeObject



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

def yrange
  @yrange
end