rubyvis 0.1.5 → 0.1.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/History.txt +9 -1
  2. data/Manifest.txt +9 -4
  3. data/README.txt +59 -8
  4. data/examples/antibiotics/antibiotics.rb +16 -8
  5. data/examples/area.rb +6 -49
  6. data/examples/bar_column_chart.rb +4 -0
  7. data/examples/crimea/{crimea.rb → crimea_data.rb} +0 -0
  8. data/examples/crimea/crimea_grouped_bar.rb +2 -2
  9. data/examples/crimea/crimea_line.rb +1 -1
  10. data/examples/dot.rb +7 -8
  11. data/examples/first.rb +4 -0
  12. data/examples/grouped_charts.rb +3 -0
  13. data/examples/line.rb +19 -61
  14. data/examples/line_and_step.rb +4 -0
  15. data/examples/nested_grid.rb +53 -0
  16. data/examples/scatterplot.rb +2 -0
  17. data/examples/second.rb +14 -2
  18. data/examples/third.rb +9 -6
  19. data/lib/rubyvis/color/color.rb +8 -6
  20. data/lib/rubyvis/color/colors.rb +4 -6
  21. data/lib/rubyvis/format/number.rb +2 -2
  22. data/lib/rubyvis/internals.rb +15 -3
  23. data/lib/rubyvis/javascript_behaviour.rb +20 -8
  24. data/lib/rubyvis/layout/stack.rb +13 -16
  25. data/lib/rubyvis/mark/anchor.rb +64 -2
  26. data/lib/rubyvis/mark/area.rb +4 -3
  27. data/lib/rubyvis/mark/bar.rb +51 -2
  28. data/lib/rubyvis/mark/dot.rb +88 -5
  29. data/lib/rubyvis/mark/label.rb +94 -3
  30. data/lib/rubyvis/mark/line.rb +3 -2
  31. data/lib/rubyvis/mark/panel.rb +1 -0
  32. data/lib/rubyvis/mark/rule.rb +2 -1
  33. data/lib/rubyvis/mark/wedge.rb +2 -1
  34. data/lib/rubyvis/mark.rb +419 -54
  35. data/lib/rubyvis/nest.rb +20 -20
  36. data/lib/rubyvis/scale/linear.rb +1 -1
  37. data/lib/rubyvis/scale/log.rb +1 -1
  38. data/lib/rubyvis/scale/ordinal.rb +120 -8
  39. data/lib/rubyvis/scale/quantitative.rb +159 -15
  40. data/lib/rubyvis/scale.rb +1 -1
  41. data/lib/rubyvis/scene/svg_area.rb +12 -12
  42. data/lib/rubyvis/scene/svg_line.rb +5 -5
  43. data/lib/rubyvis/scene/svg_panel.rb +1 -1
  44. data/lib/rubyvis/scene/svg_scene.rb +1 -1
  45. data/lib/rubyvis.rb +35 -6
  46. data/spec/anchor_spec.rb +15 -15
  47. data/web/Rakefile +34 -0
  48. data/web/build_site.rb +86 -0
  49. data/web/examples.haml +26 -0
  50. data/web/index.haml +97 -0
  51. data/web/style.css +82 -0
  52. data.tar.gz.sig +0 -0
  53. metadata +14 -9
  54. metadata.gz.sig +0 -0
  55. data/lib/rubyvis/label.rb +0 -1
  56. data/web/first.svg +0 -1
  57. data/web/index.html +0 -48
data/lib/rubyvis.rb CHANGED
@@ -11,7 +11,6 @@ require 'rubyvis/nest'
11
11
 
12
12
  require 'rubyvis/javascript_behaviour'
13
13
  require 'rubyvis/format'
14
- require 'rubyvis/label'
15
14
  require 'rubyvis/mark'
16
15
  require 'rubyvis/scale'
17
16
  require 'rubyvis/color/color'
@@ -22,22 +21,45 @@ require 'rubyvis/layout'
22
21
  require 'rubyvis/scene/svg_scene'
