Sha256: eeb5f2ea589476ab26608a31a6b1b905d034ee1ccd11fbe95d2a524242321755

Contents?: true

Size: 556 Bytes

Versions: 7

Compression:

Stored size: 556 Bytes

Contents

# = Grid
# A simple heatmap, using a Bar.fill_style to represent
# data
$:.unshift(File.dirname(__FILE__)+"/../../lib")
require 'rubyvis'

w = 400
h = 400

vis = pv.Panel.new()
  .width(w)
  .height(h)
  .bottom(0)
  .left(0)
  .right(0)
  .top(0)

  arrays=10.times.map {|i| 10.times.map {|j| i/10.0+j/100.0}}

  vis.add(Rubyvis::Layout::Grid).rows(arrays).
    cell.add(Rubyvis::Bar).
    fill_style(Rubyvis.ramp("white", "black")).anchor("center").
    add(Rubyvis::Label).
    text_style(Rubyvis.ramp("black","white"))

vis.render();


puts vis.to_svg

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubyvis-0.5.1 examples/1_basic/grid.rb
rubyvis-0.5.0 examples/1_basic/grid.rb
rubyvis-0.4.1 examples/1_basic/grid.rb
rubyvis-0.4.0 examples/1_basic/grid.rb
rubyvis-0.3.6 examples/1_basic/grid.rb
rubyvis-0.3.5 examples/1_basic/grid.rb
rubyvis-0.3.4 examples/1_basic/grid.rb