rubyvis 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (78) hide show
  1. data.tar.gz.sig +0 -0
  2. data/History.txt +8 -0
  3. data/Manifest.txt +45 -36
  4. data/examples/{first_rbp_api.rb → 1_basic/1a_bar_rbp_api.rb} +1 -1
  5. data/examples/{first_protovis_api.rb → 1_basic/1b_bar_pv_api.rb} +1 -1
  6. data/examples/{second.rb → 1_basic/2_bar_and_rule.rb} +2 -2
  7. data/examples/{third.rb → 1_basic/3_grouped_bars.rb} +1 -1
  8. data/examples/{area_interpolation.rb → 1_basic/area_interpolation.rb} +1 -1
  9. data/examples/{dot.rb → 1_basic/dot.rb} +1 -1
  10. data/examples/{fixtures → 1_basic/fixtures}/tipsy.gif +0 -0
  11. data/examples/1_basic/grid.rb +29 -0
  12. data/examples/{image.rb → 1_basic/image.rb} +1 -1
  13. data/examples/{line.rb → 1_basic/line.rb} +1 -1
  14. data/examples/{line_interpolation.rb → 1_basic/line_interpolation.rb} +1 -1
  15. data/examples/2_medium/censo_agropecuario/censo_agropecuario_chile_data.rb +53 -0
  16. data/examples/2_medium/censo_agropecuario/census_treemap.rb +63 -0
  17. data/examples/2_medium/censo_agropecuario/create_data.rb +10 -0
  18. data/examples/2_medium/censo_agropecuario/resultset.csv +51 -0
  19. data/examples/{nested_grid.rb → 2_medium/nested_grid.rb} +3 -4
  20. data/examples/{area.rb → 3_pv_conventional/area.rb} +1 -1
  21. data/examples/{bar_column_chart.rb → 3_pv_conventional/bar_column_chart.rb} +1 -1
  22. data/examples/{grouped_charts.rb → 3_pv_conventional/grouped_charts.rb} +1 -1
  23. data/examples/{line_and_step.rb → 3_pv_conventional/line_and_step.rb} +1 -1
  24. data/examples/{pie_and_donut.rb → 3_pv_conventional/pie_and_donut.rb} +1 -1
  25. data/examples/{scatterplot.rb → 3_pv_conventional/scatterplot.rb} +1 -1
  26. data/examples/{stacked_charts.rb → 3_pv_conventional/stacked_charts.rb} +1 -3
  27. data/examples/{antibiotics → 4_pv_custom/antibiotics}/antibiotics_data.rb +0 -0
  28. data/examples/{antibiotics → 4_pv_custom/antibiotics}/antibiotics_scatter.rb +1 -1
  29. data/examples/{antibiotics → 4_pv_custom/antibiotics}/antibiotics_wedge.rb +1 -1
  30. data/examples/{barley → 4_pv_custom/barley}/barley.rb +5 -1
  31. data/examples/{barley → 4_pv_custom/barley}/barley_data.rb +0 -0
  32. data/examples/{cars → 4_pv_custom/cars}/cars.rb +1 -1
  33. data/examples/{cars → 4_pv_custom/cars}/cars_data.rb +0 -0
  34. data/examples/{crimea → 4_pv_custom/crimea}/crimea_data.rb +0 -0
  35. data/examples/{crimea → 4_pv_custom/crimea}/crimea_grouped_bar.rb +1 -1
  36. data/examples/{crimea → 4_pv_custom/crimea}/crimea_line.rb +1 -1
  37. data/examples/{bubble_charts.rb → 5_pv_hierarchies/bubble_charts.rb} +3 -2
  38. data/examples/5_pv_hierarchies/bubble_charts_matrix.rb +64 -0
  39. data/examples/{circle_packing.rb → 5_pv_hierarchies/circle_packing.rb} +4 -4
  40. data/examples/{dendogram.rb → 5_pv_hierarchies/dendogram.rb} +2 -2
  41. data/examples/{icicle.rb → 5_pv_hierarchies/icicle.rb} +2 -2
  42. data/examples/{indent.rb → 5_pv_hierarchies/indent.rb} +2 -2
  43. data/examples/5_pv_hierarchies/node_link_tree.rb +52 -0
  44. data/examples/{sunburst.rb → 5_pv_hierarchies/sunburst.rb} +2 -2
  45. data/examples/5_pv_hierarchies/treemap.rb +48 -0
  46. data/lib/rubyvis.rb +1 -1
  47. data/lib/rubyvis/dom.rb +16 -1
  48. data/lib/rubyvis/internals.rb +2 -2
  49. data/lib/rubyvis/layout.rb +2 -0
  50. data/lib/rubyvis/layout/grid.rb +105 -0
  51. data/lib/rubyvis/layout/pack.rb +53 -54
  52. data/lib/rubyvis/layout/stack.rb +26 -24
  53. data/lib/rubyvis/layout/tree.rb +267 -0
  54. data/lib/rubyvis/layout/treemap.rb +1 -0
  55. data/lib/rubyvis/mark.rb +10 -8
  56. data/lib/rubyvis/mark/area.rb +6 -6
  57. data/lib/rubyvis/mark/dot.rb +1 -1
  58. data/lib/rubyvis/mark/shorcut_methods.rb +29 -2
  59. data/lib/rubyvis/nest.rb +48 -2
  60. data/lib/rubyvis/scale/ordinal.rb +6 -6
  61. data/lib/rubyvis/scale/quantitative.rb +13 -7
  62. data/lib/rubyvis/scene/svg_area.rb +20 -14
  63. data/lib/rubyvis/scene/svg_bar.rb +1 -1
  64. data/lib/rubyvis/scene/svg_scene.rb +0 -1
  65. data/lib/rubyvis/sceneelement.rb +1 -1
  66. data/spec/area_spec.rb +12 -0
  67. data/spec/dom_spec.rb +15 -8
  68. data/spec/layout_stack_spec.rb +70 -0
  69. data/spec/nest_spec.rb +8 -2
  70. data/spec/scale_linear_spec.rb +7 -1
  71. data/spec/scale_ordinal_spec.rb +4 -0
  72. data/spec/spec_helper.rb +1 -1
  73. data/web/build_site.rb +6 -2
  74. data/web/index.haml +2 -2
  75. metadata +61 -68
  76. metadata.gz.sig +0 -0
  77. data/examples/treemap/treemap.rb +0 -29
  78. data/examples/treemap/treemap_data.rb +0 -285
