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_html(nonce: nil) ⇒ Object (also: #to_s)
- #to_iruby ⇒ Object
- #to_iruby_mimebundle ⇒ Object
- #to_json ⇒ 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_html(nonce: nil) ⇒ Object Also known as: to_s
21 22 23 |
# File 'lib/vega/base_chart.rb', line 21 def to_html(nonce: nil) Spec.new(spec).to_html(nonce: nonce) end |
#to_iruby ⇒ Object
26 27 28 |
# File 'lib/vega/base_chart.rb', line 26 def to_iruby Spec.new(spec).to_iruby end |
#to_iruby_mimebundle ⇒ Object
31 32 33 |
# File 'lib/vega/base_chart.rb', line 31 def to_iruby_mimebundle(**) [[to_iruby].to_h, {}] end |
#to_json ⇒ Object
35 36 37 |
# File 'lib/vega/base_chart.rb', line 35 def to_json spec.to_json end |