23
22
  require 'rubyvis/transform'
24
23
 
25
- def pv
26
- Rubyvis
27
- end
28
24
 
29
25
  module Rubyvis
30
26
  @document=nil
31
- VERSION = '0.1.5'
27
+ # Rubyvis version
28
+ VERSION = '0.1.6'
29
+ # Protovis API on which current Rubyvis is based
32
30
  API_VERSION='3.3'
33
- Infinity=1.0 / 0 # You actually can do it! http://snipplr.com/view/2137/uses-for-infinity-in-ruby/
31
+ # You actually can do it! http://snipplr.com/view/2137/uses-for-infinity-in-ruby/
32
+ Infinity=1.0 / 0
33
+ #
34
34
  # :section: basic methods
35
+ #
36
+
37
+ # Returns the passed-in argument, +x+; the identity function. This method
38
+ # is provided for convenience since it is used as the default behavior for a
39
+ # number of property functions.
40
+ #
41
+ # @param [Object] x, a value.
42
+ # @return [Object] the value +x+.
35
43
  def self.identity
36
44
  lambda {|x,*args| x}
37
45
  end
46
+
47
+ # Returns <tt>self.index</tt>. This method is provided for convenience for use
48
+ # with scales. For example, to color bars by their index, say:
49
+ #
50
+ # <pre>.fill_style(Rubyvis::Colors.category10().by(Rubyvis.index))</pre>
51
+ #
52
+ # This method is equivalent to <tt>lambda {self.index}</tt>, but more
53
+ # succinct. Note that the <tt>index</tt> property is also supported for
54
+ # accessor functions with {@link Rubyvis.max}, {@link Rubyvis.min} and other array
55
+ # utility methods.
56
+ #
57
+ # @see Rubyvis::Scale
58
+ # @see Rubyvis::Mark#index
38
59
  def self.index
39
60
  lambda {|*args| self.index}
40
61
  end
62
+
41
63
  def self.child
42
64
  lambda {|*args| self.child_index}
43
65
  end
@@ -61,3 +83,10 @@ module Rubyvis
61
83
  s
62
84
  end
63
85
  end
86
+
87
+ # Alias for Rubyvis module
88
+ # @return [Module] Rubyvis module
89
+ def pv
90
+ Rubyvis
91
+ end
92
+
data/spec/anchor_spec.rb CHANGED
@@ -49,22 +49,22 @@ describe Rubyvis::Anchor do
49
49
  adatas=[]
50
50
  s = 180
51
51
  _p = 20
52
- vis = pv.Panel.new()
53
- .height(s * antibiotics.size + _p * (antibiotics.size - 1))
54
- .width(s * antibiotics.size + _p * (antibiotics.size - 1))
55
- .top(14.5)
56
- .left(14.5)
57
- .bottom(44)
58
- .right(14)
52
+ vis = pv.Panel.new().
53
+ height(s * antibiotics.size + _p * (antibiotics.size - 1)).
54
+ width(s * antibiotics.size + _p * (antibiotics.size - 1)).
55
+ top(14.5).
56
+ left(14.5).
57
+ bottom(44).
58
+ right(14)
59
59
 
60
- cell = vis.add(pv.Panel)
61
- .data(a1)
62
- .width(s)
63
- .left(lambda {(s + _p) * self.index})
64
- .add(pv.Panel)
65
- .data(a2)
66
- .height(s)
67
- .top(lambda {(s + _p) * self.index});
60
+ cell = vis.add(pv.Panel).
61
+ data(a1).
62
+ width(s).
63
+ left(lambda {(s + _p) * index}).
64
+ add(pv.Panel).
65
+ data(a2).
66
+ height(s).
67
+ top(lambda {(s + _p) * self.index});
68
68
 
69
69
 
70
70
  cell.anchor("center").add(pv.Label).text(lambda {|*args| adatas.push args})