@@ -82,6 +82,7 @@ module Rubyvis
82
82
  end
83
83
  @r[@i[x] % @r.size]
84
84
  end
85
+ alias :[] :scale
85
86
  # Sets or gets the input domain. This method can be invoked several ways:
86
87
  #
87
88
  # <p>1. <tt>domain(values...)</tt>
@@ -115,14 +116,13 @@ module Rubyvis
115
116
  # Sets the range from the given continuous interval. The interval [<i>
116
117
  # min</i>, <i>max</i>] is subdivided into <i>n</i> equispaced bands,
117
118
  # where <i>n</i> is the number of (unique) values in the domain. The first
118
- # and last band are offset from the edge of the range by the distance between
119
- # bands.
120
- #
119
+ # and last band are offset from the edge of the range by the distance between bands.
120
+ #
121
121
  # <p>The band width argument, <tt>band</tt>, is typically in the range [0, 1]
122
122
  # and defaults to 1. This fraction corresponds to the amount of space in the
123
- # range to allocate to the bands, as opposed to padding. A value of 0.5 means
124
- # that the band width will be equal to the padding width. The computed
125
- # absolute band width can be retrieved from the range as
123
+ # range to allocate to the bands, as opposed to padding. A value of 0.5
124
+ # means that the band width will be equal to the padding width.
125
+ # The computed absolute band width can be retrieved from the range as
126
126
  # <tt>scale.range_band</tt>.
127
127
  #
128
128
  # <p>If the band width argument is negative, this method will allocate bands
@@ -102,10 +102,7 @@ module Rubyvis
102
102
  # puts "Segundo #{(@l[j + 1] - @l[j])}"
103
103
  @i[j].call((@f.call(x) - @l[j]) .quo(@l[j + 1] - @l[j]));
104
104
  end
105
- # Alias for scale(x)
106
- def [](x)
107
- scale(x)
108
- end
105
+ alias :[] :scale
109
106
  def transform(forward, inverse)
110
107
  @f=lambda {|x| @n ? -forward.call(-x) : forward.call(x); }
111
108
  @g=lambda {|y| @n ? -inverse.call(-y) : inverse.call(y); }
@@ -417,20 +414,29 @@ module Rubyvis
417
414
  #
418
415
  # This method must be invoked each time after setting the domain.
419
416
  def nice
420
- if (@d.size!=2)
421
- return self;
422
- end
417
+ return self if @d.size!=2
423
418
  start=@d.first
424
419
  _end=@d[@d.size-1]
425
420
  reverse=_end<start
