Browse files

use math.ceil() to keep width < max. closes #6

  • Loading branch information...
1 parent 90522b9 commit d3f6f1a3eff1f44ff4968d9b42e2483b96cc011d @jehiah jehiah committed Dec 9, 2010
Showing with 2 additions and 1 deletion.
  1. +2 −1 data_hacks/bar_chart.py
View
3 data_hacks/bar_chart.py
@@ -20,6 +20,7 @@
http://github.com/bitly/data_hacks
"""
import sys
+import math
from collections import defaultdict
from optparse import OptionParser
@@ -47,7 +48,7 @@ def run(input_stream, options):
max_length = min(max_length, 50)
value_characters = 80 - max_length
max_value = max(data.values())
- scale = int(float(max_value) / value_characters)
+ scale = int(math.ceil(float(max_value) / value_characters))
scale = max(1, scale)
print "# each * represents a count of %d" % scale

0 comments on commit d3f6f1a

Please sign in to comment.