Class: Vega::BaseChart
- Inherits:
-
Object
- Object
- Vega::BaseChart
- Extended by:
- MethodHelpers
- Defined in:
- lib/vega/base_chart.rb
Instance Method Summary collapse
- #embed_options!(value) ⇒ Object
-
#initialize ⇒ BaseChart
constructor
A new instance of BaseChart.
- #to_iruby ⇒ Object
- #to_iruby_mimebundle ⇒ Object
- #to_json ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize ⇒ BaseChart
Returns a new instance of BaseChart.
5 6 7 8 9 10 11 12 13 |
# File 'lib/vega/base_chart.rb', line 5 def initialize @spec = { "$schema": @schema, width: "container", height: "container" # maybe add later # config: {mark: {tooltip: true}} } end |
Instance Method Details
#embed_options!(value) ⇒ Object
15 16 17 18 |
# File 'lib/vega/base_chart.rb', line 15 def (value) (embedOptions: value) self end |
#to_iruby ⇒ Object
25 26 27 |
# File 'lib/vega/base_chart.rb', line 25 def to_iruby Spec.new(spec).to_iruby end |
#to_iruby_mimebundle ⇒ Object
30 31 32 |
# File 'lib/vega/base_chart.rb', line 30 def to_iruby_mimebundle(**) [[to_iruby].to_h, {}] end |
#to_json ⇒ Object
34 35 36 |
# File 'lib/vega/base_chart.rb', line 34 def to_json spec.to_json end |