Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove division by zero error when data is all zeroes

  • Loading branch information...
commit e477b5293170f64d4aa58f58d5e36f9335dc03d9 1 parent bbd8238
@arsatiki arsatiki authored
Showing with 3 additions and 1 deletion.
  1. +3 −1 googlecharts/templatetags/charts.py
View
4 googlecharts/templatetags/charts.py
@@ -868,7 +868,9 @@ def num2chars(n, value_range):
def norm(n, value_range):
minvalue, maxvalue = value_range
- if minvalue >= 0:
+ if minvalue == maxvalue:
+ return 0
+ elif minvalue >= 0:
return int(round(float(n) / maxvalue * 4095, 0))
elif maxvalue <= 0:
return 4095 - int(round(float(n) * 4095 / minvalue))
Please sign in to comment.
Something went wrong with that request. Please try again.