Class: Vega::Chart

Inherits:
BaseChart show all
Defined in:
lib/vega/chart.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseChart

#embed_options!, #to_html, #to_iruby, #to_iruby_mimebundle, #to_json

Constructor Details

#initializeChart

Returns a new instance of Chart.



16
17
18
19
# File 'lib/vega/chart.rb', line 16

def initialize
  @schema = "https://vega.github.io/schema/vega/v5.json"
  super()
end

Instance Attribute Details

#specObject (readonly)

Returns the value of attribute spec.



14
15
16
# File 'lib/vega/chart.rb', line 14

def spec
  @spec
end

Instance Method Details

#data!(value) ⇒ Object



21
22
23
24
# File 'lib/vega/chart.rb', line 21

def data!(value)
  (@spec[:data] ||= []) << data_value(value)
  self
end

#to_pdfObject



35
36
37
# File 'lib/vega/chart.rb', line 35

def to_pdf
  export("vg2pdf")
end

#to_pngObject



27
28
29
# File 'lib/vega/chart.rb', line 27

def to_png
  export("vg2png")
end

#to_svgObject



31
32
33
# File 'lib/vega/chart.rb', line 31

def to_svg
  export("vg2svg")
end