Bugs: Browse | Submit New | Admin

[#4895] On a stacked bar chart, if the top data series is 0, a bar still appears for the data

Date:
2006-06-30 08:23
Priority:
3
Submitted By:
Nobody
Assigned To:
Nobody (None)
Category:
Interface (example)
State:
Open
Summary:
On a stacked bar chart, if the top data series is 0, a bar still appears for the data

Detailed description
If you use this example, I found on your server, you will that for the third bar from the left, that Julie has 0 for
a datapoint,but a green line still appears. I tried with very small numbers, to no avail. I have pasted the modified
code below.
Thanks in advance.

#!/usr/bin/ruby

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

class TestGruffSideStackedBar < GruffTestCase

  # TODO Delete old output files once when starting tests

  def setup
    @datasets = [
      [:Jimmy, [0, 36, 86, 39]],
      [:Charles, [80, 0, 67, 54]],
      [:Julie, [22, 29, 0, 38]],
      #[:Jane, [95, 95, 95, 90, 85, 80, 88, 100]],
      #[:Philip, [90, 34, 23, 12, 78, 89, 98, 88]],
      #["Arthur", [5, 10, 13, 11, 6, 16, 22, 32]],
      ]
    @sample_labels = {
        0 => '5/6', 
        1 => '5/15', 
        2 => '5/24'
      }      

  end

  def test_bar_graph
    g = Gruff::SideStackedBar.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/side_stacked_bar_keynote.png"
  end


  def test_bar_graph_small
    g = Gruff::SideStackedBar.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/side_stacked_bar_keynote_small.png"
  end

  def test_wide
    g = setup_basic_graph('800x400')
    g.title = "Wide SSBar"
    g.write "test/output/side_stacked_bar_wide.png"
  end

protected

  def setup_basic_graph(size=800)
    g = Gruff::SideStackedBar.new(size)
    g.title = "My Graph Title"
    g.labels = @sample_labels
    @datasets.each do |data|
      g.data(data[0], data[1])
    end
    return g
  end

end

Add A Comment: Notepad

Please login


Followup

No Followups Have Been Posted

Attached Files:

Name Description Download
No Files Currently Attached

Changes:

No Changes Have Been Made to This Item