Skip to content

Commit 3289352

Browse files
author
claudiofullscreen
committed
Merge pull request #38 from Fullscreen/fix-min-max
Fix: don’t draw an axis if the data is empty.
2 parents 11bb45d + c63beb9 commit 3289352

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ For more information about changelogs, check
66
[Keep a Changelog](http://keepachangelog.com) and
77
[Vandamme](http://tech-angels.github.io/vandamme).
88

9+
## 1.0.1 - 2015.10.01
10+
11+
* [BUGFIX] Don’t try to draw an axis if the data is empty.
12+
913
## 1.0.0 - 2015.08.31
1014

1115
* [FEATURE] Add `chart` method to Prawn::Document to draw graphs.

lib/squid/axis.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,15 @@ def label_width(label)
3939
end
4040

4141
def min
42-
[values.first.min, 0].min if @data.any? && values.first.any?
42+
if @data.any? && values.first && values.first.any?
43+
[values.first.min, 0].min
44+
end
4345
end
4446

4547
def max
46-
[values.last.max, @steps].max if @data.any? && values.last.any?
48+
if @data.any? && values.last && values.last.any?
49+
[values.last.max, @steps].max
50+
end
4751
end
4852

4953
def values

lib/squid/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module Squid
2-
VERSION = '1.0.0'
2+
VERSION = '1.0.1'
33
end

0 commit comments

Comments
 (0)