Sha256: 7ef77cba5adfe5e44f20c42b051c4f1014056280cf54cde24529e8f28d74546c

Contents?: true

Size: 755 Bytes

Versions: 4

Compression:

Stored size: 755 Bytes

Contents

#!/usr/bin/ruby

$:.unshift(File.dirname(__FILE__) + "/../lib/")

require 'test/unit'
require 'gruff'

class TestGruffPhotoBar < Test::Unit::TestCase

  def setup
    @datasets = [
      [:Jimmy, [25, 36, 86, 39]],
      [:Charles, [80, 54, 67, 54]],
#      [:Charity, [0, nil, 100, 90]],
      ]
  end

  def test_bar_graph
    bar_graph_sized
    bar_graph_sized(400)
  end


protected

  def bar_graph_sized(size=800)
    g = Gruff::PhotoBar.new(size)
    g.title = "Photo Bar Graph Test #{size}px"
    g.labels = {
      0 => '5/6', 
      1 => '5/15', 
      2 => '5/24', 
      3 => '5/30', 
    }
    @datasets.each do |data|
      g.data(*data)
    end

    g.theme = 'plastik'

    g.write("test/output/photo_plastik_#{size}.png")    
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gruff-0.1.0 test/photo_test.rb
gruff-0.0.9 test/photo_test.rb
gruff-0.1.1 test/photo_test.rb
gruff-0.0.8 test/photo_test.rb