def _round_up_max(max_val):
"Rounds up a maximum value."
# Prevent zero values raising an error. Rounds up to 10 at a minimum.
max_val = max(10, max_val)
e = int(math.log10(max_val))
if e >= 2:
e -= 1
m = 10**e
return math.ceil(float(max_val)/m)*m
# Copied from Anki with the following changes:
# - Set tickDecimals to 0.
# - Update tickFormatter to show 1 decimal unless whole number
# TODO pull request to Anki to include these changes
评论列表
文章目录