Skip to content

Commit

Permalink
Override data_range in time_series to allow scale_?_integers to work. C…
Browse files Browse the repository at this point in the history
…loses #30.
  • Loading branch information
jaraco committed Apr 1, 2024
1 parent 936f58f commit 914612f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions newsfragments/30.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Override data_range in time_series to allow scale_?_integers to work.
5 changes: 5 additions & 0 deletions svg/charts/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import functools
import itertools
import math

from lxml import etree
import more_itertools
Expand Down Expand Up @@ -226,6 +227,10 @@ def data_min(self, axis):
def data_range(self, axis):
min_value = self.data_min(axis)
max_value = self.data_max(axis)
if getattr(self, 'scale_%s_integers' % axis):
min_value = math.floor(min_value)
max_value = math.ceil(max_value)

range = max_value - min_value

side_pad = range / 20.0 or 10
Expand Down

0 comments on commit 914612f

Please sign in to comment.