Class: Plot::MarkProxy
- Inherits:
-
Object
- Object
- Plot::MarkProxy
- Defined in:
- lib/plot/mark.rb
Instance Method Summary collapse
- #channel(name, value, **obj) ⇒ Object
-
#initialize(mark, type) ⇒ MarkProxy
constructor
A new instance of MarkProxy.
- #option(name, value) ⇒ Object
- #style(name, value) ⇒ Object
Constructor Details
#initialize(mark, type) ⇒ MarkProxy
Returns a new instance of MarkProxy.
2 3 4 5 |
# File 'lib/plot/mark.rb', line 2 def initialize(mark, type) @mark = mark @mark.type = type end |
Instance Method Details
#channel(name, value, **obj) ⇒ Object
7 8 9 10 11 |
# File 'lib/plot/mark.rb', line 7 def channel(name, value, **obj) # TODO: add checking if option is a channel obj[:value] = value @mark.add_option(name, obj) end |
#option(name, value) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/plot/mark.rb', line 13 def option(name, value) if(value.class == Proc || [:title, :href, :ariaLabel].include?(name)) then raise "A channel should be used in place of option" end @mark.add_option(name, { value: value }) end |
#style(name, value) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/plot/mark.rb', line 20 def style(name, value) if([:fill, :fillOpacity, :stroke, :strokeWidth, :strokeOpacity, :strokeLinejoin, :strokeLinecap, :strokeMiterlimit, :strokeDasharray, :strokeDashoffset, :opacity, :mixBlendMode, :imageFilter, :shapeRendering, :paintOrder, :dx, :dy, :target, :ariaDescription, :ariaHidden, :pointerEvents, :clip, :tip].include? name) then @mark.add_option(name, value) else raise "Not a style option" end end |