Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix exception when y_axis_increment is used in line bars #16

Merged
merged 1 commit into from

2 participants

Patric Mueller Uwe Kubosch
Patric Mueller

Setting y_axis_increment manually with a line graph will fail with this message:
gruff-0.3.6/lib/gruff/base.rb:687:in `normalize': wrong number of arguments (1 for 0) (ArgumentError)

The problem was a missing argument on normalize in the Line class. I added a test and fixed the code.

Uwe Kubosch donv was assigned
Uwe Kubosch donv merged commit 1ef707d into from
Patric Mueller bhaak deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 20, 2011
  1. Patric Mueller
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 2 deletions.
  1. +2 −2 lib/gruff/line.rb
  2. +11 −0 test/test_line.rb
4 lib/gruff/line.rb
View
@@ -109,9 +109,9 @@ def draw
@d.draw(@base_image)
end
- def normalize
+ def normalize(force=false)
@maximum_value = [@maximum_value.to_f, @baseline_value.to_f].max
- super
+ super(force)
@norm_baseline = (@baseline_value.to_f / @maximum_value.to_f) if @baseline_value
end
11 test/test_line.rb
View
@@ -482,6 +482,17 @@ def test_marker_label_accuracy
g.write("test/output/line_marker_label_accuracy.png")
end
+ def test_y_axis_increment
+ g = Gruff::Line.new
+ g.title = "y axis increment"
+
+ g.data('data', [1,2,3])
+
+ g.y_axis_increment = 1
+
+ g.write("test/output/line_y_axis_increment.png")
+ end
+
private
Something went wrong with that request. Please try again.