Sha256: aef312cd6e9c4a7ecc70d21ec23a155e0595a69b0a36ce13742c0c227b65f959

Contents?: true

Size: 767 Bytes

Versions: 3

Compression:

Stored size: 767 Bytes

Contents

module Vega
  class LiteChart < BaseChart
    # https://vega.github.io/vega-lite/docs/spec.html
    scalar_methods \
      :background, :padding, :autosize, :title, :name, :description, :width, :height, :mark, :spec, :repeat

    hash_methods \
      :config, :usermeta, :projection, :datasets, :encoding, :facet, :resolve, :selection, :view

    array_methods \
      :transform, :layer, :hconcat, :vconcat, :concat

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

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

    undef spec
    def spec(*args)
      if args.empty?
        @spec
      else
        dup.spec!(*args)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vega-0.1.3 lib/vega/lite_chart.rb
vega-0.1.2 lib/vega/lite_chart.rb
vega-0.1.1 lib/vega/lite_chart.rb