Permalink
Browse files

don't let explicit max of zero fall through to derived max; fixes #178

  • Loading branch information...
1 parent fac3e11 commit 88af559e00ffd3f05c427aad2fc73e8a7e4e5761 @dchester dchester committed Mar 2, 2013
Showing with 11 additions and 1 deletion.
  1. +1 −1 src/js/Rickshaw.Graph.Renderer.js
  2. +10 −0 tests/Rickshaw.Graph.Renderer.js
@@ -61,7 +61,7 @@ Rickshaw.Graph.Renderer = Rickshaw.Class.create( {
xMax += (xMax - xMin) * this.padding.right;
yMin = this.graph.min === 'auto' ? yMin : this.graph.min || 0;
- yMax = this.graph.max || yMax;
+ yMax = this.graph.max === undefined ? yMax : this.graph.max;
if (this.graph.min === 'auto' || yMin < 0) {
yMin -= (yMax - yMin) * this.padding.bottom;
@@ -74,6 +74,16 @@ exports.domain = function(test) {
domain = graph.renderer.domain();
test.deepEqual(domain, { x: [ 1, 3 ], y: [ 3, 49 ] }, "null values don't set min to zero");
+ // max of zero
+
+ graph.series.push({ data: [ { x: 1, y: -29 }, { x: 2, y: -9 }, { x: 3, y: -3 } ] });
+
+ graph.configure({ max: 0 });
+ graph.stackData();
+
+ domain = graph.renderer.domain();
+ test.deepEqual(domain, { x: [ 1, 3 ], y: [ -29, 0 ] }, "explicit zero max doesn't fall through");
+
test.done();
};

0 comments on commit 88af559

Please sign in to comment.