Class: Nyaplot::Charts::Scatter

Inherits:
ChartBase show all
Defined in:
lib/nyaplot/charts/scatter.rb

Instance Attribute Summary

Attributes inherited from ChartBase

#deps, #glyphs, #xdomain, #ydomain

Instance Method Summary collapse

Methods inherited from ChartBase

allow, #initialize, need

Constructor Details

This class inherits a constructor from Nyaplot::Charts::ChartBase

Instance Method Details

#create(**opts) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/nyaplot/charts/scatter.rb', line 7

def create(**opts)
  data = opts[:data]
  data_l = ad Layers::Data.new({data: data})
  
  args = {
    data: data_l,
    x: opts[:x],
    y: opts[:y],
    position: opts[:position]
  }

  ag Layers::Scatter.new(args)

  @xdomain = [data[opts[:x]].min, data[opts[:x]].max]
  @ydomain = [data[opts[:y]].min, data[opts[:y]].max]
end