Class: Nyaplot::Charts::ChartBase

Inherits:
Object
  • Object
show all
Defined in:
lib/nyaplot/charts/base.rb

Direct Known Subclasses

Bar, Line, Scatter

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**opts) ⇒ ChartBase

Returns a new instance of ChartBase.



16
17
18
19
20
21
22
23
24
25
# File 'lib/nyaplot/charts/base.rb', line 16

def initialize(**opts)
  @glyphs = []
  @deps = []

  @@needs.each do |sym|
    raise "lack argument " + sym.to_s if opts[sym].nil?
  end
  
  create(**opts)
end

Instance Attribute Details

#depsObject (readonly)

Returns the value of attribute deps.



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

def deps
  @deps
end

#glyphsObject (readonly)

Returns the value of attribute glyphs.



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

def glyphs
  @glyphs
end

#xdomainObject (readonly)

Returns the value of attribute xdomain.



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

def xdomain
  @xdomain
end

#ydomainObject (readonly)

Returns the value of attribute ydomain.



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

def ydomain
  @ydomain
end

Class Method Details

.allow(x, y) ⇒ Object



5
6
7
8
# File 'lib/nyaplot/charts/base.rb', line 5

def allow(x, y)
  @@allow_x = x
  @@allow_y = y
end

.need(*args) ⇒ Object



10
11
12
# File 'lib/nyaplot/charts/base.rb', line 10

def need(*args)
  @@needs = args
end

Instance Method Details

#createObject



27
28
29
# File 'lib/nyaplot/charts/base.rb', line 27

def create
  ## over-write this
end