# File test/test_sidestacked_bar.rb, line 7
def setup
@datasets = [
[:Jimmy, [25, 36, 86, 39]],
[:Charles, [80, 54, 67, 54]],
[:Julie, [22, 29, 35, 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
# File test/test_sidestacked_bar.rb, line 24
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
# File test/test_sidestacked_bar.rb, line 40
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
# File test/test_sidestacked_bar.rb, line 61
def test_should_space_long_left_labels_appropriately
g = Gruff::SideStackedBar.new
g.title = "Stacked Bar Long Label"
g.labels = {
0 => 'September',
1 => 'Oct',
2 => 'Nov',
3 => 'Dec',
}
@datasets.each do |data|
g.data(data[0], data[1])
end
g.write "test/output/side_stacked_bar_long_label.png"
end
Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.
If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.
If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.
If you want to help improve the Ruby documentation, please see Improve the docs, or visit Documenting-ruby.org.