Skip to content

Commit d5c2076

Browse files
committed
Add context, stage, and background
1 parent cc448bb commit d5c2076

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

lib/nyaplot/plot.rb

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ def initialize(df=nil, **opts)
2323
width: 400,
2424
height: 400
2525
}.merge(opts)
26+
27+
wh = {
28+
width: @opts[:width],
29+
height: @opts[:height]
30+
}
2631

2732
@xdomain = nil
2833
@ydomain = nil
@@ -39,6 +44,17 @@ def initialize(df=nil, **opts)
3944
@with_layer
4045

4146
## layers
47+
@stage = ad ::Layers::Stage.new({})
48+
@context = ad ::Layers::Context.new(wh)
49+
@background = ad ::Layers::Background.new(
50+
{
51+
width: wh[:width]+4,
52+
height: wh[:height]+4,
53+
dx: -2,
54+
dy: -2
55+
})
56+
@grid = ad ::Layers::Grid.new(wh)
57+
4258
@xscale = ad ::Layers::Scale.new({type: :linear, range: [0, @opts[:width]]})
4359
@yscale = ad ::Layers::Scale.new({type: :linear, range: [@opts[:height], 0]})
4460

0 commit comments

Comments
 (0)