Sha256: 2ecc7ccbb3fd916ed7a4690b3fdccafdfd5ed303ff70006f8a7f1587ca8e2472

Contents?: true

Size: 1.37 KB

Versions: 5

Compression:

Stored size: 1.37 KB

Contents

#!/usr/bin/ruby

require File.dirname(__FILE__) + "/gruff_test_case"

class TestGruffStackedBar < GruffTestCase

  def setup
    @datasets = [
      [:Jimmy, [25, 36, 86, 39]],
      [:Charles, [80, 54, 67, 54]],
      [:Julie, [22, 29, 35, 38]],
      ]
    @sample_labels = {
        0 => '5/6', 
        1 => '5/15', 
        2 => '5/24'
      }      

  end

  def test_bar_graph
    g = Gruff::StackedBar.new
    g.title = "Visual Stacked Bar Graph Test"
    g.labels = {
      0 => '5/6', 
      1 => '5/15', 
      2 => '5/24', 
      3 => '5/30', 
    }
    @datasets.each do |data|
      g.data(data[0], data[1])
    end
    g.write "test/output/stacked_bar_keynote.png"
  end


  def test_bar_graph_small
    g = Gruff::StackedBar.new(400)
    g.title = "Visual Stacked Bar Graph Test"
    g.labels = {
      0 => '5/6', 
      1 => '5/15', 
      2 => '5/24', 
      3 => '5/30', 
    }
    @datasets.each do |data|
      g.data(data[0], data[1])
    end
    g.write "test/output/stacked_bar_keynote_small.png"
  end

  def test_bar_graph_segment_spacing
    g = Gruff::StackedBar.new
    g.title = "Visual Stacked Bar Graph Test"
    g.segment_spacing = 0
    g.labels = {
      0 => '5/6',
      1 => '5/15',
      2 => '5/24',
      3 => '5/30',
    }
    @datasets.each do |data|
      g.data(data[0], data[1])
    end
    g.write "test/output/stacked_bar_keynote_no_space.png"
  end
  
end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/gruff-0.7.0/test/test_stacked_bar.rb
gruff-0.7.0-java test/test_stacked_bar.rb
gruff-0.7.0 test/test_stacked_bar.rb
gruff-0.6.0-java test/test_stacked_bar.rb
gruff-0.6.0 test/test_stacked_bar.rb