data/web/Rakefile ADDED
@@ -0,0 +1,34 @@
1
+ # -*- ruby -*-
2
+ require 'rake'
3
+ def get_base(f)
4
+ f.sub(File.dirname(__FILE__)+"/../examples/","").gsub("/","_").gsub(".rb","")
5
+ end
6
+ directory "examples"
7
+ EXAMPLES=Dir.glob(File.dirname(__FILE__)+"/../examples/**/*.rb").map {|v| [v,get_base(v)]
8
+ }.find_all{|v| !v[0].include?"_data"}
9
+
10
+ EXAMPLES_BASE=EXAMPLES.map {|v| v[1]}
11
+
12
+
13
+
14
+ task :build_site do
15
+ ruby "build_site.rb"
16
+ end
17
+
18
+ task :default=>["index.html"]+EXAMPLES_BASE.map {|v| "examples/#{v}.html"}
19
+
20
+
21
+ file "index.html"=>["index.haml", :build_site]+EXAMPLES_BASE.map {|v| "examples/#{v}.png"}
22
+
23
+ EXAMPLES.each do |v|
24
+ e=v[1]
25
+ file "examples/#{e}.html"=>["examples.haml", :build_site, v[0]]
26
+ file "examples/#{e}.svg"=>[v[0]] do |t|
27
+ system "ruby1.9 #{v[0]} > #{t.name}"
28
+ end
29
+ file "examples/#{e}.png"=>"examples/#{e}.svg" do |t|
30
+ system "rsvg -w 200 -h 200 -f png examples/#{e}.svg #{t.name}"
31
+ end
32
+ end
33
+
34
+ load 'upload_task.rb' if File.exists? "upload_task.rb"
data/web/build_site.rb ADDED
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/ruby
2
+ # * Create the index
3
+ # * Create an html page for each example
4
+ $:.unshift("../lib")
5
+ require 'coderay'
6
+ require 'haml'
7
+ require 'ostruct'
8
+ require 'rubyvis'
9
+
10
+ # First, create the examples
11
+
12
+ haml_template=Haml::Engine.new(File.read("examples.haml"))
13
+ buffer=[]
14
+
15
+ def get_base(f)
16
+ f.sub(File.dirname(__FILE__)+"/../examples/","").gsub("/","_").gsub(".rb","")
17
+ end
18
+
19
+ # Store prev and next element
20
+ pages={}
21
+ prev_page=nil
22
+ next_page=nil
23
+
24
+ Dir.glob(File.dirname(__FILE__)+"/../examples/**/*.rb") do |f|
25
+
26
+ next if f.include? "_data.rb"
27
+ fn=get_base(f)
28
+ unless prev_page.nil?
29
+ pages[prev_page].next_ex = fn
30
+ end
31
+
32
+ pages[fn]=OpenStruct.new({:prev_ex=>prev_page, :next_ex=>next_page, :name=>fn})
33
+
34
+ prev_page=fn
35
+
36
+ base=fn
37
+
38
+ page=pages[fn]
39
+ mtime=File.mtime(f)
40
+ next if f.include? "_data.rb"
41
+ # First, get name and text
42
+ fp=File.open(f,"r")
43
+ comment=false
44
+ title=File.basename(f)
45
+ text=[]
46
+ source_a=[]
47
+ previous_example=""
48
+ next_example=""
49
+ fp.each do |line|
50
+ if line=~/\s*#\s*(.+)/ and !comment
51
+ t=$1
52
+ if t=~ /=\s*(.+)/
53
+ title=$1
54
+ else
55
+ text << t
56
+ end
57
+ else
58
+ comment=true
59
+ source_a << line unless line.include? "$:.unshift"
60
+ end
61
+ end
62
+ text.map! {|t| t.chomp}
63
+ # Create an html file with svg included inside
64
+ page.source=CodeRay.scan(source_a.join(), :ruby).div
65
+ page.title=title
66
+ page.text=text
67
+ page.svg_file=base+".svg"
68
+
69
+ end
70
+
71
+ pages.each do |name,page|
72
+ html_file="examples/#{page.name}.html"
73
+ File.open(html_file,"w") {|fp|
74
+ fp.write(haml_template.render(page, :pages=>pages))
75
+ }
76
+
77
+ end
78
+
79
+
80
+
81
+ # Create index
82
+
83
+ index_template=Haml::Engine.new(File.read("index.haml"))
84
+ File.open("index.html","w") {|fp|
85
+ fp.write(index_template.render(self,:examples=>pages))
86
+ }
data/web/examples.haml ADDED
@@ -0,0 +1,26 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %link{:type=>"text/css", :rel=>"stylesheet", :href=>"../style.css"}
5
+ %title="Rubyvis - Example: #{title}"
6
+ %body
7
+ %h1="Rubyvis - Example: #{title}"
8
+ .example_main
9
+ .description
10
+ - text.each do |t|
11
+ %p= t
12
+ .navigation
13
+ %ul
14
+ %li
15
+ %a{:href=>"../index.html"} Home
16
+ - if prev_ex
17
+ %li
18
+ %a{:href=>"#{prev_ex}.html"} Previous: #{pages[prev_ex].title}
19
+ - if next_ex
20
+ %li
21
+ %a{:href=>"#{next_ex}.html"} Next: #{pages[next_ex].title}
22
+ .image
23
+ /[if IE]
24
+ %embed.svg{:src=>svg_file,:width=>"500", :height=>"300"}
25
+ %object.svg{:data=>svg_file, :type=>"image/svg+xml"}
26
+ .source=find_and_preserve(source)
data/web/index.haml ADDED
@@ -0,0 +1,97 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %link{:type=>"text/css", :rel=>"stylesheet", :href=>"style.css"}
5
+ %title Rubyvis: Ruby version of Protovis
6
+ %body
7
+ %h1 Rubyvis
8
+ %h2 Description
9
+ .description
10
+ %p
11
+ Ruby port of
12
+ %a{:href=>"http://vis.stanford.edu/protovis/"} Protovis library
13
+ According to the protovis site
14
+ %blockquote
15
+ Protovis composes custom views of data with simple marks such as bars and dots. Unlike low-level graphics libraries that quickly become tedious for visualization, Protovis defines marks through dynamic properties that encode data, allowing inheritance, scales and layouts to simplify construction.
16
+ %p As Protovis, Rubyvis is free and open-source, provided under the BSD License. Its delivers SVG natively, which could be exported to PNG, JPEG and others graphics formats
17
+ %p
18
+ Current Version:
19
+ %strong=Rubyvis::VERSION
20
+ %p
21
+ Protovis API Version:
22
+ %strong=Rubyvis::API_VERSION
23
+ %h2 Installation
24
+ %pre gem install rubyvis
25
+ %h2 Synopsis
26
+ .synopsis
27
+ #ruby_code
28
+ %h3 Ruby
29
+ %pre
30
+ :preserve
31
+ require 'rubyvis'
32
+ vis = Rubyvis::Panel.new.width(150).height(150);
33
+ vis.add(pv.Bar).data([1, 1.2, 1.7, 1.5, 0.7, 0.3]).
34
+ width(20).
35
+ height(lambda {|d| d * 80}).
36
+ bottom(0).
37
+ left(lambda {self.index * 25})
38
+ vis.render()
39
+ #svg_code
40
+ %h3 SVG
41
+ %pre
42
+ :preserve
43
+ &lt;svg fill="none" font-family="sans-serif"
44
+ font-size="10px" height="150.0" stroke="none"
45
+ stroke-width="1.5" width="150.0"&gt;
46
+ &lt;g transform="translate(0.0,0.0)"&gt;
47
+ &lt;rect fill="rgb(31,119,180)" height="80"
48
+ width="20" y="70"/&gt;
49
+ &lt;rect fill="rgb(31,119,180)" height="96.0"
50
+ width="20" x="25" y="54.0"/&gt;
51
+ &lt;rect fill="rgb(31,119,180)" height="136.0"
52
+ width="20" x="50" y="14.0"/&gt;
53
+ &lt;rect fill="rgb(31,119,180)" height="120.0"
54
+ width="20" x="75" y="30.0"/&gt;
55
+ &lt;rect fill="rgb(31,119,180)" height="56.0"
56
+ width="20" x="100" y="94.0"/&gt;
57
+ &lt;rect fill="rgb(31,119,180)" height="24.0"
58
+ width="20" x="125" y="126.0"/&gt;
59
+ &lt;/g&gt;
60
+ &lt;/svg&gt;
61
+ #image
62
+ %div
63
+ %h3 Image
64
+ /[if IE]
65
+ %embed{:src=>"examples/first.svg" ,:width=>"150", :height=>"150"}
66
+ %object{:data=>"examples/first.svg", :type=>"image/svg+xml", :width=>150,:height=>150}
67
+ .examples_div
68
+ %h2 Examples
69
+ %p
70
+ Several based on
71
+ %a{:href=>"http://vis.stanford.edu/protovis/ex/"}Protovis gallery
72
+ .examples
73
+ - examples.each_pair do |name,page|
74
+ .example
75
+ .name
76
+ %a{:href=>"examples/"+name+".html"}=page.title
77
+ .image
78
+ %img{:src=>"examples/"+name+".png"}
79
+ .resources
80
+ %h2 Resources
81
+ %ul
82
+ %li
83
+ source code on
84
+ %a{:href=>'http://github.com/clbustos/rubyvis'}
85
+ Github
86
+ %li
87
+ requests and bug reports on
88
+ %a{:href=>'http://github.com/clbustos/rubyvis/issues'}
89
+ Github, too
90
+ %li
91
+ gem on
92
+ %a{:href=>'http://rubygems.org/gems/rubyvis'}
93
+ gemcutter
94
+ %li
95
+ API documentation on
96
+ %a{:href=>'http://rubyvis.rubyforge.org/rubyvis/'}
97
+ http://rubyvis.rubyforge.org/rubyvis/
data/web/style.css ADDED
@@ -0,0 +1,82 @@
1
+ body {
2
+ background-color: white;
3
+ color: black;
4
+ padding: 0;
5
+ font-family: "Arial",sans-serif;
6
+ }
7
+
8
+ h1,h2,h3 {
9
+ color:#600;
10
+ }
11
+
12
+ .example .name {
13
+ text-align:center;
14
+ margin-bottom:0.5em;
15
+ }
16
+
17
+ .example .image {
18
+ }
19
+
20
+ .example {
21
+ float:left;
22
+ border:1px solid #ccc;
23
+ padding:1em;
24
+ margin:1em;
25
+ }
26
+
27
+ .description {
28
+ border:1px solid #dcc;
29
+ background: #ffefef;
30
+ padding:0.5em;
31
+ margin-bottom:1em;
32
+ }
33
+
34
+ .examples_div, .resources {
35
+ clear:both;
36
+ }
37
+ #image {
38
+ float:left;
39
+ width:auto;
40
+ font-size:8pt;
41
+ margin:1em;
42
+ padding:0.5em 1em;
43
+ border:1px solid #ccc;
44
+ height:auto;
45
+
46
+ }
47
+ #ruby_code, #svg_code {
48
+ float:left;
49
+ width:30%;
50
+ font-size:8pt;
51
+ margin:1em;
52
+ padding:0.5em;
53
+ border:1px solid #ccc;
54
+ height:auto;
55
+ }
56
+
57
+ .synopsis h3 {
58
+ font-size:12pt;
59
+ text-align:center;
60
+ }
61
+
62
+ .example_main .description {
63
+ clear:both;
64
+ }
65
+ .example_main .image {
66
+ float:left;
67
+ }
68
+
69
+ .navigation {
70
+ font-size:80%;
71
+ margin: 0.2em 0em 2em 2em;
72
+ }
73
+ .navigation ul {
74
+ list-style:none;
75
+ }
76
+ .example_main .source {
77
+ float:right;
78
+ width:40%;
79
+ margin: 0.5em 1em;
80
+ border:1px solid #ccc;
81
+ padding:1em;
82
+ }
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 5
9
- version: 0.1.5
8
+ - 6
9
+ version: 0.1.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Claudio Bustos
@@ -35,7 +35,7 @@ cert_chain:
35
35
  rpP0jjs0
