Skip to content

Commit 4a243d2

Browse files
committed
Bug fix.
1 parent 2235eca commit 4a243d2

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

lib/plotrb/marks.rb

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,36 +63,40 @@ def properties
6363

6464
def enter(&block)
6565
process_from
66+
data = @from[:data] if @from
6667
@properties.merge!(
6768
{ enter: ::Plotrb::Mark::MarkProperty.
68-
new(@type, @from[:data], &block) }
69+
new(@type, data, &block) }
6970
)
7071
self
7172
end
7273

7374
def exit(&block)
7475
process_from
76+
data = @from[:data] if @from
7577
@properties.merge!(
7678
{ exit: ::Plotrb::Mark::MarkProperty.
77-
new(@type, @from[:data], &block) }
79+
new(@type, data, &block) }
7880
)
7981
self
8082
end
8183

8284
def update(&block)
8385
process_from
86+
data = @from[:data] if @from
8487
@properties.merge!(
8588
{ update: ::Plotrb::Mark::MarkProperty.
86-
new(@type, @from[:data], &block) }
89+
new(@type, data, &block) }
8790
)
8891
self
8992
end
9093

9194
def hover(&block)
9295
process_from
96+
data = @from[:data] if @from
9397
@properties.merge!(
9498
{ hover: ::Plotrb::Mark::MarkProperty.
95-
new(@type, @from[:data], &block) }
99+
new(@type, data, &block) }
96100
)
97101
self
98102
end
@@ -139,17 +143,17 @@ def process_from
139143
def process_group
140144
return unless @scales
141145
unless @scales.all? { |s| s.is_a?(::Plotrb::Scale) }
142-
raise ArgumentError, 'Invalid scales fro group mark'
146+
raise ArgumentError, 'Invalid scales for group mark'
143147
end
144148

145149
return unless @axes
146150
unless @axes.all? { |s| s.is_a?(::Plotrb::Axis) }
147-
raise ArgumentError, 'Invalid axes fro group mark'
151+
raise ArgumentError, 'Invalid axes for group mark'
148152
end
149153

150154
return unless @marks
151155
unless @marks.all? { |s| s.is_a?(::Plotrb::Mark) }
152-
raise ArgumentError, 'Invalid marks fro group mark'
156+
raise ArgumentError, 'Invalid marks for group mark'
153157
end
154158
end
155159

@@ -195,7 +199,7 @@ class MarkProperty
195199
add_attributes *VISUAL_PROPERTIES
196200
attr_reader :data
197201

198-
def initialize(type, data, &block)
202+
def initialize(type, data=nil, &block)
199203
define_single_val_attributes *VISUAL_PROPERTIES
200204
self.singleton_class.class_eval {
201205
alias_method :x_start, :x
@@ -222,6 +226,10 @@ def rect
222226
# no additional attributes
223227
end
224228

229+
def group
230+
# no additional attributes
231+
end
232+
225233
def symbol
226234
# @!attribute size
227235
# @return [ValueRef] the pixel area of the symbol

lib/plotrb/scales.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,8 @@ def process_domain
205205
else
206206
# leave as it is
207207
end
208+
when ::Plotrb::Scale::DataRef
209+
# leave as it is
208210
else
209211
raise ArgumentError, 'Unsupported Scale domain type'
210212
end

lib/plotrb/transforms.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def facet
8686
add_attributes(:keys, :sort)
8787
define_multi_val_attributes(:keys, :sort)
8888
self.singleton_class.class_eval { alias_method :group_by, :keys }
89+
@extra_fields.concat([:key])
8990
end
9091

9192
def filter

0 commit comments

Comments
 (0)