Skip to content
Ruby version of Protovis, a visualization toolkit.
Ruby Other
Find file
Latest commit c3b1430 @clbustos Fixed rspec on travis
Failed to load latest commit information.
examples Fixed image bug (#13), and updated example for image. Web creation is…
lib Updated to 0.6.1
spec Resolver bug #15 (I hope)
web Added extra properties to label mark
.gitignore * Bug fix: Segmented lines raises an Exception
.travis.yml Fixed rspec on travis
Gemfile Resolver bug #15 (I hope)
Gemfile.lock Resolver bug #15 (I hope)
LICENSE.txt Change license to BSD 2-Clause
Manifest.txt Raises an exception on log scale when domain includes 0 or negative v… Tested only on MRI and JRuby
Rakefile Resolver bug #15 (I hope)
rubyvis.gemspec Resolver bug #15 (I hope)


Build Status


Ruby port of Protovis[], a Javascript visualization toolkit.


This library implements almost completely core API of protovis, including all static marks, SVG builder class and data classes. Spec coverage is near 90%


  • Marks: All, except transient and transitions.
  • Layout: Arc, Cluster, Grid, Horizon, Indent, Matrix, Pack, Partition, Stack, Tree and Treemap. To implement: Bullet, Force, and Rollup.

Using protovis examples[] as reference

  • Conventional: All working
  • Custom:
    • Backer's Barley
    • Burtin's Antibiotics: Scatterplot matrix
    • Cars: Parallel Coordinates
    • Crimea war: Grouped bar chart and line chart
  • Hierarchies:
    • Treemap
    • Bubble Charts
    • Circle Packing
    • Dendogram
    • Icicle
    • Indent
    • Node-Link Tree
    • Sunburst
    • Treemap
  • Networks:
    • Arc
    • Matrix

I try to maintain, when posible, complete compatibility with Javascript API, including camel case naming of functions.

User could use +pv+ freely, cause is defined as a global method which call Rubyvis.

Nokogiri is used as XML library. If not available, or $rubyvis_no_nokogiri is set to true, REXML is used. Nokogiri is 30%-35% faster that REXML on our test.


  • pv.js
  • pv-internals.js
  • color/Color.js
  • color/Colors.js
  • data/Arrays.js
  • data/Flatten.js
  • data/Histogram.js
  • data/Numbers.js
  • data/LinearScale.js
  • data/LogScale.js (incomplete)
  • data/Nest.js
  • data/QuantitativeScale.js
  • data/OrdinalScale.js
  • data/Scale.js
  • layout/Arc.js
  • layout/Cluster.js
  • layout/Grid.js
  • layout/Hierarchy.js
  • layout/Horizon.js
  • layout/Indent.js
  • layout/Layout.js
  • layout/Matrix.js
  • layout/Network.js
  • layout/Pack.js
  • layout/Partition.js
  • layout/Stack.js
  • layout/Tree.js
  • layout/Treemap.js
  • mark/Anchor.js
  • mark/Area.js
  • mark/Bar.js
  • mark/Dot.js
  • mark/Label.js
  • mark/Line.js
  • mark/Mark.js
  • mark/Panel.js
  • mark/Rule.js
  • mark/Wedge.js
  • scene/SvgBar.js
  • scene/SvgLabel.js
  • scene/SvgLine.js
  • scene/SvgPanel.js
  • scene/SvgRule.js
  • scene/SvgScene.js
  • scene/SvgWedge.js
  • text/Format.js (incomplete)
  • text/NumberFormat.js (incomplete)


The primary API, based on Gregory Brown's Ruby Best Practices, uses blocks and name of marks as methods

require 'rubyvis'

vis = do 
  width 150
  height 150
  bar do
    data [1, 1.2, 1.7, 1.5, 0.7, 0.3]
    width 20
    height {|d| d * 80}
    left {index * 25}

puts vis.to_svg

The library allows you to use chain methods API, like original protovis

require 'rubyvis'

vis =;

  data([1, 1.2, 1.7, 1.5, 0.7, 0.3]).
  height(lambda {|d| d * 80}).
  left(lambda {self.index * 25});

puts vis.to_svg

See examples directory for original protovis examples adaptations and others graphics


¿Why use a server-side technology if I can use a client-side, which is faster and more economic for developer?

If you want to present graphs: (a) complex and/or dynamically generated, (b) only on the web and (c) on modern browsers, Protovis[] is an excellent option. For simpler charts, Protovis is overkill. I recomend jqPlot[]

Rubyvis is designed mainly for off-line operation, like batch creation of graphs for use on printed documents (rtf-pdf), with possibility of use easily the script for on-line use.


Tested on Ruby 1.9.2, 1.9.3, 2.0.0, 2.1.1 and Jruby (mode 1.9)


$ gem install rubyvis


BSD 2-Clause (see LICENSE.txt)

Something went wrong with that request. Please try again.