rubyvis 0.3.6 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +16 -0
- data/Manifest.txt +61 -0
- data/README.txt +9 -7
- data/Rakefile +1 -1
- data/lib/rubyvis.rb +3 -17
- data/lib/rubyvis/color/color.rb +11 -13
- data/lib/rubyvis/flatten.rb +5 -7
- data/lib/rubyvis/layout/stack.rb +15 -10
- data/lib/rubyvis/mark.rb +10 -2
- data/lib/rubyvis/mark/area.rb +5 -3
- data/lib/rubyvis/mark/line.rb +4 -3
- data/lib/rubyvis/mark/panel.rb +8 -3
- data/lib/rubyvis/mark/rule.rb +1 -0
- data/lib/rubyvis/scene/svg_area.rb +17 -17
- data/lib/rubyvis/scene/svg_curve.rb +8 -5
- data/lib/rubyvis/scene/svg_line.rb +32 -29
- data/lib/rubyvis/scene/svg_scene.rb +3 -5
- data/lib/rubyvis/scene/svg_wedge.rb +4 -3
- data/lib/rubyvis/vector.rb +104 -0
- data/spec/anchor_spec.rb +29 -0
- data/spec/area_spec.rb +83 -0
- data/spec/bar_spec.rb +3 -0
- data/spec/color_spec.rb +13 -1
- data/spec/dot_spec.rb +41 -0
- data/spec/fixtures/anchor.html +25 -0
- data/spec/fixtures/anchor.svg +1 -0
- data/spec/fixtures/area-segmented.html +29 -0
- data/spec/fixtures/area_interpolation.html +66 -0
- data/spec/fixtures/area_interpolation.svg +1 -0
- data/spec/fixtures/area_segmented.svg +1 -0
- data/spec/fixtures/dot-anchor.html +33 -0
- data/spec/fixtures/dot_anchor.svg +1 -0
- data/spec/fixtures/layers.js +28 -0
- data/spec/fixtures/layout_arc.svg +1 -0
- data/spec/fixtures/layout_cluster.html +39 -0
- data/spec/fixtures/layout_cluster.svg +1 -0
- data/spec/fixtures/layout_cluster_left_group_2.html +39 -0
- data/spec/fixtures/layout_cluster_left_group_2.svg +1 -0
- data/spec/fixtures/layout_grid.html +34 -0
- data/spec/fixtures/layout_grid.svg +1 -0
- data/spec/fixtures/layout_horizon.svg +24 -0
- data/spec/fixtures/layout_indent.html +39 -0
- data/spec/fixtures/layout_indent.svg +1 -0
- data/spec/fixtures/layout_matrix.svg +1 -0
- data/spec/fixtures/layout_pack.html +38 -0
- data/spec/fixtures/layout_pack.svg +1 -0
- data/spec/fixtures/layout_partition_fill.html +40 -0
- data/spec/fixtures/layout_partition_fill.svg +32 -0
- data/spec/fixtures/layout_tree_orient_left.html +36 -0
- data/spec/fixtures/layout_tree_orient_left.svg +1 -0
- data/spec/fixtures/layout_tree_orient_radial_breadth_20.html +39 -0
- data/spec/fixtures/layout_tree_orient_radial_breadth_20.svg +1 -0
- data/spec/fixtures/layout_tree_orient_top.svg +1 -0
- data/spec/fixtures/layout_treemap.svg +1 -0
- data/spec/fixtures/line_interpolation.html +63 -0
- data/spec/fixtures/line_interpolation.svg +1 -0
- data/spec/fixtures/line_interpolation_segmented.html +65 -0
- data/spec/fixtures/line_interpolation_segmented.svg +1 -0
- data/spec/fixtures/protovis-r3.3.js +287 -0
- data/spec/fixtures/rule-anchor.html +33 -0
- data/spec/fixtures/rule_anchor.svg +1 -0
- data/spec/fixtures/stack-expand.html +41 -0
- data/spec/fixtures/stack-silohouette.html +41 -0
- data/spec/fixtures/stack-wiggle.html +41 -0
- data/spec/fixtures/stack_expand.svg +1 -0
- data/spec/fixtures/stack_silohouette.svg +1 -0
- data/spec/fixtures/stack_wiggle.svg +1 -0
- data/spec/fixtures/svgscene.html +26 -0
- data/spec/fixtures/wedge-anchor.html +33 -0
- data/spec/fixtures/wedge-donut.html +35 -0
- data/spec/fixtures/wedge_anchor.svg +1 -0
- data/spec/fixtures/wedge_donut.svg +1 -0
- data/spec/flatten_spec.rb +47 -0
- data/spec/layout_arc_spec.rb +7 -26
- data/spec/layout_cluster_spec.rb +52 -0
- data/spec/layout_grid_spec.rb +40 -0
- data/spec/layout_horizon_spec.rb +6 -25
- data/spec/layout_indent_spec.rb +53 -0
- data/spec/layout_matrix_spec.rb +25 -52
- data/spec/layout_pack_spec.rb +49 -0
- data/spec/layout_partition_spec.rb +45 -0
- data/spec/layout_stack_spec.rb +60 -0
- data/spec/layout_tree_spec.rb +56 -0
- data/spec/layout_treemap_spec.rb +41 -0
- data/spec/line_spec.rb +118 -0
- data/spec/mark_spec.rb +4 -0
- data/spec/panel_spec.rb +12 -1
- data/spec/rule_spec.rb +34 -0
- data/spec/spec_helper.rb +158 -3
- data/spec/vector_spec.rb +36 -0
- data/spec/wedge_spec.rb +66 -0
- metadata +67 -14
- metadata.gz.sig +0 -0
data/spec/anchor_spec.rb
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
|
2
2
|
describe Rubyvis::Anchor do
|
3
|
+
include Rubyvis::GeneralSpec
|
4
|
+
|
5
|
+
it "should have correct properties" do
|
6
|
+
props=[:antialias, :bottom, :cursor, :data, :events, :id, :left, :name, :reverse, :right, :title, :top, :visible].inject({}) {|ac, v| ac[v]=true; ac}
|
7
|
+
Rubyvis::Anchor.properties.should==props
|
8
|
+
end
|
9
|
+
it "should be initialized with an object which respond to parent" do
|
10
|
+
my_mock=mock('mark')
|
11
|
+
my_mock.should_receive(:parent).with(no_args())
|
12
|
+
Rubyvis.Anchor(my_mock)
|
13
|
+
|
14
|
+
end
|
3
15
|
describe "inner anchor data should work fine" do
|
4
16
|
before do
|
5
17
|
w=200
|
@@ -94,6 +106,23 @@ describe Rubyvis::Anchor do
|
|
94
106
|
datas.should==expected
|
95
107
|
end
|
96
108
|
end
|
109
|
+
it "should render equal to protovis 'anchor.html' example" do
|
110
|
+
@vis = Rubyvis::Panel.new()
|
111
|
+
.width(200)
|
112
|
+
.height(200)
|
113
|
+
|
114
|
+
@vis.add(Rubyvis::Bar).
|
115
|
+
fill_style("#ccc").
|
116
|
+
anchor("top").add(Rubyvis::Label).
|
117
|
+
text("top").
|
118
|
+
target.
|
119
|
+
anchor("bottom").
|
120
|
+
add(pv.Label).
|
121
|
+
text("bottom")
|
122
|
+
@vis.render
|
123
|
+
@pv_out=fixture_svg_read("anchor.svg")
|
124
|
+
@vis.to_svg.should have_same_svg_elements(@pv_out)
|
125
|
+
end
|
97
126
|
context "Panel-bar assigment" do
|
98
127
|
before do
|
99
128
|
@h=200
|
data/spec/area_spec.rb
CHANGED
@@ -1,9 +1,92 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
|
2
2
|
describe Rubyvis::Area do
|
3
|
+
include Rubyvis::GeneralSpec
|
3
4
|
it "should have correct properties" do
|
4
5
|
props=[:antialias, :bottom, :cursor, :data, :events, :fill_style, :height, :id, :interpolate, :left, :line_width, :reverse, :right, :segmented, :stroke_style, :tension, :title, :top, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
|
5
6
|
Rubyvis::Area.properties.should==props
|
6
7
|
end
|
8
|
+
it "Rubyvis.Area be the same as Rubyvis::Area" do
|
9
|
+
Rubyvis.Area.should eql Rubyvis::Area
|
10
|
+
end
|
11
|
+
it "should render equal to protovis 'area-segmented.html' test" do
|
12
|
+
data=Rubyvis.range(0, 6, 0.1).map {|x| Math.sin(x)}
|
13
|
+
vis = Rubyvis.Panel.new()
|
14
|
+
.width(500)
|
15
|
+
.height(200)
|
16
|
+
.top(50)
|
17
|
+
.bottom(50)
|
18
|
+
.left(10)
|
19
|
+
.right(10)
|
20
|
+
|
21
|
+
vis.add(Rubyvis::Area)
|
22
|
+
.segmented(true)
|
23
|
+
.data(data)
|
24
|
+
.bottom(0)
|
25
|
+
.left(lambda {self.index / 59.0 * 500})
|
26
|
+
.height(lambda {|d| (d + 1) / 2.0 * 200 + 50})
|
27
|
+
.fill_style(lambda {|d| "hsl(#{(d + 1) * 180.0},50,50)"})
|
28
|
+
vis.render()
|
29
|
+
pv_out=fixture_svg_read("area_segmented.svg")
|
30
|
+
vis.to_svg.should have_same_svg_elements(pv_out)
|
31
|
+
end
|
32
|
+
|
33
|
+
it "should render correctly 'area_interpolation.html' example" do
|
34
|
+
data = pv.range(0, 10, 1).map {|x|
|
35
|
+
OpenStruct.new({:x=>x, :y=>Math.sin(x) + 2})}
|
36
|
+
|
37
|
+
p_w=200
|
38
|
+
p_h=150
|
39
|
+
w = 20+p_w*2
|
40
|
+
h = 20+p_h*4
|
41
|
+
|
42
|
+
p_w=200
|
43
|
+
p_h=150
|
44
|
+
#p data
|
45
|
+
w = 20+p_w*2
|
46
|
+
h = 20+p_h*4
|
47
|
+
|
48
|
+
x = pv.Scale.linear(data, lambda {|d| d.x}).range(0, p_w-30)
|
49
|
+
|
50
|
+
|
51
|
+
y = pv.Scale.linear(data, lambda {|d| d.y}).range(0, p_h-20);
|
52
|
+
color=pv.Colors.category19();
|
53
|
+
interpolations=["linear","step-before","step-after", "basis", "cardinal", "monotone"]
|
54
|
+
|
55
|
+
#/* The root panel. */
|
56
|
+
vis = pv.Panel.new()
|
57
|
+
.width(w)
|
58
|
+
.height(h)
|
59
|
+
.bottom(20)
|
60
|
+
.left(20)
|
61
|
+
.right(10)
|
62
|
+
.top(5)
|
63
|
+
|
64
|
+
interpolations.each_with_index do |inter,i|
|
65
|
+
n=i%2
|
66
|
+
m=(i/2).floor
|
67
|
+
panel=vis.add(Rubyvis::Panel).
|
68
|
+
left(n*(p_w+10)).
|
69
|
+
top(m*(p_h+10)).
|
70
|
+
width(p_w).
|
71
|
+
height(p_h)
|
72
|
+
panel.anchor('top').add(Rubyvis::Label).text(inter)
|
73
|
+
|
74
|
+
panel.add(Rubyvis::Area).data(data).
|
75
|
+
bottom(0).
|
76
|
+
segmented(true).
|
77
|
+
fill_style(lambda {return color[self.index]}).
|
78
|
+
left(lambda {|d| x.scale(d.x)}).
|
79
|
+
height(lambda {|d| y.scale(d.y)}).
|
80
|
+
interpolate(inter)
|
81
|
+
|
82
|
+
end
|
83
|
+
vis.render()
|
84
|
+
pv_out=fixture_svg_read("area_interpolation.svg")
|
85
|
+
vis.to_svg.should have_same_svg_elements(pv_out)
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
|
7
90
|
context "rendered" do
|
8
91
|
before do
|
9
92
|
@h=200
|
data/spec/bar_spec.rb
CHANGED
@@ -4,6 +4,9 @@ require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
|
|
4
4
|
props=[:antialias, :bottom, :cursor, :data, :events, :fill_style, :height, :id, :left, :line_width, :reverse, :right, :stroke_style, :title, :top, :visible, :width].inject({}) {|ac, v| ac[v]=true; ac}
|
5
5
|
Rubyvis::Bar.properties.should==props
|
6
6
|
end
|
7
|
+
it "Rubyvis.Bar be the same as Rubyvis::Bar" do
|
8
|
+
Rubyvis.Bar.should eql Rubyvis::Bar
|
9
|
+
end
|
7
10
|
it "should return correct defaults" do
|
8
11
|
props=Rubyvis::Bar.defaults._properties
|
9
12
|
props.size.should==2
|
data/spec/color_spec.rb
CHANGED
@@ -43,10 +43,16 @@ describe "Rubyvis color methods" do
|
|
43
43
|
end
|
44
44
|
it "should return correct Rubyvis.color hsla" do
|
45
45
|
h,s,l,a=rand(360),rand(100),rand(100), rand()
|
46
|
-
|
47
46
|
Rubyvis.color("hsla(#{h},#{s},#{l},#{a})").should eq Rubyvis::Color::Hsl.new(h,s/100.0,l/100.0, "#{a}".to_f).rgb
|
48
47
|
end
|
49
48
|
end
|
49
|
+
describe Rubyvis::Color::Hsl do
|
50
|
+
it "convert some extreme value" do
|
51
|
+
Rubyvis.color("hsl(96,50,50)").should eq Rubyvis.color("rgb(115,191,64)")
|
52
|
+
Rubyvis.color("hsl(112.5,50.0,50.0)").should eq Rubyvis.color("rgb(80,191,64)")
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
50
56
|
describe Rubyvis::Color::Rgb do
|
51
57
|
before do
|
52
58
|
@r,@g,@b,@a=rand(255),rand(255),rand(255),rand()
|
@@ -74,6 +80,12 @@ describe "Rubyvis color methods" do
|
|
74
80
|
it "return correct alpha()" do
|
75
81
|
@rgb.alpha(0.5).should eq Rubyvis::Color::Rgb.new(@r,@g,@b,0.5)
|
76
82
|
end
|
83
|
+
it "return correct darker()" do
|
84
|
+
Rubyvis.color("red").darker().should eq Rubyvis::Color::Rgb.new(178,0,0,1)
|
85
|
+
end
|
86
|
+
it "return correct brighter()" do
|
87
|
+
Rubyvis.color("rgb(100,110,120)").brighter().should eq Rubyvis::Color::Rgb.new(142,157,171,1)
|
88
|
+
end
|
77
89
|
|
78
90
|
end
|
79
91
|
end
|
data/spec/dot_spec.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__)+"/spec_helper.rb")
|
2
|
+
describe Rubyvis::Dot do
|
3
|
+
include Rubyvis::GeneralSpec
|
4
|
+
it "should have correct properties" do
|
5
|
+
props=[:antialias, :bottom, :cursor, :data, :events, :fill_style, :id, :left, :line_width, :reverse, :right, :shape, :shape_angle, :shape_radius, :shape_size, :stroke_style, :title, :top, :visible].inject({}) {|ac, v| ac[v]=true; ac}
|
6
|
+
|
7
|
+
Rubyvis::Dot.properties.should==props
|
8
|
+
end
|
9
|
+
it "Rubyvis.Dot be the same as Rubyvis::Dot" do
|
10
|
+
Rubyvis.Dot.should eql Rubyvis::Dot
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should render correctly 'dot-anchor' example" do
|
14
|
+
w = 400
|
15
|
+
h = 400
|
16
|
+
|
17
|
+
vis = Rubyvis::Panel.new()
|
18
|
+
.width(w)
|
19
|
+
.height(h)
|
20
|
+
.margin(20)
|
21
|
+
.stroke_style("#ccc");
|
22
|
+
|
23
|
+
dot = vis.add(Rubyvis::Dot)
|
24
|
+
.top(w / 2.0)
|
25
|
+
.left(w / 2.0)
|
26
|
+
.shape_radius(w >> 2)
|
27
|
+
|
28
|
+
dot.anchor("top").add(Rubyvis::Label).text("top");
|
29
|
+
dot.anchor("left").add(Rubyvis::Label).text("left");
|
30
|
+
dot.anchor("right").add(Rubyvis::Label).text("right");
|
31
|
+
dot.anchor("bottom").add(Rubyvis::Label).text("bottom");
|
32
|
+
dot.anchor("center").add(Rubyvis::Label).text("center");
|
33
|
+
|
34
|
+
vis.render()
|
35
|
+
|
36
|
+
pv_out=fixture_svg_read("dot_anchor.svg")
|
37
|
+
vis.to_svg.should have_same_svg_elements(pv_out)
|
38
|
+
end
|
39
|
+
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Anchor</title>
|
4
|
+
<script type="text/javascript" src="protovis-r3.3.js"></script>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<script type="text/javascript+protovis">
|
8
|
+
|
9
|
+
var vis = new pv.Panel()
|
10
|
+
.width(200)
|
11
|
+
.height(200)
|
12
|
+
|
13
|
+
vis.add(pv.Bar)
|
14
|
+
.fillStyle("#ccc")
|
15
|
+
.anchor("top").add(pv.Label)
|
16
|
+
.text("top")
|
17
|
+
.anchorTarget()
|
18
|
+
.anchor("bottom").add(pv.Label)
|
19
|
+
.text("bottom");
|
20
|
+
|
21
|
+
vis.render();
|
22
|
+
|
23
|
+
</script>
|
24
|
+
</body>
|
25
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="200" height="200"><g><rect width="200" height="200" fill="rgb(204,204,204)"/></g><g><text pointer-events="none" y="3" dy="0.71em" transform="translate(100)" fill="rgb(0,0,0)" text-anchor="middle">top</text></g><g><text pointer-events="none" y="-3" transform="translate(100, 200)" fill="rgb(0,0,0)" text-anchor="middle">bottom</text></g></svg>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Segmented Area</title>
|
4
|
+
<script type="text/javascript" src="protovis-r3.3.js"></script>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<script type="text/javascript+protovis">
|
8
|
+
|
9
|
+
var vis = new pv.Panel()
|
10
|
+
.width(500)
|
11
|
+
.height(200)
|
12
|
+
.top(50)
|
13
|
+
.bottom(50)
|
14
|
+
.left(10)
|
15
|
+
.right(10);
|
16
|
+
|
17
|
+
vis.add(pv.Area)
|
18
|
+
.segmented(true)
|
19
|
+
.data(function() pv.range(0, 6, .1).map(Math.sin))
|
20
|
+
.bottom(0)
|
21
|
+
.left(function() this.index / 59 * 500)
|
22
|
+
.height(function(d) (d + 1) / 2 * 200 + 50)
|
23
|
+
.fillStyle(function(d) {console.log((d+1)*180);return "hsl(" + (d + 1) * 180 + ",50,50)"});
|
24
|
+
|
25
|
+
vis.render();
|
26
|
+
|
27
|
+
</script>
|
28
|
+
</body>
|
29
|
+
</html>
|
@@ -0,0 +1,66 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Test: Area interpolation and segmentation</title>
|
4
|
+
<script type="text/javascript" src="protovis-r3.3.js"></script>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<h1>Test: Area interpolation and segmentation</h1>
|
8
|
+
<script type="text/javascript">
|
9
|
+
|
10
|
+
data = pv.range(0, 10, 1).map(function(x) {
|
11
|
+
return {x:x, y:Math.sin(x) + 2};
|
12
|
+
});
|
13
|
+
|
14
|
+
|
15
|
+
p_w=200
|
16
|
+
p_h=150
|
17
|
+
w = 20+p_w*2
|
18
|
+
h = 20+p_h*4
|
19
|
+
|
20
|
+
x = pv.Scale.linear(data, function(d) {return d.x;}).range(0, p_w-30)
|
21
|
+
|
22
|
+
|
23
|
+
y = pv.Scale.linear(data, function(d) {return d.y;}).range(0, p_h-20);
|
24
|
+
|
25
|
+
color=pv.Colors.category19();
|
26
|
+
interpolations=["linear","step-before","step-after", "basis", "cardinal","monotone"]
|
27
|
+
|
28
|
+
vis = new pv.Panel()
|
29
|
+
.width(w)
|
30
|
+
.height(h)
|
31
|
+
.bottom(20)
|
32
|
+
.left(20)
|
33
|
+
.right(10)
|
34
|
+
.top(5)
|
35
|
+
|
36
|
+
for(var i=0; i<interpolations.length;i++) {
|
37
|
+
var inter=interpolations[i];
|
38
|
+
n=i%2
|
39
|
+
m=Math.floor(i/2)
|
40
|
+
panel=vis.add(pv.Panel).
|
41
|
+
left(n*(p_w+10)).
|
42
|
+
top(m*(p_h+10)).
|
43
|
+
width(p_w).
|
44
|
+
height(p_h)
|
45
|
+
|
46
|
+
panel.anchor('top').add(pv.Label).text(inter)
|
47
|
+
|
48
|
+
panel.add(pv.Area).data(data).
|
49
|
+
bottom(0).
|
50
|
+
segmented(true).
|
51
|
+
fillStyle(function() {return color(this.index);}).
|
52
|
+
left(function(d){return x(d.x)}).
|
53
|
+
height(function(d){ return y(d.y)}).
|
54
|
+
interpolate(inter);
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
vis.render()
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
</script>
|
65
|
+
</body>
|
66
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="450" height="645"><g transform="translate(20, 5)"><g><text pointer-events="none" y="3" dy="0.71em" transform="translate(100)" fill="rgb(0,0,0)" text-anchor="middle">linear</text></g><g><path d="M0,86.01536001878696L18.88888888888889,29.86784197156267L18.88888888888889,150L0,150Z" fill="rgb(156,158,222)"/><path d="M18.88888888888889,29.86784197156267L37.77777777777778,25.342093079410418L37.77777777777778,150L18.88888888888889,150Z" fill="rgb(115,117,181)"/><path d="M37.77777777777778,25.342093079410418L56.666666666666664,76.59906600221463L56.666666666666664,150L37.77777777777778,150Z" fill="rgb(74,85,132)"/><path d="M56.666666666666664,76.59906600221463L75.55555555555556,136.51333621839072L75.55555555555556,150L56.666666666666664,150Z" fill="rgb(206,219,156)"/><path d="M75.55555555555556,136.51333621839072L94.44444444444444,150L94.44444444444444,150L75.55555555555556,150Z" fill="rgb(181,207,107)"/><path d="M94.44444444444444,150L113.33333333333333,104.65948086316754L113.33333333333333,150L94.44444444444444,150Z" fill="rgb(140,162,82)"/><path d="M113.33333333333333,104.65948086316754L132.22222222222223,42.177643003780105L132.22222222222223,150L113.33333333333333,150Z" fill="rgb(99,121,57)"/><path d="M132.22222222222223,42.177643003780105L151.11111111111111,20L151.11111111111111,150L132.22222222222223,150Z" fill="rgb(231,203,148)"/><path d="M151.11111111111111,20L170,58.516574552061854L170,150L151.11111111111111,150Z" fill="rgb(231,186,82)"/></g></g><g transform="translate(20, 5)"><g transform="translate(210)"><text pointer-events="none" y="3" dy="0.71em" transform="translate(100)" fill="rgb(0,0,0)" text-anchor="middle">step-before</text></g><g transform="translate(210)"><path d="M0,29.86784197156267L18.88888888888889,29.86784197156267L18.88888888888889,150L0,150Z" fill="rgb(156,158,222)"/><path d="M18.88888888888889,25.342093079410418L37.77777777777778,25.342093079410418L37.77777777777778,150L18.88888888888889,150Z" fill="rgb(115,117,181)"/><path d="M37.77777777777778,76.59906600221463L56.666666666666664,76.59906600221463L56.666666666666664,150L37.77777777777778,150Z" fill="rgb(74,85,132)"/><path d="M56.666666666666664,136.51333621839072L75.55555555555556,136.51333621839072L75.55555555555556,150L56.666666666666664,150Z" fill="rgb(206,219,156)"/><path d="M75.55555555555556,150L94.44444444444444,150L94.44444444444444,150L75.55555555555556,150Z" fill="rgb(181,207,107)"/><path d="M94.44444444444444,104.65948086316754L113.33333333333333,104.65948086316754L113.33333333333333,150L94.44444444444444,150Z" fill="rgb(140,162,82)"/><path d="M113.33333333333333,42.177643003780105L132.22222222222223,42.177643003780105L132.22222222222223,150L113.33333333333333,150Z" fill="rgb(99,121,57)"/><path d="M132.22222222222223,20L151.11111111111111,20L151.11111111111111,150L132.22222222222223,150Z" fill="rgb(231,203,148)"/><path d="M151.11111111111111,58.516574552061854L170,58.516574552061854L170,150L151.11111111111111,150Z" fill="rgb(231,186,82)"/></g></g><g transform="translate(20, 5)"><g transform="translate(0, 160)"><text pointer-events="none" y="3" dy="0.71em" transform="translate(100)" fill="rgb(0,0,0)" text-anchor="middle">step-after</text></g><g transform="translate(0, 160)"><path d="M0,86.01536001878696L18.88888888888889,86.01536001878696L18.88888888888889,150L0,150Z" fill="rgb(156,158,222)"/><path d="M18.88888888888889,29.86784197156267L37.77777777777778,29.86784197156267L37.77777777777778,150L18.88888888888889,150Z" fill="rgb(115,117,181)"/><path d="M37.77777777777778,25.342093079410418L56.666666666666664,25.342093079410418L56.666666666666664,150L37.77777777777778,150Z" fill="rgb(74,85,132)"/><path d="M56.666666666666664,76.59906600221463L75.55555555555556,76.59906600221463L75.55555555555556,150L56.666666666666664,150Z" fill="rgb(206,219,156)"/><path d="M75.55555555555556,136.51333621839072L94.44444444444444,136.51333621839072L94.44444444444444,150L75.55555555555556,150Z" fill="rgb(181,207,107)"/><path d="M94.44444444444444,150L113.33333333333333,150L113.33333333333333,150L94.44444444444444,150Z" fill="rgb(140,162,82)"/><path d="M113.33333333333333,104.65948086316754L132.22222222222223,104.65948086316754L132.22222222222223,150L113.33333333333333,150Z" fill="rgb(99,121,57)"/><path d="M132.22222222222223,42.177643003780105L151.11111111111111,42.177643003780105L151.11111111111111,150L132.22222222222223,150Z" fill="rgb(231,203,148)"/><path d="M151.11111111111111,20L170,20L170,150L151.11111111111111,150Z" fill="rgb(231,186,82)"/></g></g><g transform="translate(20, 5)"><g transform="translate(210, 160)"><text pointer-events="none" y="3" dy="0.71em" transform="translate(100)" fill="rgb(0,0,0)" text-anchor="middle">basis</text></g><g transform="translate(210, 160)"><path d="M0,86.01536001878696C0,86.01536001878696,0,86.01536001878696,3.148148148148148,76.65744034424958C6.296296296296296,67.2995206697122,12.592592592592592,48.58368132063743,18.888888888888886,38.471470164074674L18.888888888888886,150C12.592592592592592,150,6.296296296296296,150,3.148148148148148,150C0,150,0,150,0,150Z" fill="rgb(156,158,222)"/><path d="M18.888888888888886,38.471470164074674C25.185185185185183,28.359259007511916,31.48148148148148,26.850676043461167,37.77777777777777,34.63921338190316L37.77777777777777,150C31.48148148148148,150,25.185185185185183,150,18.888888888888886,150Z" fill="rgb(115,117,181)"/><path d="M37.77777777777777,34.63921338190316C44.07407407407407,42.42775072034515,50.37037037037037,59.513408361279886,56.66666666666666,78.04194888444327L56.666666666666664,150C50.37037037037037,150,44.07407407407407,150,37.77777777777777,150Z" fill="rgb(74,85,132)"/><path d="M56.66666666666666,78.04194888444327C62.962962962962955,96.57048940760666,69.25925925925925,116.54191281299867,75.55555555555554,128.77540181262958L75.55555555555556,150C69.25925925925925,150,62.962962962962955,150,56.666666666666664,150Z" fill="rgb(206,219,156)"/><path d="M75.55555555555554,128.77540181262958C81.85185185185185,141.00889081226046,88.14814814814815,145.50444540613023,94.44444444444444,140.19546951359303L94.44444444444444,150C88.14814814814815,150,81.85185185185185,150,75.55555555555556,150Z" fill="rgb(181,207,107)"/><path d="M94.44444444444444,140.19546951359303C100.74074074074073,134.88649362105585,107.03703703703702,119.7729872421117,113.33333333333331,101.80259440940839L113.33333333333331,150C107.03703703703702,150,100.74074074074073,150,94.44444444444444,150Z" fill="rgb(140,162,82)"/><path d="M113.33333333333331,101.80259440940839C119.62962962962962,83.83220157670506,125.92592592592592,63.00492229024258,132.22222222222223,48.895008813047994L132.22222222222223,150C125.92592592592592,150,119.62962962962962,150,113.33333333333331,150Z" fill="rgb(99,121,57)"/><path d="M132.22222222222223,48.895008813047994C138.51851851851853,34.7850953358534,144.8148148148148,27.3925476679267,151.11111111111111,30.115702925973657L151.11111111111111,150C144.8148148148148,150,138.51851851851853,150,132.22222222222223,150Z" fill="rgb(231,203,148)"/><path d="M151.11111111111111,30.115702925973657C157.4074074074074,32.838858184020616,163.7037037037037,45.67771636804123,166.85185185185185,52.09714546005154C170,58.516574552061854,170,58.516574552061854,170,58.51657455206185L170,150C170,150,170,150,166.85185185185185,150C163.7037037037037,150,157.4074074074074,150,151.11111111111111,150Z" fill="rgb(231,186,82)"/></g></g><g transform="translate(20, 5)"><g transform="translate(0, 320)"><text pointer-events="none" y="3" dy="0.71em" transform="translate(100)" fill="rgb(0,0,0)" text-anchor="middle">cardinal</text></g><g transform="translate(0, 320)"><path d="M0,86.01536001878696Q15.11111111111111,35.93516866550033,18.88888888888889,29.86784197156267L18.88888888888889,150Q15.11111111111111,150,0,150Z" fill="rgb(156,158,222)"/><path d="M18.88888888888889,29.86784197156267C24.555555555555557,20.766851930656188,32.111111111111114,18.33240947481262,37.77777777777778,25.342093079410418L37.77777777777778,150C32.111111111111114,150,24.555555555555557,150,18.88888888888889,150Z" fill="rgb(115,117,181)"/><path d="M37.77777777777778,25.342093079410418C43.44444444444444,32.351776684008215,51,59.92337953136758,56.666666666666664,76.59906600221463L56.666666666666664,150C51,150,43.44444444444444,150,37.77777777777778,150Z" fill="rgb(74,85,132)"/><path d="M56.666666666666664,76.59906600221463C62.33333333333333,93.27475247306168,69.88888888888889,125.50319611872291,75.55555555555556,136.51333621839072L75.55555555555556,150C69.88888888888889,150,62.33333333333333,150,56.666666666666664,150Z" fill="rgb(206,219,156)"/><path d="M75.55555555555556,136.51333621839072C81.22222222222223,147.52347631805853,88.77777777777777,154.77807830328348,94.44444444444444,150L94.44444444444444,150C88.77777777777777,150,81.22222222222223,150,75.55555555555556,150Z" fill="rgb(181,207,107)"/><path d="M94.44444444444444,150C100.11111111111111,145.22192169671652,107.66666666666666,120.83283441260053,113.33333333333333,104.65948086316754L113.33333333333333,150C107.66666666666666,150,100.11111111111111,150,94.44444444444444,150Z" fill="rgb(140,162,82)"/><path d="M113.33333333333333,104.65948086316754C119,88.48612731373456,126.55555555555556,54.87656513325524,132.22222222222223,42.177643003780105L132.22222222222223,150C126.55555555555556,150,119,150,113.33333333333333,150Z" fill="rgb(99,121,57)"/><path d="M132.22222222222223,42.177643003780105C137.88888888888889,29.47872087430497,145.44444444444446,17.54916026775774,151.11111111111111,20L151.11111111111111,150C145.44444444444446,150,137.88888888888889,150,132.22222222222223,150Z" fill="rgb(231,203,148)"/><path d="M151.11111111111111,20Q154.88888888888889,21.633893154828176,170,58.516574552061854L170,150Q154.88888888888889,150,151.11111111111111,150Z" fill="rgb(231,186,82)"/></g></g><g transform="translate(20, 5)"><g transform="translate(210, 320)"><text pointer-events="none" y="3" dy="0.71em" transform="translate(100)" fill="rgb(0,0,0)" text-anchor="middle">monotone</text></g><g transform="translate(210, 320)"><path d="M0,86.01536001878696C0.6401375283298946,84.11254119042535,14.134419165934167,32.57534409732352,18.88888888888889,29.86784197156267L18.88888888888889,150C12.592592592592592,150,6.296296296296297,150,0,150Z" fill="rgb(156,158,222)"/><path d="M18.88888888888889,29.86784197156267C23.64335861184361,27.160339845801815,32.4973197871992,23.02604223830979,37.77777777777778,25.342093079410418L37.77777777777778,150C31.481481481481485,150,25.185185185185187,150,18.88888888888889,150Z" fill="rgb(115,117,181)"/><path d="M37.77777777777778,25.342093079410418C43.058235768356354,27.658143920511048,56.01486837892946,74.68097472776627,56.666666666666664,76.59906600221463L56.666666666666664,150C50.37037037037037,150,44.074074074074076,150,37.77777777777778,150Z" fill="rgb(74,85,132)"/><path d="M56.666666666666664,76.59906600221463C57.31846495440387,78.51715727666299,74.23699163953857,133.95141149267656,75.55555555555556,136.51333621839072L75.55555555555556,150C69.25925925925927,150,62.96296296296296,150,56.666666666666664,150Z" fill="rgb(206,219,156)"/><path d="M75.55555555555556,136.51333621839072C76.87411947157254,139.07526094410488,90.7644869934704,153.10290438591272,94.44444444444444,150L94.44444444444444,150C88.14814814814815,150,81.85185185185185,150,75.55555555555556,150Z" fill="rgb(181,207,107)"/><path d="M94.44444444444444,150C98.12440189541849,146.89709561408728,112.64491316577356,106.62431546796236,113.33333333333333,104.65948086316754L113.33333333333333,150C107.03703703703704,150,100.74074074074073,150,94.44444444444444,150Z" fill="rgb(140,162,82)"/><path d="M113.33333333333333,104.65948086316754C114.0217535008931,102.69464625837273,131.17667655581442,44.52069647446061,132.22222222222223,42.177643003780105L132.22222222222223,150C125.92592592592592,150,119.62962962962962,150,113.33333333333333,150Z" fill="rgb(99,121,57)"/><path d="M132.22222222222223,42.177643003780105C133.26776788863003,39.8345895330996,145.8069891578694,17.705961265706488,151.11111111111111,20L151.11111111111111,150C144.8148148148148,150,138.51851851851853,150,132.22222222222223,150Z" fill="rgb(231,203,148)"/><path d="M151.11111111111111,20C156.41523306435283,22.294038734293512,168.77930988306133,56.027449745907155,170,58.516574552061854L170,150C163.7037037037037,150,157.40740740740742,150,151.11111111111111,150Z" fill="rgb(231,186,82)"/></g></g></svg>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="520" height="300"><g transform="translate(10, 50)"><path d="M0,50L8.474576271186441,40.016658335317175L8.474576271186441,200L0,200Z" fill="rgb(64,191,191)"/><path d="M8.474576271186441,40.016658335317175L16.949152542372882,30.13306692049386L16.949152542372882,200L8.474576271186441,200Z" fill="rgb(64,153,191)"/><path d="M16.949152542372882,30.13306692049386L25.423728813559325,20.447979333866044L25.423728813559325,200L16.949152542372882,200Z" fill="rgb(64,115,191)"/><path d="M25.423728813559325,20.447979333866044L33.898305084745765,11.058165769134945L33.898305084745765,200L25.423728813559325,200Z" fill="rgb(64,78,191)"/><path d="M33.898305084745765,11.058165769134945L42.3728813559322,2.057446139579696L42.3728813559322,200L33.898305084745765,200Z" fill="rgb(85,64,191)"/><path d="M42.3728813559322,2.057446139579696L50.84745762711865,-6.464247339503544L50.84745762711865,200L42.3728813559322,200Z" fill="rgb(120,64,191)"/><path d="M50.84745762711865,-6.464247339503544L59.32203389830509,-14.421768723769105L59.32203389830509,200L50.84745762711865,200Z" fill="rgb(152,64,191)"/><path d="M59.32203389830509,-14.421768723769105L67.79661016949153,-21.735609089952277L67.79661016949153,200L59.32203389830509,200Z" fill="rgb(183,64,191)"/><path d="M67.79661016949153,-21.735609089952277L76.27118644067797,-28.33269096274833L76.27118644067797,200L67.79661016949153,200Z" fill="rgb(191,64,172)"/><path d="M76.27118644067797,-28.33269096274833L84.7457627118644,-34.14709848078965L84.7457627118644,200L76.27118644067797,200Z" fill="rgb(191,64,147)"/><path d="M84.7457627118644,-34.14709848078965L93.22033898305085,-39.120736006143545L93.22033898305085,200L84.7457627118644,200Z" fill="rgb(191,64,124)"/><path d="M93.22033898305085,-39.120736006143545L101.6949152542373,-43.20390859672264L101.6949152542373,200L93.22033898305085,200Z" fill="rgb(191,64,105)"/><path d="M101.6949152542373,-43.20390859672264L110.16949152542372,-46.355818541719316L110.16949152542372,200L101.6949152542373,200Z" fill="rgb(191,64,90)"/><path d="M110.16949152542372,-46.355818541719316L118.64406779661017,-48.54497299884605L118.64406779661017,200L110.16949152542372,200Z" fill="rgb(191,64,78)"/><path d="M118.64406779661017,-48.54497299884605L127.11864406779661,-49.749498660405465L127.11864406779661,200L118.64406779661017,200Z" fill="rgb(191,64,69)"/><path d="M127.11864406779661,-49.749498660405465L135.59322033898306,-49.95736030415051L135.59322033898306,200L127.11864406779661,200Z" fill="rgb(191,64,65)"/><path d="M135.59322033898306,-49.95736030415051L144.0677966101695,-49.166481045246854L144.0677966101695,200L135.59322033898306,200Z" fill="rgb(191,64,64)"/><path d="M144.0677966101695,-49.166481045246854L152.54237288135593,-47.38476308781952L152.54237288135593,200L144.0677966101695,200Z" fill="rgb(191,64,67)"/><path d="M152.54237288135593,-47.38476308781952L161.01694915254237,-44.63000876874145L161.01694915254237,200L152.54237288135593,200Z" fill="rgb(191,64,74)"/><path d="M161.01694915254237,-44.63000876874145L169.4915254237288,-40.92974268256816L169.4915254237288,200L161.01694915254237,200Z" fill="rgb(191,64,84)"/><path d="M169.4915254237288,-40.92974268256816L177.96610169491524,-36.32093666488737L177.96610169491524,200L169.4915254237288,200Z" fill="rgb(191,64,98)"/><path d="M177.96610169491524,-36.32093666488737L186.4406779661017,-30.849640381959006L186.4406779661017,200L177.96610169491524,200Z" fill="rgb(191,64,116)"/><path d="M186.4406779661017,-30.849640381959006L194.91525423728814,-24.570521217671995L194.91525423728814,200L186.4406779661017,200Z" fill="rgb(191,64,137)"/><path d="M194.91525423728814,-24.570521217671995L203.3898305084746,-17.54631805511505L203.3898305084746,200L194.91525423728814,200Z" fill="rgb(191,64,161)"/><path d="M203.3898305084746,-17.54631805511505L211.864406779661,-9.847214410395651L211.864406779661,200L203.3898305084746,200Z" fill="rgb(191,64,188)"/><path d="M211.864406779661,-9.847214410395651L220.33898305084745,-1.5501371821464147L220.33898305084745,200L211.864406779661,200Z" fill="rgb(165,64,191)"/><path d="M220.33898305084745,-1.5501371821464147L228.8135593220339,7.262011976617032L228.8135593220339,200L220.33898305084745,200Z" fill="rgb(133,64,191)"/><path d="M228.8135593220339,7.262011976617032L237.28813559322035,16.50118498440952L237.28813559322035,200L228.8135593220339,200Z" fill="rgb(100,64,191)"/><path d="M237.28813559322035,16.50118498440952L245.76271186440678,26.07506707860182L245.76271186440678,200L237.28813559322035,200Z" fill="rgb(64,64,191)"/><path d="M245.76271186440678,26.07506707860182L254.23728813559322,35.887999194013275L254.23728813559322,200L245.76271186440678,200Z" fill="rgb(64,100,191)"/><path d="M254.23728813559322,35.887999194013275L262.7118644067797,45.841933756670954L262.7118644067797,200L254.23728813559322,200Z" fill="rgb(64,137,191)"/><path d="M262.7118644067797,45.841933756670954L271.1864406779661,55.837414342757995L271.1864406779661,200L262.7118644067797,200Z" fill="rgb(64,175,191)"/><path d="M271.1864406779661,55.837414342757995L279.6610169491525,65.77456941432487L279.6610169491525,200L271.1864406779661,200Z" fill="rgb(64,191,169)"/><path d="M279.6610169491525,65.77456941432487L288.135593220339,75.55411020268316L288.135593220339,200L279.6610169491525,200Z" fill="rgb(64,191,131)"/><path d="M288.135593220339,75.55411020268316L296.6101694915254,85.07832276896198L296.6101694915254,200L288.135593220339,200Z" fill="rgb(64,191,94)"/><path d="M296.6101694915254,85.07832276896198L305.08474576271186,94.25204432948524L305.08474576271186,200L296.6101694915254,200Z" fill="rgb(70,191,64)"/><path d="M305.08474576271186,94.25204432948524L313.5593220338983,102.98361409084934L313.5593220338983,200L305.08474576271186,200Z" fill="rgb(106,191,64)"/><path d="M313.5593220338983,102.98361409084934L322.03389830508473,111.18578909427193L322.03389830508473,200L313.5593220338983,200Z" fill="rgb(139,191,64)"/><path d="M322.03389830508473,111.18578909427193L330.50847457627117,118.77661591839741L330.50847457627117,200L322.03389830508473,200Z" fill="rgb(170,191,64)"/><path d="M330.50847457627117,118.77661591839741L338.9830508474576,125.68024953079282L338.9830508474576,200L330.50847457627117,200Z" fill="rgb(191,183,64)"/><path d="M338.9830508474576,125.68024953079282L347.4576271186441,131.8277111064411L347.4576271186441,200L338.9830508474576,200Z" fill="rgb(191,157,64)"/><path d="M347.4576271186441,131.8277111064411L355.9322033898305,137.1575772413588L355.9322033898305,200L347.4576271186441,200Z" fill="rgb(191,133,64)"/><path d="M355.9322033898305,137.1575772413588L364.4067796610169,141.61659367494548L364.4067796610169,200L355.9322033898305,200Z" fill="rgb(191,113,64)"/><path d="M364.4067796610169,141.61659367494548L372.8813559322034,145.16020738895162L372.8813559322034,200L364.4067796610169,200Z" fill="rgb(191,96,64)"/><path d="M372.8813559322034,145.16020738895162L381.35593220338984,147.7530117665097L381.35593220338984,200L372.8813559322034,200Z" fill="rgb(191,82,64)"/><path d="M381.35593220338984,147.7530117665097L389.8305084745763,149.36910036334646L389.8305084745763,200L381.35593220338984,200Z" fill="rgb(191,72,64)"/><path d="M389.8305084745763,149.36910036334646L398.3050847457627,149.99232575641008L398.3050847457627,200L389.8305084745763,200Z" fill="rgb(191,66,64)"/><path d="M398.3050847457627,149.99232575641008L406.7796610169492,149.61646088358407L406.7796610169492,200L398.3050847457627,200Z" fill="rgb(191,64,64)"/><path d="M406.7796610169492,149.61646088358407L415.2542372881356,148.24526126243325L415.2542372881356,200L406.7796610169492,200Z" fill="rgb(191,65,64)"/><path d="M415.2542372881356,148.24526126243325L423.728813559322,145.89242746631385L423.728813559322,200L415.2542372881356,200Z" fill="rgb(191,70,64)"/><path d="M423.728813559322,145.89242746631385L432.2033898305085,142.5814682327732L432.2033898305085,200L423.728813559322,200Z" fill="rgb(191,79,64)"/><path d="M432.2033898305085,142.5814682327732L440.6779661016949,138.3454655720153L440.6779661016949,200L432.2033898305085,200Z" fill="rgb(191,92,64)"/><path d="M440.6779661016949,138.3454655720153L449.1525423728814,133.2267442223901L449.1525423728814,200L440.6779661016949,200Z" fill="rgb(191,108,64)"/><path d="M449.1525423728814,133.2267442223901L457.6271186440678,127.27644875559872L457.6271186440678,200L449.1525423728814,200Z" fill="rgb(191,128,64)"/><path d="M457.6271186440678,127.27644875559872L466.1016949152542,120.55403255703919L466.1016949152542,200L457.6271186440678,200Z" fill="rgb(191,151,64)"/><path d="M466.1016949152542,120.55403255703919L474.5762711864407,113.12666378723208L474.5762711864407,200L466.1016949152542,200Z" fill="rgb(191,176,64)"/><path d="M474.5762711864407,113.12666378723208L483.0508474576271,105.06855425976376L483.0508474576271,200L474.5762711864407,200Z" fill="rgb(178,191,64)"/><path d="M483.0508474576271,105.06855425976376L491.52542372881356,96.46021794137566L491.52542372881356,200L483.0508474576271,200Z" fill="rgb(147,191,64)"/><path d="M491.52542372881356,96.46021794137566L500,87.38766648302361L500,200L491.52542372881356,200Z" fill="rgb(114,191,64)"/></g></svg>
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Scatterplot</title>
|
4
|
+
<script type="text/javascript" src="protovis-d3.3.js"></script>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<script type="text/javascript+protovis">
|
8
|
+
|
9
|
+
var w = 400,
|
10
|
+
h = 400;
|
11
|
+
|
12
|
+
var vis = new pv.Panel()
|
13
|
+
.width(w)
|
14
|
+
.height(h)
|
15
|
+
.margin(20)
|
16
|
+
.strokeStyle("#ccc");
|
17
|
+
|
18
|
+
var dot = vis.add(pv.Dot)
|
19
|
+
.top(w / 2)
|
20
|
+
.left(w / 2)
|
21
|
+
.shapeRadius(w >> 2);
|
22
|
+
|
23
|
+
dot.anchor("top").add(pv.Label).text("top");
|
24
|
+
dot.anchor("left").add(pv.Label).text("left");
|
25
|
+
dot.anchor("right").add(pv.Label).text("right");
|
26
|
+
dot.anchor("bottom").add(pv.Label).text("bottom");
|
27
|
+
dot.anchor("center").add(pv.Label).text("center");
|
28
|
+
|
29
|
+
vis.render();
|
30
|
+
|
31
|
+
</script>
|
32
|
+
</body>
|
33
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="440" height="440"><g transform="translate(20, 20)"><circle stroke="rgb(31,119,180)" cx="200" cy="200" r="100"/></g><g transform="translate(20, 20)"><text pointer-events="none" y="-3" transform="translate(200, 100)" fill="rgb(0,0,0)" text-anchor="middle">top</text></g><g transform="translate(20, 20)"><text pointer-events="none" x="-3" dy="0.35em" transform="translate(100, 200)" fill="rgb(0,0,0)" text-anchor="end">left</text></g><g transform="translate(20, 20)"><text pointer-events="none" x="3" dy="0.35em" transform="translate(300, 200)" fill="rgb(0,0,0)">right</text></g><g transform="translate(20, 20)"><text pointer-events="none" y="3" dy="0.71em" transform="translate(200, 300)" fill="rgb(0,0,0)" text-anchor="middle">bottom</text></g><g transform="translate(20, 20)"><text pointer-events="none" dy="0.35em" transform="translate(200, 200)" fill="rgb(0,0,0)" text-anchor="middle">center</text></g><rect x="20" y="20" width="400" height="400" stroke="rgb(204,204,204)"/></svg>
|
@@ -0,0 +1,28 @@
|
|
1
|
+
/* Inspired by Lee Byron's test data generator. */
|
2
|
+
function layers(n, m) {
|
3
|
+
function bump(a) {
|
4
|
+
var x = 1 / (.1 + Math.sin(n)),
|
5
|
+
y = 2 * Math.cos(m) - .5,
|
6
|
+
z = 10 / (.1 + Math.sin(x));
|
7
|
+
for (var i = 0; i < m; i++) {
|
8
|
+
var w = (i / m - y) * z;
|
9
|
+
a[i] += x * Math.exp(-w * w);
|
10
|
+
}
|
11
|
+
}
|
12
|
+
return pv.range(n).map(function() {
|
13
|
+
var a = [], i;
|
14
|
+
for (i = 0; i < m; i++) a[i] = 0;
|
15
|
+
for (i = 0; i < 5; i++) bump(a);
|
16
|
+
return a;
|
17
|
+
});
|
18
|
+
}
|
19
|
+
|
20
|
+
/* Another layer generator using gamma distributions. */
|
21
|
+
function waves(n, m) {
|
22
|
+
return pv.range(n).map(function(i) {
|
23
|
+
return pv.range(m).map(function(j) {
|
24
|
+
var x = 20 * j / m - i / 3;
|
25
|
+
return x > 0 ? 2 * x * Math.exp(-.5 * x) : 0;
|
26
|
+
});
|
27
|
+
});
|
28
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg font-size="10px" font-family="sans-serif" fill="none" stroke="none" stroke-width="1.5" width="300" height="150"><g><g><g><path shape-rendering="crispEdges" d="M25,100A25,25 0 0,1 75,100" stroke="rgb(0,0,0)" stroke-opacity="0.2" stroke-width="1"/></g><g><path shape-rendering="crispEdges" d="M75,100A25,25 0 0,1 125,100" stroke="rgb(0,0,0)" stroke-opacity="0.2" stroke-width="1"/></g><g><path shape-rendering="crispEdges" d="M125,100A25,25 0 0,1 175,100" stroke="rgb(0,0,0)" stroke-opacity="0.2" stroke-width="1"/></g><g><path shape-rendering="crispEdges" d="M175,100A25,25 0 0,1 225,100" stroke="rgb(0,0,0)" stroke-opacity="0.2" stroke-width="1"/></g><g><path shape-rendering="crispEdges" d="M225,100A25,25 0 0,1 275,100" stroke="rgb(0,0,0)" stroke-opacity="0.2" stroke-width="1"/></g><g><path shape-rendering="crispEdges" d="M25,100A25,25 0 0,1 75,100" stroke="rgb(0,0,0)" stroke-opacity="0.2" stroke-width="1"/></g><g><path shape-rendering="crispEdges" d="M75,100A25,25 0 0,1 125,100" stroke="rgb(0,0,0)" stroke-opacity="0.2" stroke-width="1"/></g><g><path shape-rendering="crispEdges" d="M125,100A25,25 0 0,1 175,100" stroke="rgb(0,0,0)" stroke-opacity="0.2" stroke-width="1"/></g><g><path shape-rendering="crispEdges" d="M175,100A25,25 0 0,1 225,100" stroke="rgb(0,0,0)" stroke-opacity="0.2" stroke-width="1"/></g><g><path shape-rendering="crispEdges" d="M225,100A25,25 0 0,1 275,100" stroke="rgb(0,0,0)" stroke-opacity="0.2" stroke-width="1"/></g></g><g><circle fill="rgb(156,158,222)" stroke="rgb(31,119,180)" cx="25" cy="100" r="3.1622776601683795"/><circle fill="rgb(156,158,222)" stroke="rgb(31,119,180)" cx="75" cy="100" r="3.1622776601683795"/><circle fill="rgb(115,117,181)" stroke="rgb(31,119,180)" cx="125" cy="100" r="3.1622776601683795"/><circle fill="rgb(115,117,181)" stroke="rgb(31,119,180)" cx="175" cy="100" r="3.1622776601683795"/><circle fill="rgb(74,85,132)" stroke="rgb(31,119,180)" cx="225" cy="100" r="3.1622776601683795"/><circle fill="rgb(74,85,132)" stroke="rgb(31,119,180)" cx="275" cy="100" r="3.1622776601683795"/></g><g><text pointer-events="none" x="-7" dy="0.35em" transform="translate(25, 100) rotate(270)" fill="rgb(156,158,222)" text-anchor="end">A</text><text pointer-events="none" x="-7" dy="0.35em" transform="translate(75, 100) rotate(270)" fill="rgb(156,158,222)" text-anchor="end">B</text><text pointer-events="none" x="-7" dy="0.35em" transform="translate(125, 100) rotate(270)" fill="rgb(115,117,181)" text-anchor="end">C</text><text pointer-events="none" x="-7" dy="0.35em" transform="translate(175, 100) rotate(270)" fill="rgb(115,117,181)" text-anchor="end">D</text><text pointer-events="none" x="-7" dy="0.35em" transform="translate(225, 100) rotate(270)" fill="rgb(74,85,132)" text-anchor="end">E</text><text pointer-events="none" x="-7" dy="0.35em" transform="translate(275, 100) rotate(270)" fill="rgb(74,85,132)" text-anchor="end">F</text></g></g></svg>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Test: Layout Partition</title>
|
4
|
+
<script type="text/javascript" src="protovis-r3.3.js"></script>
|
5
|
+
</head>
|
6
|
+
<body>
|
7
|
+
<h1>Test: Layout Partition</h1>
|
8
|
+
<script type="text/javascript">
|
9
|
+
color=pv.Colors.category19()
|
10
|
+
w=400
|
11
|
+
h=400
|
12
|
+
|
13
|
+
subtree={a:1,b:2,c:3,d:4}
|
14
|
+
|
15
|
+
hier_nodes=pv.dom({a:subtree,b:subtree, c:subtree, d:subtree,e:subtree,f:subtree}).root("test").nodes()
|
16
|
+
|
17
|
+
|
18
|
+
vis = new pv.Panel()
|
19
|
+
.width(w)
|
20
|
+
.height(h)
|
21
|
+
.top(20)
|
22
|
+
.bottom(10)
|
23
|
+
.left(10)
|
24
|
+
|
25
|
+
partition= vis.add(pv.Layout.Cluster).
|
26
|
+
nodes(hier_nodes).orient("top")
|
27
|
+
|
28
|
+
partition.node.add(pv.Dot).
|
29
|
+
fillStyle(function(d) {return color(d.nodeValue);}).
|
30
|
+
strokeStyle("black").
|
31
|
+
lineWidth(1).
|
32
|
+
antialias(false)
|
33
|
+
partition.link.add(pv.Line)
|
34
|
+
partition.label.add(pv.Label).
|
35
|
+
text(function(d) {return d.nodeName})
|
36
|
+
vis.render()
|
37
|
+
</script>
|
38
|
+
</body>
|
39
|
+
</html>
|