rubyvis 0.3.3 → 0.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/History.txt +8 -0
- data/Manifest.txt +45 -36
- data/examples/{first_rbp_api.rb → 1_basic/1a_bar_rbp_api.rb} +1 -1
- data/examples/{first_protovis_api.rb → 1_basic/1b_bar_pv_api.rb} +1 -1
- data/examples/{second.rb → 1_basic/2_bar_and_rule.rb} +2 -2
- data/examples/{third.rb → 1_basic/3_grouped_bars.rb} +1 -1
- data/examples/{area_interpolation.rb → 1_basic/area_interpolation.rb} +1 -1
- data/examples/{dot.rb → 1_basic/dot.rb} +1 -1
- data/examples/{fixtures → 1_basic/fixtures}/tipsy.gif +0 -0
- data/examples/1_basic/grid.rb +29 -0
- data/examples/{image.rb → 1_basic/image.rb} +1 -1
- data/examples/{line.rb → 1_basic/line.rb} +1 -1
- data/examples/{line_interpolation.rb → 1_basic/line_interpolation.rb} +1 -1
- data/examples/2_medium/censo_agropecuario/censo_agropecuario_chile_data.rb +53 -0
- data/examples/2_medium/censo_agropecuario/census_treemap.rb +63 -0
- data/examples/2_medium/censo_agropecuario/create_data.rb +10 -0
- data/examples/2_medium/censo_agropecuario/resultset.csv +51 -0
- data/examples/{nested_grid.rb → 2_medium/nested_grid.rb} +3 -4
- data/examples/{area.rb → 3_pv_conventional/area.rb} +1 -1
- data/examples/{bar_column_chart.rb → 3_pv_conventional/bar_column_chart.rb} +1 -1
- data/examples/{grouped_charts.rb → 3_pv_conventional/grouped_charts.rb} +1 -1
- data/examples/{line_and_step.rb → 3_pv_conventional/line_and_step.rb} +1 -1
- data/examples/{pie_and_donut.rb → 3_pv_conventional/pie_and_donut.rb} +1 -1
- data/examples/{scatterplot.rb → 3_pv_conventional/scatterplot.rb} +1 -1
- data/examples/{stacked_charts.rb → 3_pv_conventional/stacked_charts.rb} +1 -3
- data/examples/{antibiotics → 4_pv_custom/antibiotics}/antibiotics_data.rb +0 -0
- data/examples/{antibiotics → 4_pv_custom/antibiotics}/antibiotics_scatter.rb +1 -1
- data/examples/{antibiotics → 4_pv_custom/antibiotics}/antibiotics_wedge.rb +1 -1
- data/examples/{barley → 4_pv_custom/barley}/barley.rb +5 -1
- data/examples/{barley → 4_pv_custom/barley}/barley_data.rb +0 -0
- data/examples/{cars → 4_pv_custom/cars}/cars.rb +1 -1
- data/examples/{cars → 4_pv_custom/cars}/cars_data.rb +0 -0
- data/examples/{crimea → 4_pv_custom/crimea}/crimea_data.rb +0 -0
- data/examples/{crimea → 4_pv_custom/crimea}/crimea_grouped_bar.rb +1 -1
- data/examples/{crimea → 4_pv_custom/crimea}/crimea_line.rb +1 -1
- data/examples/{bubble_charts.rb → 5_pv_hierarchies/bubble_charts.rb} +3 -2
- data/examples/5_pv_hierarchies/bubble_charts_matrix.rb +64 -0
- data/examples/{circle_packing.rb → 5_pv_hierarchies/circle_packing.rb} +4 -4
- data/examples/{dendogram.rb → 5_pv_hierarchies/dendogram.rb} +2 -2
- data/examples/{icicle.rb → 5_pv_hierarchies/icicle.rb} +2 -2
- data/examples/{indent.rb → 5_pv_hierarchies/indent.rb} +2 -2
- data/examples/5_pv_hierarchies/node_link_tree.rb +52 -0
- data/examples/{sunburst.rb → 5_pv_hierarchies/sunburst.rb} +2 -2
- data/examples/5_pv_hierarchies/treemap.rb +48 -0
- data/lib/rubyvis.rb +1 -1
- data/lib/rubyvis/dom.rb +16 -1
- data/lib/rubyvis/internals.rb +2 -2
- data/lib/rubyvis/layout.rb +2 -0
- data/lib/rubyvis/layout/grid.rb +105 -0
- data/lib/rubyvis/layout/pack.rb +53 -54
- data/lib/rubyvis/layout/stack.rb +26 -24
- data/lib/rubyvis/layout/tree.rb +267 -0
- data/lib/rubyvis/layout/treemap.rb +1 -0
- data/lib/rubyvis/mark.rb +10 -8
- data/lib/rubyvis/mark/area.rb +6 -6
- data/lib/rubyvis/mark/dot.rb +1 -1
- data/lib/rubyvis/mark/shorcut_methods.rb +29 -2
- data/lib/rubyvis/nest.rb +48 -2
- data/lib/rubyvis/scale/ordinal.rb +6 -6
- data/lib/rubyvis/scale/quantitative.rb +13 -7
- data/lib/rubyvis/scene/svg_area.rb +20 -14
- data/lib/rubyvis/scene/svg_bar.rb +1 -1
- data/lib/rubyvis/scene/svg_scene.rb +0 -1
- data/lib/rubyvis/sceneelement.rb +1 -1
- data/spec/area_spec.rb +12 -0
- data/spec/dom_spec.rb +15 -8
- data/spec/layout_stack_spec.rb +70 -0
- data/spec/nest_spec.rb +8 -2
- data/spec/scale_linear_spec.rb +7 -1
- data/spec/scale_ordinal_spec.rb +4 -0
- data/spec/spec_helper.rb +1 -1
- data/web/build_site.rb +6 -2
- data/web/index.haml +2 -2
- metadata +61 -68
- metadata.gz.sig +0 -0
- data/examples/treemap/treemap.rb +0 -29
- data/examples/treemap/treemap_data.rb +0 -285
data/lib/rubyvis/internals.rb
CHANGED
@@ -123,8 +123,8 @@ module Rubyvis
|
|
123
123
|
def self.range(*arguments)
|
124
124
|
start, stop, step=arguments
|
125
125
|
if (arguments.size == 1)
|
126
|
-
stop = start
|
127
|
-
start = 0
|
126
|
+
stop = start
|
127
|
+
start = 0
|
128
128
|
end
|
129
129
|
step||= 1
|
130
130
|
raise "range must be finite" if ((stop - start) / step.to_f).infinite?
|
data/lib/rubyvis/layout.rb
CHANGED
@@ -32,8 +32,10 @@ module Rubyvis
|
|
32
32
|
end
|
33
33
|
|
34
34
|
require 'rubyvis/layout/stack'
|
35
|
+
require 'rubyvis/layout/grid'
|
35
36
|
require 'rubyvis/layout/network'
|
36
37
|
require 'rubyvis/layout/hierarchy'
|
38
|
+
require 'rubyvis/layout/tree'
|
37
39
|
require 'rubyvis/layout/treemap'
|
38
40
|
require 'rubyvis/layout/partition'
|
39
41
|
require 'rubyvis/layout/cluster'
|
@@ -0,0 +1,105 @@
|
|
1
|
+
module Rubyvis
|
2
|
+
class Layout
|
3
|
+
# Alias for Rubyvis::Layout::Grid
|
4
|
+
def self.Grid
|
5
|
+
Rubyvis::Layout::Grid
|
6
|
+
end
|
7
|
+
|
8
|
+
# Implements a grid layout with regularly-sized rows and columns. The
|
9
|
+
# number of rows and columns are determined from their respective
|
10
|
+
# properties. For example, the 2×3 array:
|
11
|
+
#
|
12
|
+
# <pre>1 2 3
|
13
|
+
# 4 5 6</pre>
|
14
|
+
#
|
15
|
+
# can be represented using the <tt>rows</tt> property as:
|
16
|
+
#
|
17
|
+
# <pre>[[1, 2, 3], [4, 5, 6]]</pre>
|
18
|
+
#
|
19
|
+
# If your data is in column-major order, you can equivalently use the
|
20
|
+
# <tt>columns</tt> property. If the <tt>rows</tt> property is an array, it
|
21
|
+
# takes priority over the <tt>columns</tt> property. The data is implicitly
|
22
|
+
# transposed, as if the {@link pv.transpose} operator were applied.
|
23
|
+
#
|
24
|
+
# <p>This layout exports a single <tt>cell</tt> mark prototype, which is
|
25
|
+
# intended to be used with a bar, panel, layout, or subclass thereof. The data
|
26
|
+
# property of the cell prototype is defined as the elements in the array. For
|
27
|
+
# example, if the array is a two-dimensional array of values in the range
|
28
|
+
# [0,1], a simple heatmap can be generated as:
|
29
|
+
#
|
30
|
+
# <pre>vis.add(pv.Layout.Grid)
|
31
|
+
# .rows(arrays)
|
32
|
+
# .cell.add(pv.Bar)
|
33
|
+
# .fillStyle(pv.ramp("white", "black"))</pre>
|
34
|
+
#
|
35
|
+
# The grid subdivides the full width and height of the parent panel into equal
|
36
|
+
# rectangles. Note, however, that for large, interactive, or animated heatmaps,
|
37
|
+
# you may see significantly better performance through dynamic {@link pv.Image}
|
38
|
+
# generation.
|
39
|
+
#
|
40
|
+
# <p>For irregular grids using value-based spatial partitioning, see {@link
|
41
|
+
# pv.Layout.Treemap}.
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
class Grid < Layout
|
46
|
+
attr_accessor :_grid
|
47
|
+
attr_accessor :cell
|
48
|
+
@properties=Layout.properties.dup
|
49
|
+
def initialize
|
50
|
+
super
|
51
|
+
@cell=_cell
|
52
|
+
end
|
53
|
+
def _cell
|
54
|
+
that=self
|
55
|
+
m=Rubyvis::Mark.new().
|
56
|
+
data(lambda {that.scene[that.index]._grid}).
|
57
|
+
width(lambda {that.width/that.cols.to_f}).
|
58
|
+
height(lambda {that.height/that.rows.to_f}).
|
59
|
+
left(lambda {(that.width/that.cols.to_f)*(self.index % that.cols)}).
|
60
|
+
top(lambda {(that.height/that.rows.to_f)*(self.index / that.cols).floor})
|
61
|
+
m.parent=self
|
62
|
+
m
|
63
|
+
end
|
64
|
+
private :_cell
|
65
|
+
|
66
|
+
|
67
|
+
##
|
68
|
+
# :attr: rows
|
69
|
+
# The number of rows. This property can also be specified as the data in
|
70
|
+
# row-major order; in this case, the rows property is implicitly set to the
|
71
|
+
# length of the array, and the cols property is set to the length of the first
|
72
|
+
# element in the array.
|
73
|
+
#
|
74
|
+
|
75
|
+
##
|
76
|
+
# :attr: cols
|
77
|
+
#
|
78
|
+
# The number of columns. This property can also be specified as the data in
|
79
|
+
# column-major order; in this case, the cols property is implicitly set to the
|
80
|
+
# length of the array, and the rows property is set to the length of the first
|
81
|
+
# element in the array.
|
82
|
+
#
|
83
|
+
|
84
|
+
attr_accessor_dsl :rows, :cols
|
85
|
+
def self.defaults
|
86
|
+
Rubyvis::Layout::Grid.new.mark_extend(Rubyvis::Layout.defaults).
|
87
|
+
rows(1).
|
88
|
+
cols(1)
|
89
|
+
end
|
90
|
+
def build_implied(s)
|
91
|
+
layout_build_implied(s)
|
92
|
+
r=s.rows
|
93
|
+
c=s.cols
|
94
|
+
r=Rubyvis.transpose(c) if c.is_a? Array
|
95
|
+
if r.is_a? Array
|
96
|
+
s._grid=Rubyvis.blend(r)
|
97
|
+
s.rows=r.size
|
98
|
+
s.cols=r[0] ? r[0].size : 0
|
99
|
+
else
|
100
|
+
s._grid=Rubyvis.repeat([s.data],r*c)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
data/lib/rubyvis/layout/pack.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Rubyvis
|
2
2
|
class Layout
|
3
|
-
# Alias for Rubyvis::Layout::Indent
|
3
|
+
# Alias for Rubyvis::Layout::Indent
|
4
4
|
def self.Pack
|
5
5
|
Rubyvis::Layout::Pack
|
6
6
|
end
|
@@ -37,7 +37,7 @@ module Rubyvis
|
|
37
37
|
# H. Wang, G. Dai, and H. Wang, ACM CHI 2006.
|
38
38
|
#/
|
39
39
|
class Pack < Hierarchy
|
40
|
-
@properties=Hierarchy.properties.dup
|
40
|
+
@properties=Hierarchy.properties.dup
|
41
41
|
def initialize
|
42
42
|
super
|
43
43
|
@node.
|
@@ -45,15 +45,15 @@ module Rubyvis
|
|
45
45
|
stroke_style("rgb(31, 119, 180)").
|
46
46
|
fill_style("rgba(31, 119, 180, 0.25)")
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
48
|
+
|
49
|
+
@node_label.text_align("center")
|
50
|
+
|
51
51
|
@link=nil
|
52
|
-
|
52
|
+
|
53
53
|
@radius = lambda { 1 }
|
54
54
|
end
|
55
|
-
|
56
|
-
|
55
|
+
|
56
|
+
|
57
57
|
##
|
58
58
|
# :attr: spacing
|
59
59
|
# The spacing parameter; defaults to 1, which provides a little bit of padding
|
@@ -62,7 +62,7 @@ module Rubyvis
|
|
62
62
|
# nodes as large as possible, with no padding on enclosing circles.
|
63
63
|
#
|
64
64
|
# @type number
|
65
|
-
|
65
|
+
|
66
66
|
##
|
67
67
|
# :attr: order
|
68
68
|
# The sibling node order. The default order is <tt>null</tt>, which means to
|
@@ -73,10 +73,10 @@ module Rubyvis
|
|
73
73
|
# beforehand using the {@link pv.Dom} operator.
|
74
74
|
#
|
75
75
|
# @see pv.Dom.Node#sort
|
76
|
-
|
77
|
-
|
76
|
+
|
77
|
+
|
78
78
|
attr_accessor_dsl :spacing, :order
|
79
|
-
|
79
|
+
|
80
80
|
##
|
81
81
|
# Default properties for circle-packing layouts. The default spacing parameter
|
82
82
|
# is 1 and the default order is "ascending".
|
@@ -86,11 +86,11 @@ module Rubyvis
|
|
86
86
|
spacing(1).
|
87
87
|
order("ascending")
|
88
88
|
end
|
89
|
-
|
90
|
-
|
89
|
+
|
90
|
+
|
91
91
|
# TODO is it possible for spacing to operate in pixel space?
|
92
92
|
# Right now it appears to be multiples of the smallest radius.
|
93
|
-
|
93
|
+
|
94
94
|
##
|
95
95
|
# Specifies the sizing function. By default, a sizing function is disabled and
|
96
96
|
# all nodes are given constant size. The sizing function is invoked for each
|
@@ -109,7 +109,7 @@ module Rubyvis
|
|
109
109
|
# @returns {pv.Layout.Pack} this.
|
110
110
|
def size(f)
|
111
111
|
if f.is_a? Proc
|
112
|
-
@radius=lambda {|*args| Math.sqrt(f.js_apply(self,args))}
|
112
|
+
@radius=lambda {|*args| Math.sqrt(f.js_apply(self,args))}
|
113
113
|
else
|
114
114
|
f=Math.sqrt(f)
|
115
115
|
@radius=lambda {f}
|
@@ -117,7 +117,7 @@ module Rubyvis
|
|
117
117
|
self
|
118
118
|
end
|
119
119
|
## @private Compute the radii of the leaf nodes. #/
|
120
|
-
|
120
|
+
|
121
121
|
def radii(nodes)
|
122
122
|
stack=Mark.stack
|
123
123
|
stack.unshift(nil)
|
@@ -138,7 +138,7 @@ module Rubyvis
|
|
138
138
|
nodes.push(c)
|
139
139
|
c=c.next_sibling
|
140
140
|
end
|
141
|
-
|
141
|
+
|
142
142
|
# Sort.
|
143
143
|
case @s.order
|
144
144
|
when "ascending"
|
@@ -148,7 +148,7 @@ module Rubyvis
|
|
148
148
|
when 'reverse'
|
149
149
|
nodes.reverse
|
150
150
|
end
|
151
|
-
|
151
|
+
|
152
152
|
return pack_circle(nodes)
|
153
153
|
end
|
154
154
|
def bound(n)
|
@@ -164,7 +164,7 @@ module Rubyvis
|
|
164
164
|
b.n = c
|
165
165
|
c._p = b
|
166
166
|
end
|
167
|
-
def splice(a, b)
|
167
|
+
def splice(a, b)
|
168
168
|
a.n = b
|
169
169
|
b._p = a
|
170
170
|
end
|
@@ -174,7 +174,7 @@ module Rubyvis
|
|
174
174
|
dr = a.radius + b.radius
|
175
175
|
(dr * dr - dx * dx - dy * dy) > 0.001 # within epsilon
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
178
|
## @private #/
|
179
179
|
def place(a, b, c)
|
180
180
|
da = b.radius + c.radius
|
@@ -183,20 +183,19 @@ module Rubyvis
|
|
183
183
|
dy = b.y - a.y
|
184
184
|
dc = Math.sqrt(dx * dx + dy * dy)
|
185
185
|
cos = (db * db + dc * dc - da * da) / (2.0 * db * dc)
|
186
|
-
|
187
186
|
theta = Math.acos(cos)
|
188
187
|
x = cos * db
|
189
188
|
h = Math.sin(theta) * db
|
190
|
-
dx
|
191
|
-
dy
|
189
|
+
dx = dx/dc
|
190
|
+
dy = dy/dc
|
192
191
|
c.x = a.x + x * dx + h * dy
|
193
192
|
c.y = a.y + x * dy - h * dx
|
194
193
|
end
|
195
|
-
|
194
|
+
|
196
195
|
# @private #/
|
197
|
-
def transform(n, x, y, k)
|
196
|
+
def transform(n, x, y, k)
|
198
197
|
c=n.first_child
|
199
|
-
while(c) do
|
198
|
+
while(c) do
|
200
199
|
c.x += n.x
|
201
200
|
c.y += n.y
|
202
201
|
transform(c, x, y, k)
|
@@ -207,29 +206,29 @@ module Rubyvis
|
|
207
206
|
n.radius *= k
|
208
207
|
n.mid_angle=0 # Undefined on protovis
|
209
208
|
end
|
210
|
-
|
211
209
|
|
212
|
-
|
210
|
+
|
211
|
+
def pack_circle(nodes)
|
213
212
|
@x_min = Infinity
|
214
213
|
@x_max = -Infinity
|
215
214
|
@y_min = Infinity
|
216
215
|
@y_max = -Infinity
|
217
216
|
a=b=c=j=k=nil
|
218
|
-
|
219
|
-
|
217
|
+
|
218
|
+
|
220
219
|
# Create first node.
|
221
220
|
a = nodes[0];
|
222
221
|
a.x = -a.radius
|
223
222
|
a.y = 0
|
224
223
|
bound(a)
|
225
|
-
|
224
|
+
|
226
225
|
# Create second node. #/
|
227
226
|
if (nodes.size > 1)
|
228
227
|
b = nodes[1]
|
229
228
|
b.x = b.radius
|
230
229
|
b.y = 0
|
231
230
|
bound(b)
|
232
|
-
|
231
|
+
|
233
232
|
# Create third node and build chain.
|
234
233
|
if (nodes.size > 2)
|
235
234
|
c = nodes[2]
|
@@ -239,35 +238,35 @@ module Rubyvis
|
|
239
238
|
a._p = c
|
240
239
|
insert(c, b)
|
241
240
|
b = a.n
|
242
|
-
|
241
|
+
|
243
242
|
# Now iterate through the rest.
|
244
243
|
i=3
|
245
|
-
while(i<nodes.size) do
|
244
|
+
while(i < nodes.size) do
|
246
245
|
c=nodes[i]
|
247
246
|
place(a, b, c)
|
248
|
-
|
247
|
+
|
249
248
|
# Search for the closest intersection. #/
|
250
249
|
isect = 0
|
251
250
|
s1 = 1
|
252
251
|
s2 = 1
|
253
|
-
|
252
|
+
|
254
253
|
j=b.n
|
255
254
|
while(j!=b) do
|
256
|
-
if (intersects(j,c))
|
257
|
-
isect=1
|
258
|
-
break
|
255
|
+
if (intersects(j, c))
|
256
|
+
isect=1
|
257
|
+
break
|
259
258
|
end
|
260
259
|
j=j.n
|
261
260
|
s1+=1
|
262
261
|
end
|
263
|
-
|
262
|
+
|
264
263
|
if isect==1
|
265
264
|
k=a._p
|
266
|
-
while(k!=
|
265
|
+
while(k!=j._p) do
|
267
266
|
if(intersects(k,c))
|
268
|
-
if(s2<s1)
|
267
|
+
if(s2 < s1)
|
269
268
|
isect=-1
|
270
|
-
k
|
269
|
+
j=k
|
271
270
|
end
|
272
271
|
break
|
273
272
|
end
|
@@ -275,10 +274,10 @@ module Rubyvis
|
|
275
274
|
s2+=1
|
276
275
|
end
|
277
276
|
end
|
278
|
-
|
279
|
-
|
277
|
+
|
278
|
+
|
280
279
|
# Update node chain. #/
|
281
|
-
if (isect == 0)
|
280
|
+
if (isect == 0)
|
282
281
|
insert(a, c)
|
283
282
|
b = c
|
284
283
|
bound(c)
|
@@ -293,11 +292,11 @@ module Rubyvis
|
|
293
292
|
end
|
294
293
|
i+=1
|
295
294
|
end
|
296
|
-
|
297
|
-
|
295
|
+
|
296
|
+
|
298
297
|
end
|
299
298
|
end
|
300
|
-
|
299
|
+
|
301
300
|
# Re-center the circles and return the encompassing radius. #/
|
302
301
|
cx = (@x_min + @x_max) / 2.0
|
303
302
|
cy = (@y_min + @y_max) / 2.0
|
@@ -309,20 +308,20 @@ module Rubyvis
|
|
309
308
|
end
|
310
309
|
cr + @s.spacing
|
311
310
|
end
|
312
|
-
|
313
|
-
|
311
|
+
|
312
|
+
|
314
313
|
def build_implied(s)
|
315
314
|
return nil if hierarchy_build_implied(s)
|
316
315
|
@s=s
|
317
316
|
nodes = s.nodes
|
318
317
|
root = nodes[0]
|
319
318
|
radii(nodes)
|
320
|
-
|
319
|
+
|
321
320
|
# Recursively compute the layout. #/
|
322
321
|
root.x = 0
|
323
322
|
root.y = 0
|
324
323
|
root.radius = pack_tree(root)
|
325
|
-
|
324
|
+
|
326
325
|
w = self.width
|
327
326
|
h = self.height
|
328
327
|
k = 1.0 / [2.0 * root.radius / w, 2.0 * root.radius / h].max
|
data/lib/rubyvis/layout/stack.rb
CHANGED
@@ -79,7 +79,10 @@ module Rubyvis
|
|
79
79
|
attr_accessor :_x, :_y, :_values, :prop
|
80
80
|
|
81
81
|
def self.defaults
|
82
|
-
Stack.new.mark_extend(Layout.defaults).
|
82
|
+
Stack.new.mark_extend(Layout.defaults).
|
83
|
+
orient("bottom-left").
|
84
|
+
offset("zero").
|
85
|
+
layers([[]])
|
83
86
|
end
|
84
87
|
|
85
88
|
# Constructs a new, empty stack layout. Layouts are not typically constructed
|
@@ -90,8 +93,8 @@ module Rubyvis
|
|
90
93
|
@none=lambda {nil}
|
91
94
|
@prop = {"t"=> @none, "l"=> @none, "r"=> @none, "b"=> @none, "w"=> @none, "h"=> @none}
|
92
95
|
@values=nil
|
93
|
-
@_x=lambda {
|
94
|
-
@_y=lambda {
|
96
|
+
@_x=lambda {0}
|
97
|
+
@_y=lambda {0}
|
95
98
|
@_values=Rubyvis.identity
|
96
99
|
end
|
97
100
|
def x(f)
|
@@ -123,7 +126,7 @@ module Rubyvis
|
|
123
126
|
|
124
127
|
def build_implied(s)
|
125
128
|
# puts "Build stack" if $DEBUG
|
126
|
-
|
129
|
+
layout_build_implied(s)
|
127
130
|
data = s.layers
|
128
131
|
n = data.size
|
129
132
|
m = nil
|
@@ -149,20 +152,20 @@ module Rubyvis
|
|
149
152
|
stack.unshift(nil)
|
150
153
|
values = []
|
151
154
|
n.times {|i|
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
155
|
+
dy[i] = []
|
156
|
+
y[i] = []
|
157
|
+
o.parent.index = i
|
158
|
+
stack[0] = data[i]
|
159
|
+
values[i] = self._values.js_apply(o.parent, stack)
|
160
|
+
m = values[i].size if (i==0)
|
161
|
+
stack.unshift(nil)
|
162
|
+
m.times {|j|
|
163
|
+
stack[0] = values[i][j]
|
164
|
+
o.index = j
|
165
|
+
x[j] = self._x.js_apply(o, stack) if i==0
|
166
|
+
dy[i][j] = self._y.js_apply(o, stack)
|
167
|
+
}
|
168
|
+
stack.shift()
|
166
169
|
}
|
167
170
|
stack.shift()
|
168
171
|
|
@@ -250,11 +253,11 @@ module Rubyvis
|
|
250
253
|
# Propagate the offset to the other series. */
|
251
254
|
m.times {|j|
|
252
255
|
o = y[_index[0]][j]
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
256
|
+
(1...n).each {|i|
|
257
|
+
|
258
|
+
o += dy[_index[i - 1]][j]
|
259
|
+
y[_index[i]][j] = o
|
260
|
+
}
|
258
261
|
}
|
259
262
|
|
260
263
|
# /* Find the property definitions for dynamic substitution. */
|
@@ -265,7 +268,6 @@ module Rubyvis
|
|
265
268
|
py = orient[0,1]
|
266
269
|
|
267
270
|
@values=values
|
268
|
-
|
269
271
|
@prop.each {|k,v|
|
270
272
|
@prop[k]=@none
|
271
273
|
}
|