Skip to content

Commit

Permalink
Version 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
clbustos committed Nov 17, 2010
1 parent 21e4b60 commit 0903ba4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
10 changes: 10 additions & 0 deletions History.txt
@@ -1,3 +1,13 @@
=== 0.3.0 / 2010-11-17
* Network and Hierarchy classes on module Layout implemented. Require testing
* Rubyvis::Layout::Treemap fully operational
* Rubyvis::Dom almost complete, including spec
* Mark.extend changed to Mark.mark_extend, to avoid clashes with ruby extend
* Bug fix: Rubyvis::Dom::Node.sort doesn't set first_child and last_child correctly
* Updated for hoe 1.7.0
* Updated example of coordinate parallels
* New example: treemap/treemap.rb

=== 0.2.2 / 2010-11-13

* Updated to rspec 2. Bug fix: instance_eval raises an error on js_apply
Expand Down
2 changes: 1 addition & 1 deletion lib/rubyvis.rb
Expand Up @@ -26,7 +26,7 @@
module Rubyvis
@document=nil
# Rubyvis version
VERSION = '0.2.2'
VERSION = '0.3.0'
# Protovis API on which current Rubyvis is based
PROTOVIS_API_VERSION='3.3'
# You actually can do it! http://snipplr.com/view/2137/uses-for-infinity-in-ruby/
Expand Down
3 changes: 1 addition & 2 deletions lib/rubyvis/layout/hierarchy.rb
Expand Up @@ -86,8 +86,7 @@ def build_implied(s)
end
nodes.length.times {|i|
n = nodes[i]
n.mid_angle = (orient == "radial") ? mid_angle(n)
: (horizontal ? Math::PI / 2.0 : 0)
n.mid_angle = (orient == "radial") ? mid_angle(n) : (horizontal ? Math::PI / 2.0 : 0)
n.x = x(n)
n.y = y(n)
n.mid_angle+=Math::PI if (n.first_child)
Expand Down
19 changes: 13 additions & 6 deletions spec/dom_spec.rb
Expand Up @@ -9,12 +9,12 @@
:c=>{:ca=>5}
}
dom_map=Rubyvis::Dom.new(map)
nodes= dom_map.nodes

nodes.should be_instance_of Array
nodes.size.should eq 8
ar=nodes.map do |n|
[n.node_name,n.node_value]
root=dom_map.root.sort {|a,b| a.node_name.to_s<=>b.node_name.to_s}
root.nodes.should be_instance_of Array
root.nodes.size.should eq 8
ar=root.nodes.map do |n|
[n.node_name, n.node_value]
end
ar.should eq [[nil, nil], [:a, nil], [:aa, 1], [:ab, nil], [:aba, 2], [:b, 4], [:c, nil], [:ca, 5]]
end
Expand All @@ -30,7 +30,14 @@
nn.size=nn.node_value.to_f
end
}
root.sort(lambda {|a,b| a.size<=>b.size})
root.sort(lambda {|a,b|
if a.size!=b.size
a.size<=>b.size
else
a.node_name.to_s<=>b.node_name.to_s
end

})
ar=[]
root.visit_before {|n,i|
ar.push [n.node_name, n.size]
Expand Down

0 comments on commit 0903ba4

Please sign in to comment.