36
36
  -----END CERTIFICATE-----
37
37
 
38
- date: 2010-10-22 00:00:00 -03:00
38
+ date: 2010-10-30 00:00:00 -03:00
39
39
  default_executable:
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
@@ -66,7 +66,7 @@ dependencies:
66
66
  version: 2.6.2
67
67
  type: :development
68
68
  version_requirements: *id002
69
- description: Ruby port of Protovis, a great visualization toolkit
69
+ description: Ruby port of Protovis[http://vis.stanford.edu/protovis/], a great visualization toolkit
70
70
  email:
71
71
  - clbustos_at_gmail.com
72
72
  executables: []
@@ -88,7 +88,7 @@ files:
88
88
  - examples/bar_column_chart.rb
89
89
  - examples/barley/barley.rb
90
90
  - examples/barley/barley_data.rb
91
- - examples/crimea/crimea.rb
91
+ - examples/crimea/crimea_data.rb
92
92
  - examples/crimea/crimea_grouped_bar.rb
93
93
  - examples/crimea/crimea_line.rb
94
94
  - examples/dot.rb
@@ -96,6 +96,7 @@ files:
96
96
  - examples/grouped_charts.rb
97
97
  - examples/line.rb
98
98
  - examples/line_and_step.rb
99
+ - examples/nested_grid.rb
99
100
  - examples/pie_and_donut.rb
100
101
  - examples/scatterplot.rb
101
102
  - examples/second.rb
@@ -110,7 +111,6 @@ files:
110
111
  - lib/rubyvis/format/number.rb
111
112
  - lib/rubyvis/internals.rb
112
113
  - lib/rubyvis/javascript_behaviour.rb
113
- - lib/rubyvis/label.rb
114
114
  - lib/rubyvis/layout.rb
115
115
  - lib/rubyvis/layout/stack.rb
116
116
  - lib/rubyvis/mark.rb
@@ -141,6 +141,7 @@ files:
141
141
  - lib/rubyvis/scene/svg_wedge.rb
142
142
  - lib/rubyvis/sceneelement.rb
143
143
  - lib/rubyvis/transform.rb
144
+ - spec/anchor_spec.rb
144
145
  - spec/bar_spec.rb
145
146
  - spec/internal_spec.rb
146
147
  - spec/javascript_behaviour_spec.rb
@@ -150,6 +151,7 @@ files:
150
151
  - spec/panel_spec.rb
151
152
  - spec/scale_linear_datetime_spec.rb
152
153
  - spec/scale_linear_spec.rb
154
+ - spec/scale_log_spec.rb
153
155
  - spec/scale_ordinal_spec.rb
154
156
  - spec/scale_spec.rb
155
157
  - spec/spec.opts
@@ -248,8 +250,11 @@ files:
248
250
  - vendor/protovis/src/text/Format.js
249
251
  - vendor/protovis/src/text/NumberFormat.js
250
252
  - vendor/protovis/src/text/TimeFormat.js
251
- - web/first.svg
252
- - web/index.html
253
+ - web/Rakefile
254
+ - web/build_site.rb
255
+ - web/examples.haml
256
+ - web/index.haml
257
+ - web/style.css
253
258
  has_rdoc: true
254
259
  homepage: http://rubyvis.rubyforge.org/
255
260
  licenses: []
@@ -280,7 +285,7 @@ rubyforge_project: rubyvis
280
285
  rubygems_version: 1.3.6
281
286
  signing_key:
282
287
  specification_version: 3
283
- summary: Ruby port of Protovis, a great visualization toolkit
288
+ summary: Ruby port of Protovis[http://vis.stanford.edu/protovis/], a great visualization toolkit
284
289
  test_files:
285
290
  - spec/bar_spec.rb
286
291
  - spec/nest_spec.rb
metadata.gz.sig CHANGED
Binary file
data/lib/rubyvis/label.rb DELETED
@@ -1 +0,0 @@
1
-
data/web/first.svg DELETED
@@ -1 +0,0 @@
1
- <svg fill='none' font-family='sans-serif' font-size='10px' height='150.0' stroke='none' stroke-width='1.5' xmlns:svg='http://www.w3.org/2000/svg' width='150.0'><g transform='translate(0.0,0.0)'><rect fill='rgb(31,119,180)' height='80' width='20' y='70'/><rect fill='rgb(31,119,180)' height='96.0' width='20' x='25' y='54.0'/><rect fill='rgb(31,119,180)' height='136.0' width='20' x='50' y='14.0'/><rect fill='rgb(31,119,180)' height='120.0' width='20' x='75' y='30.0'/><rect fill='rgb(31,119,180)' height='56.0' width='20' x='100' y='94.0'/><rect fill='rgb(31,119,180)' height='24.0' width='20' x='125' y='126.0'/></g><g transform='translate(0.0,0.0)'/></svg>
data/web/index.html DELETED
@@ -1,48 +0,0 @@
1
- <html>
2
- <head>
3
- <title>Rubyvis: Ruby version of Protovis</title>
4
- </head>
5
- <body>
6
- <h1>Rubyvis</h1>
7
- <h2>Ruby version of Protovis</h2>
8
- </body>
9
- <ul>
10
- <li>original <a href='http://vis.stanford.edu/protovis/'>protovis</a></li>
11
- <li>source code on <a href='http://github.com/clbustos/rubyvis'>Github</a></li>
12
- <li>gem on <a href='http://rubygems.org/gems/rubyvis'>gemcutter</a></li>
13
- <li>documentation on <a href='http://rubyvis.rubyforge.org/rubyvis/'>http://rubyvis.rubyforge.org/rubyvis/</a></li>
14
- </ul>
15
- <p>this code</p>
16
- <pre>
17
- require 'rubyvis'
18
- vis = Rubyvis::Panel.new.width(150).height(150);
19
-
20
- vis.add(pv.Bar).data([1, 1.2, 1.7, 1.5, 0.7, 0.3]).
21
- width(20).
22
- height(lambda {|d| d * 80}).
23
- bottom(0).
24
- left(lambda {self.index * 25})
25
- vis.render()
26
- </pre>
27
-
28
- <p>Returns this svg code</p>
29
- <pre>
30
- &lt;svg fill="none" font-family="sans-serif" font-size="10px" height="150.0" stroke="none" stroke-width="1.5" width="150.0"&gt;
31
- &lt;g transform="translate(0.0,0.0)"&gt;
32
- &lt;rect fill="rgb(31,119,180)" height="80" width="20" y="70"/&gt;
33
- &lt;rect fill="rgb(31,119,180)" height="96.0" width="20" x="25" y="54.0"/&gt;
34
- &lt;rect fill="rgb(31,119,180)" height="136.0" width="20" x="50" y="14.0"/&gt;
35
- &lt;rect fill="rgb(31,119,180)" height="120.0" width="20" x="75" y="30.0"/&gt;
36
- &lt;rect fill="rgb(31,119,180)" height="56.0" width="20" x="100" y="94.0"/&gt;
37
- &lt;rect fill="rgb(31,119,180)" height="24.0" width="20" x="125" y="126.0"/&gt;
38
- &lt;/g&gt;
39
- &lt;/svg&gt;
40
- </pre>
41
-
42
- Which renders
43
-
44
- <div>
45
-
46
- <!--[if IE]><embed src="first.svg" width="150" height="150"><![endif]-->
47
- <object data="first.svg" type="image/svg+xml" width="150" height="150" class="svg">
48
- </object> </html>