Sha256: 681321eb3f4f98f9abbe0b46a71dbaa0852af6bfd8146a33bb84e8a92e1f050d
Contents?: true
Size: 1013 Bytes
Versions: 5
Compression:
Stored size: 1013 Bytes
Contents
module Vega class BaseChart extend MethodHelpers def initialize @spec = { "$schema": @schema, width: "container", height: "container" # maybe add later # config: {mark: {tooltip: true}} } end def embed_options!(value) usermeta!(embedOptions: value) self end immutable_method :embed_options def to_s Spec.new(spec).to_s end def to_iruby Spec.new(spec).to_iruby end def to_json spec.to_json end private def initialize_dup(*) # dup one-level up @spec = @spec.transform_values(&:dup) super end def data_value(value) value = value.to_a if defined?(Rover::DataFrame) && value.is_a?(Rover::DataFrame) value = value.to_a[0] if defined?(Daru::DataFrame) && value.is_a?(Daru::DataFrame) case value when Array {values: value} when String {url: value} else value end end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
vega-0.2.1 | lib/vega/base_chart.rb |
vega-0.2.0 | lib/vega/base_chart.rb |
vega-0.1.3 | lib/vega/base_chart.rb |
vega-0.1.2 | lib/vega/base_chart.rb |
vega-0.1.1 | lib/vega/base_chart.rb |