426
421
  min=reverse ? _end : start
427
422
  max = reverse ? start : _end
428
423
  span=max-min
424
+
429
425
  return self if(!span or span.infinite?)
426
+
430
427
  step=10**((Math::log(span).quo(Math::log(10))).round-1)
431
428
  @d=[(min.quo(step)).floor*step, (max.quo(step)).ceil*step]
432
429
  @d.reverse if reverse
433
430
  @l=@d.map {|v| @f.call(v)}
431
+ self
434
432
  end
433
+ def by(f)
434
+ that=self
435
+ lambda {|*args|
436
+ that.scale(f.js_apply(self,args))
437
+ }
438
+ end
439
+
440
+
435
441
  end
436
442
  end
@@ -15,16 +15,17 @@ module Rubyvis
15
15
  # Computes the straight path for the range [i, j]
16
16
  path=lambda {|ii,j|
17
17
  p1 = []
18
- p2 = [];
18
+ p2 = []
19
19
  k=j
20
20
  (ii..k).each {|i|
21
21
  si = scenes[i]
22
22
  sj = scenes[j]
23
23
  pi = "#{si.left},#{si.top}"
24
24
  pj = "#{(sj.left + sj.width)},#{(sj.top + sj.height)}"
25
-
25
+ puts "#{i}:"+pi+","+pj if $DEBUG
26
26
  #/* interpolate */
27
- if (i < k)
27
+
28
+ if (i < k)
28
29
  sk = scenes[i + 1]
29
30
  sl = scenes[j - 1]
30
31
  case (s.interpolate)
@@ -38,8 +39,8 @@ module Rubyvis
38
39
  end
39
40
  end
40
41
 
41
- p1.push(pi);
42
- p2.push(pj);
42
+ p1.push(pi)
43
+ p2.push(pj)
43
44
  j=j-1
44
45
  }
45
46
  (p1+p2).join("L");
@@ -82,17 +83,21 @@ module Rubyvis
82
83
  i=0
83
84
  # puts "Scenes:#{scenes.size}, interpolation:#{scenes[0].interpolate}"
84
85
 
85
- while(i<scenes.size)
86
-
86
+ while(i < scenes.size)
87
87
  si = scenes[i]
88
- next if (si.width==0 and si.height==0)
89
- j=0
88
+ if (si.width==0 and si.height==0)
89
+ i+=1
90
+ next
91
+ end
90
92
 
91
- j=(i+1).upto(scenes.size-1).find {|jj|
92
- sj=scenes[jj]
93
- si.width==0 and si.height==0
94
- }
95
- j||=scenes.size
93
+ j=i+1
94
+ while(j<scenes.size) do
95
+ sj=scenes[j]
96
+ break if sj.width==0 and sj.height==0
97
+ j+=1
98
+ end
99
+
100
+ puts "j:#{j}" if $DEBUG
96
101
 
97
102
  i=i-1 if (i!=0 and (s.interpolate != "step-after"))
98
103
 
@@ -104,6 +109,7 @@ module Rubyvis
104
109
  i+=1
105
110
 
106
111
  end
112
+
107
113
  return e if d.size==0
108
114
 
109
115
  e = self.expect(e, "path", {
@@ -6,7 +6,7 @@ module Rubyvis
6
6
  next unless s.visible
7
7
  fill=s.fill_style
8
8
  stroke=s.stroke_style
9
- next if(fill.opacity==0.0 and stroke.opacity==0.0)
9
+ next if(fill.opacity==0 and stroke.opacity==0)
10
10
  e=SvgScene.expect(e,'rect', {
11
11
  "shape-rendering"=> s.antialias ? nil : "crispEdges",
12
12
  "pointer-events"=> s.events,
@@ -64,7 +64,6 @@ module Rubyvis
64
64
  if (scenes.size>0 and scenes[0].reverse and scenes.type!='line' and scenes.type!='area')
65
65
  scenes=scenes.reverse
66
66
  end
67
-
68
67
  self.remove_siblings(self.send(scenes.type, scenes))
69
68
  end
70
69
  def self.remove_siblings(e)
@@ -8,7 +8,7 @@ module Rubyvis
8
8
  end
9
9
  include Enumerable
10
10
  attr_accessor :visible
11
- attr_accessor :mark, :type, :child_index, :parent, :parent_index, :target, :defs, :data, :antialias, :line_width, :fill_style, :overflow, :width, :height, :top, :bottom, :left, :right, :title, :reverse, :stroke_style, :transform, :canvas, :_g, :events, :cursor, :children, :id, :segmented, :interpolate, :tension, :name, :text_baseline, :text_align, :text, :font, :text_angle, :text_style, :text_margin, :text_decoration, :text_shadow, :line_join, :eccentricity, :shape_size, :shape, :shape_angle, :shape_radius, :start_angle, :end_angle, :angle, :inner_radius, :outer_radius, :layers, :orient, :offset, :order,:url, :image_width, :image_height, :image, :_id, :nodes, :round, :links, :padding_left, :padding_right, :padding_top, :padding_bottom, :mode, :group, :depth, :breadth, :spacing
11
+ attr_accessor :mark, :type, :child_index, :parent, :parent_index, :target, :defs, :data, :antialias, :line_width, :fill_style, :overflow, :width, :height, :top, :bottom, :left, :right, :title, :reverse, :stroke_style, :transform, :canvas, :_g, :events, :cursor, :children, :id, :segmented, :interpolate, :tension, :name, :text_baseline, :text_align, :text, :font, :text_angle, :text_style, :text_margin, :text_decoration, :text_shadow, :line_join, :eccentricity, :shape_size, :shape, :shape_angle, :shape_radius, :start_angle, :end_angle, :angle, :inner_radius, :outer_radius, :layers, :orient, :offset, :order,:url, :image_width, :image_height, :image, :_id, :nodes, :round, :links, :padding_left, :padding_right, :padding_top, :padding_bottom, :mode, :group, :depth, :breadth, :spacing, :rows, :cols, :_grid
12
12
 
13
13
  def []=(v,i)
14
14
  if v.is_a? Numeric
@@ -15,6 +15,18 @@ describe Rubyvis::Area do
15
15
  left(lambda {index*20}).
16
16
  bottom(0)
17
17
  end
18
+ it "should return correct path with 0 on one value" do
19
+
20
+ @area.data([1,0,2])
21
+ @vis.render
22
+
23
+
24
+ doc=Nokogiri::XML(@vis.to_svg)
25
+ # <svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="200" height="200"><g><path d="M0,180L20,200L20,200L0,200ZM20,200L40,160L40,200L20,200Z" fill="rgb(31,119,180)"/></g></svg>
26
+ doc.at_xpath("//xmlns:path").should have_path_data_close_to "M0,180L20,200L20,200L0,200ZM20,200L40,160L40,200L20,200Z"
27
+ end
28
+
29
+
18
30
  it "should return correct default (linear) path" do
19
31
  @vis.render
20
32
  doc=Nokogiri::XML(@vis.to_svg)
@@ -169,17 +169,24 @@ describe Rubyvis::Dom do
169
169
  end
170
170
 
171
171
  it "method visit_before" do
172
- @n.visit_before {|n,d|
173
- @a.push([n.node_value,d])
174
- }
175
- @a.should eq [[:a, 0], [:b, 1], [:e, 2], [:c, 1], [:d, 2]]
172
+ @n.visit_before {|n,d|
173
+ @a.push([n.node_value,d])
174
+ }
175
+ @a.should eq [[:a, 0], [:b, 1], [:e, 2], [:c, 1], [:d, 2]]
176
176
  end
177
177
 
178
178
  it "method visit_after" do
179
- @n.visit_after {|n,d|
180
- @a.push([n.node_value,d])
181
- }
182
- @a.should eq [[:e, 2], [:b, 1], [:d, 2], [:c, 1], [:a, 0]]
179
+ @n.visit_after {|n,d|
180
+ @a.push([n.node_value,d])
181
+ }
182
+ @a.should eq [[:e, 2], [:b, 1], [:d, 2], [:c, 1], [:a, 0]]
183
+ end
184
+ it "method each_child" do
185
+ @n.append_child(@n5)
186
+ @n.each_child {|d|
187
+ @a.push(d.node_value)
188
+ }
189
+ @a.should eq [:b, :c,:e]
183
190
  end
184
191
  end
185
192
  it "should sort correctly" do
@@ -0,0 +1,70 @@
1
+ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
2
+ describe Rubyvis::Layout::Stack do
3
+ it "should have correct properties" do
4
+ props=[:antialias, :bottom, :canvas, :cursor, :data, :events, :fill_style, :height, :id, :layers, :left, :line_width, :offset, :order, :orient, :overflow, :reverse, :right, :stroke_style, :title, :top, :transform, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
5
+ Rubyvis::Layout::Stack.properties.should==props
6
+ end
7
+ describe "rendered" do
8
+ before do
9
+ @h=200
10
+ @w=200
11
+
12
+ @x=Rubyvis::Scale.linear(0,3).range(0,@w)
13
+ @y=Rubyvis::Scale.linear(0,10).range(0,@h)
14
+
15
+ @vis = Rubyvis.Panel.new.width(@w).height(@h)
16
+ @stack=@vis.add(Rubyvis::Layout::Stack)
17
+ end
18
+
19
+ describe "only with layers()" do
20
+ before do
21
+ x=@x
22
+ y=@y
23
+ @data=[[1,3,2],[2,1,3]]
24
+ @stack.
25
+ layers(@data).
26
+ x(lambda {|d| x.scale(index)}).
27
+ y(lambda {|d| y.scale(d)}).layer.add(Rubyvis::Area)
28
+ @vis.render
29
+ doc=Nokogiri::XML(@vis.to_svg)
30
+ @paths=doc.xpath("//xmlns:path")
31
+ # <svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="200" height="200"><g><g><g><path d="M0,180L66.66666666666666,140L133.33333333333331,160L133.33333333333331,200L66.66666666666666,200L0,200Z" fill="rgb(31,119,180)"/></g><g><path d="M0,140L66.66666666666666,120L133.33333333333331,100L133.33333333333331,160L66.66666666666666,140L0,180Z" fill="rgb(174,199,232)"/></g></g></g></svg>
32
+ end
33
+ it "should return correct number of areas" do
34
+ @paths.size.should eq 2
35
+ end
36
+ it "should return correct path 1" do
37
+ @paths[0].should have_path_data_close_to "M0 180L66.66666666666666 140L133.33333333333331 160L133.33333333333331 200L66.66666666666666 200L0 200Z"
38
+ end
39
+ it "should return correct path 2" do
40
+ @paths[1].should have_path_data_close_to "M0 140L66.66666666666666 120L133.33333333333331 100L133.33333333333331 160L66.66666666666666 140L0 180Z"
41
+ end
42
+ end
43
+ describe "using layers() and values()" do
44
+ before do
45
+ x=@x
46
+ y=@y
47
+ @data=[{:first=>1,:second=>2},{:first=>3,:second=>1},{:first=>2,:second=>3}]
48
+ @stack.
49
+ layers([:first,:second]).
50
+ values(@data).
51
+ x(lambda {|d| x.scale(index)}).
52
+ y(lambda {|d,dd| y.scale(d[dd])}).layer.add(Rubyvis::Area)
53
+ @vis.render
54
+ doc=Nokogiri::XML(@vis.to_svg)
55
+ @paths=doc.xpath("//xmlns:path")
56
+ # <svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="200" height="200"><g><g><g><path d="M0,180L66.66666666666666,140L133.33333333333331,160L133.33333333333331,200L66.66666666666666,200L0,200Z" fill="rgb(31,119,180)"/></g><g><path d="M0,140L66.66666666666666,120L133.33333333333331,100L133.33333333333331,160L66.66666666666666,140L0,180Z" fill="rgb(174,199,232)"/></g></g></g></svg>
57
+ end
58
+ it "should return correct number of areas" do
59
+ @paths.size.should eq 2
60
+ end
61
+ it "should return correct path 1" do
62
+ @paths[0].should have_path_data_close_to "M0 180L66.66666666666666 140L133.33333333333331 160L133.33333333333331 200L66.66666666666666 200L0 200Z"
63
+ end
64
+ it "should return correct path 2" do
65
+ @paths[1].should have_path_data_close_to "M0 140L66.66666666666666 120L133.33333333333331 100L133.33333333333331 160L66.66666666666666 140L0 180Z"
66
+ end
67
+
68
+ end
69
+ end
70
+ end
@@ -6,14 +6,20 @@ describe Rubyvis::Nest do
6
6
  { :year=>2010, :city=>'France',:value=>2},
7
7
  { :year=>2011, :city=>'London',:value=>5},
8
8
  { :year=>2011, :city=>'France',:value=>6},
9
-
10
9
  ]
11
10
  end
12
11
  it "should generate correct map" do
13
- nest = pv.nest(@data).key(lambda {|d| d[:year]}).key(lambda {|d| d[:city]}).map();
12
+ nest = pv.nest(@data).key(lambda {|d| d[:year]}).key(lambda {|d| d[:city]}).map()
13
+
14
14
  expected={2010=>{"London"=>[{:year=>2010, :city=>"London", :value=>1}], "France"=>[{:year=>2010, :city=>"France", :value=>2}]}, 2011=>{"London"=>[{:year=>2011, :city=>"London", :value=>5}], "France"=>[{:year=>2011, :city=>"France", :value=>6}]}}
15
15
  nest.should==expected
16
16
 
17
+ end
18
+ it "should generate correct rollup" do
19
+ nest = pv.nest(@data).key(lambda {|d| d[:year]}).key(lambda {|d| d[:city]}).rollup(lambda {|d| d.map{|dd| dd[:value]}})
20
+ expected={2010=>{"London"=>[1], "France"=>[2]}, 2011=>{"London"=>[5], "France"=>[6]}}
21
+ nest.should==expected
22
+
17
23
  end
18
24
  it "should generate correct entries" do
19
25
  nest = pv.nest(@data).key(lambda {|d| d[:year]}).key(lambda {|d| d[:city]}).entries();
@@ -119,6 +119,12 @@ describe Rubyvis::Scale::Linear do
119
119
  @y.range(0.000001,0.0001)
120
120
  @y.ticks.should==[1.quo(100000), 1.quo(50000), 3.quo(100000), 1.quo(25000), 1.quo(20000), 3.quo(50000), 7.quo(100000), 1.quo(12500), 9.quo(100000), 1.quo(10000)]
121
121
  @y.tick_format.call(0.2).should=='0.20000'
122
-
123
122
  end
123
+ it "should return correct by" do
124
+ by=@y.by(lambda {|v| v.value})
125
+ a=OpenStruct.new({:value=>rand})
126
+ by.call(a).should==@y[a.value]
127
+ end
128
+
129
+
124
130
  end
@@ -62,6 +62,10 @@ describe Rubyvis::Scale::Ordinal do
62
62
  @y.scale(9).should==pv.color('blue')
63
63
  @y.scale(1).should==pv.color('red')
64
64
  end
65
+ it "should return the same using [] and scale()" do
66
+ a=rand()
67
+ @y[a].should==@y.scale(a)
68
+ end
65
69
  it "should returns correct scale with known values" do
66
70
  @y.scale('a').should==pv.color('red')
67
71
  @y.scale('b').should==pv.color('white')
@@ -58,6 +58,6 @@ RSpec::Matchers.define :have_path_data_close_to do |exp|
58
58
  failure_message_for_should do |obs|
59
59
  obs_array=path_scan(obs.attributes["d"].value)
60
60
  exp_array=path_scan(exp)
61
- "#{obs_array} path should be equal to #{exp_array}"
61
+ "\n#{obs_array} path should be equal to \n#{exp_array}"
62
62
  end
63
63
  end
@@ -48,11 +48,15 @@ files.each do |f|
48
48
  source_a=[]
49
49
  previous_example=""
50
50
  next_example=""
51
+ title_obtained=false
51
52
  fp.each do |line|
52
- if line=~/\s*#\s*(.+)/ and !comment
53
+ if line=~/\s*#\s*encoding:/
54
+ next
55
+ elsif line=~/\s*#\s*(.+)/ and !comment
53
56
  t=$1
54
- if t=~ /=\s*(.+)/
57
+ if t=~ /^=\s*(.+)$/ and !title_obtained
55
58
  title=$1
59
+ title_obtained=true
56
60
  else
57
61
  text << t
58
62
  end
@@ -69,8 +69,8 @@
69
69
  %div
70
70
  %h3 Image
71
71
  /[if IE]
72
- %embed{:src=>"examples/first_protovis_api.svg" ,:width=>"150", :height=>"150"}
73
- %object{:data=>"examples/first_protovis_api.svg", :type=>"image/svg+xml", :width=>150,:height=>150}
72
+ %embed{:src=>"examples/1_basic_1a_bar_rbp_api.svg" ,:width=>"150", :height=>"150"}
73
+ %object{:data=>"examples/1_basic_1a_bar_rbp_api.svg", :type=>"image/svg+xml", :width=>150,:height=>150}
74
74
  .examples_div
75
75
  %h2 Examples
76
76
  %p
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubyvis
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 27
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 3
10
- version: 0.3.3
9
+ - 4
10
+ version: 0.3.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Claudio Bustos
@@ -36,27 +36,25 @@ cert_chain:
36
36
  rpP0jjs0
37
37
  -----END CERTIFICATE-----
38
38
 
39
- date: 2010-11-23 00:00:00 -03:00
39
+ date: 2010-12-11 00:00:00 -03:00
40
40
  default_executable:
41
41
  dependencies:
42
42
  - !ruby/object:Gem::Dependency
43
- name: rubyforge
43
+ name: coderay
44
44
  prerelease: false
45
45
  requirement: &id001 !ruby/object:Gem::Requirement
46
46
  none: false
47
47
  requirements:
48
48
  - - ">="
49
49
  - !ruby/object:Gem::Version
50
- hash: 7
50
+ hash: 3
51
51
  segments:
52
- - 2
53
52
  - 0
54
- - 4
55
- version: 2.0.4
53
+ version: "0"
56
54
  type: :development
57
55
  version_requirements: *id001
58
56
  - !ruby/object:Gem::Dependency
59
- name: coderay
57
+ name: haml
60
58
  prerelease: false
61
59
  requirement: &id002 !ruby/object:Gem::Requirement
62
60
  none: false
@@ -70,7 +68,7 @@ dependencies:
70
68
  type: :development
71
69
  version_requirements: *id002
72
70
  - !ruby/object:Gem::Dependency
73
- name: haml
71
+ name: nokogiri
74
72
  prerelease: false
75
73
  requirement: &id003 !ruby/object:Gem::Requirement
76
74
  none: false
@@ -83,24 +81,10 @@ dependencies:
83
81
  version: "0"
84
82
  type: :development
85
83
  version_requirements: *id003
86
- - !ruby/object:Gem::Dependency
87
- name: nokogiri
88
- prerelease: false
89
- requirement: &id004 !ruby/object:Gem::Requirement
90
- none: false
91
- requirements:
92
- - - ">="
93
- - !ruby/object:Gem::Version
94
- hash: 3
95
- segments:
96
- - 0
97
- version: "0"
98
- type: :development
99
- version_requirements: *id004
100
84
  - !ruby/object:Gem::Dependency
101
85
  name: rspec
102
86
  prerelease: false
103
- requirement: &id005 !ruby/object:Gem::Requirement
87
+ requirement: &id004 !ruby/object:Gem::Requirement
104
88
  none: false
105
89
  requirements:
106
90
  - - ">="
@@ -111,23 +95,23 @@ dependencies:
111
95
  - 0
112
96
  version: "2.0"
113
97
  type: :development
114
- version_requirements: *id005
98
+ version_requirements: *id004
115
99
  - !ruby/object:Gem::Dependency
116
100
  name: hoe
117
101
  prerelease: false
118
- requirement: &id006 !ruby/object:Gem::Requirement
102
+ requirement: &id005 !ruby/object:Gem::Requirement
119
103
  none: false
120
104
  requirements:
121
105
  - - ">="
122
106
  - !ruby/object:Gem::Version
123
- hash: 19
107
+ hash: 47
124
108
  segments:
125
109
  - 2
126
- - 7
110
+ - 8
127
111
  - 0
128
- version: 2.7.0
112
+ version: 2.8.0
129
113
  type: :development
130
- version_requirements: *id006
114
+ version_requirements: *id005
131
115
  description: Ruby port of Protovis[http://vis.stanford.edu/protovis/], a great visualization toolkit
132
116
  email:
133
117
  - clbustos_at_gmail.com
@@ -144,42 +128,48 @@ files:
144
128
  - Manifest.txt
145
129
  - README.txt
146
130
  - Rakefile
147
- - examples/antibiotics/antibiotics_data.rb
148
- - examples/antibiotics/antibiotics_scatter.rb
149
- - examples/antibiotics/antibiotics_wedge.rb
150
- - examples/area.rb
151
- - examples/area_interpolation.rb
152
- - examples/bar_column_chart.rb
153
- - examples/barley/barley.rb
154
- - examples/barley/barley_data.rb
155
- - examples/bubble_charts.rb
156
- - examples/cars/cars.rb
157
- - examples/cars/cars_data.rb
158
- - examples/circle_packing.rb
159
- - examples/crimea/crimea_data.rb
160
- - examples/crimea/crimea_grouped_bar.rb
161
- - examples/crimea/crimea_line.rb
162
- - examples/dendogram.rb
163
- - examples/dot.rb
164
- - examples/first_protovis_api.rb
165
- - examples/first_rbp_api.rb
166
- - examples/fixtures/tipsy.gif
167
- - examples/grouped_charts.rb
168
- - examples/icicle.rb
169
- - examples/image.rb
170
- - examples/indent.rb
171
- - examples/line.rb
172
- - examples/line_and_step.rb
173
- - examples/line_interpolation.rb
174
- - examples/nested_grid.rb
175
- - examples/pie_and_donut.rb
176
- - examples/scatterplot.rb
177
- - examples/second.rb
178
- - examples/stacked_charts.rb
179
- - examples/sunburst.rb
180
- - examples/third.rb
181
- - examples/treemap/treemap.rb
182
- - examples/treemap/treemap_data.rb
131
+ - examples/1_basic/1a_bar_rbp_api.rb
132
+ - examples/1_basic/1b_bar_pv_api.rb
133
+ - examples/1_basic/2_bar_and_rule.rb
134
+ - examples/1_basic/3_grouped_bars.rb
135
+ - examples/1_basic/area_interpolation.rb
136
+ - examples/1_basic/dot.rb
137
+ - examples/1_basic/fixtures/tipsy.gif
138
+ - examples/1_basic/grid.rb
139
+ - examples/1_basic/image.rb
140
+ - examples/1_basic/line.rb
141
+ - examples/1_basic/line_interpolation.rb
142
+ - examples/2_medium/censo_agropecuario/censo_agropecuario_chile_data.rb
143
+ - examples/2_medium/censo_agropecuario/census_treemap.rb
144
+ - examples/2_medium/censo_agropecuario/create_data.rb
145
+ - examples/2_medium/censo_agropecuario/resultset.csv
146
+ - examples/2_medium/nested_grid.rb
147
+ - examples/3_pv_conventional/area.rb
148
+ - examples/3_pv_conventional/bar_column_chart.rb
149
+ - examples/3_pv_conventional/grouped_charts.rb
150
+ - examples/3_pv_conventional/line_and_step.rb
151
+ - examples/3_pv_conventional/pie_and_donut.rb
152
+ - examples/3_pv_conventional/scatterplot.rb
153
+ - examples/3_pv_conventional/stacked_charts.rb
154
+ - examples/4_pv_custom/antibiotics/antibiotics_data.rb
155
+ - examples/4_pv_custom/antibiotics/antibiotics_scatter.rb
156
+ - examples/4_pv_custom/antibiotics/antibiotics_wedge.rb
157
+ - examples/4_pv_custom/barley/barley.rb
158
+ - examples/4_pv_custom/barley/barley_data.rb
159
+ - examples/4_pv_custom/cars/cars.rb
160
+ - examples/4_pv_custom/cars/cars_data.rb
161
+ - examples/4_pv_custom/crimea/crimea_data.rb
162
+ - examples/4_pv_custom/crimea/crimea_grouped_bar.rb
163
+ - examples/4_pv_custom/crimea/crimea_line.rb
164
+ - examples/5_pv_hierarchies/bubble_charts.rb
165
+ - examples/5_pv_hierarchies/bubble_charts_matrix.rb
166
+ - examples/5_pv_hierarchies/circle_packing.rb
167
+ - examples/5_pv_hierarchies/dendogram.rb
168
+ - examples/5_pv_hierarchies/icicle.rb
169
+ - examples/5_pv_hierarchies/indent.rb
170
+ - examples/5_pv_hierarchies/node_link_tree.rb
171
+ - examples/5_pv_hierarchies/sunburst.rb
172
+ - examples/5_pv_hierarchies/treemap.rb
183
173
  - lib/rubyvis.rb
184
174
  - lib/rubyvis/color/color.rb
185
175
  - lib/rubyvis/color/colors.rb
@@ -193,12 +183,14 @@ files:
193
183
  - lib/rubyvis/javascript_behaviour.rb
194
184
  - lib/rubyvis/layout.rb
195
185
  - lib/rubyvis/layout/cluster.rb
186
+ - lib/rubyvis/layout/grid.rb
196
187
  - lib/rubyvis/layout/hierarchy.rb
197
188
  - lib/rubyvis/layout/indent.rb
198
189
  - lib/rubyvis/layout/network.rb
199
190
  - lib/rubyvis/layout/pack.rb
200
191
  - lib/rubyvis/layout/partition.rb
201
192
  - lib/rubyvis/layout/stack.rb
193
+ - lib/rubyvis/layout/tree.rb
202
194
  - lib/rubyvis/layout/treemap.rb
203
195
  - lib/rubyvis/mark.rb
204
196
  - lib/rubyvis/mark/anchor.rb
@@ -240,6 +232,7 @@ files:
240
232
  - spec/internal_spec.rb
241
233
  - spec/javascript_behaviour_spec.rb
242
234
  - spec/label_spec.rb
235
+ - spec/layout_stack_spec.rb
243
236
  - spec/line_spec.rb
244
237
  - spec/mark_spec.rb
245
238
  - spec/nest_spec.rb