diff --git a/CHANGELOG b/CHANGELOG index c7f0258..e423c6d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,9 +1,9 @@ V 2.0.0 UNRELEASED - Remove DateY and replace it by real XY datetime, date, time and timedelta support. - Introduce new XY configuration options: `xrange`, `x_value_formatter` - Rework the ghost mechanism to come back to a more object oriented behavior (WIP) + Rework the ghost mechanism to come back to a more object oriented behavior (Maybe) -V 1.6.3 +V 1.7.0 + Remove DateY and replace it by real XY datetime, date, time and timedelta support. (#188) + Introduce new XY configuration options: `xrange`, `x_value_formatter`. Add show_x_labels option to remove them and the x axis. Set print_values to False by default. Fix secondary serie text values when None in data. (#192) diff --git a/pygal/__init__.py b/pygal/__init__.py index fbb9b56..0d16844 100644 --- a/pygal/__init__.py +++ b/pygal/__init__.py @@ -21,7 +21,7 @@ Pygal - A python svg graph plotting library """ -__version__ = '1.6.3' +__version__ = '1.7.0' import sys from pygal.config import Config from pygal.ghost import Ghost, REAL_CHARTS diff --git a/pygal/_compat.py b/pygal/_compat.py index 138ea12..55e2f03 100644 --- a/pygal/_compat.py +++ b/pygal/_compat.py @@ -63,7 +63,7 @@ def total_seconds(td): return td.total_seconds() -def to_timestamp(x): +def timestamp(x): if hasattr(x, 'timestamp'): return x.timestamp() else: diff --git a/pygal/graph/time.py b/pygal/graph/time.py index d9a8963..f273840 100644 --- a/pygal/graph/time.py +++ b/pygal/graph/time.py @@ -22,12 +22,12 @@ Various datetime line plot from pygal.graph.xy import XY from datetime import datetime, date, time, timedelta -from pygal._compat import to_timestamp +from pygal._compat import timestamp, total_seconds def datetime_to_timestamp(x): if isinstance(x, datetime): - return to_timestamp(x) + return timestamp(x) return x @@ -45,7 +45,7 @@ def time_to_datetime(x): def timedelta_to_seconds(x): if isinstance(x, timedelta): - return x.total_seconds() + return total_seconds(x) return x diff --git a/pygal/test/test_date.py b/pygal/test/test_date.py index 875284d..8ac08fe 100644 --- a/pygal/test/test_date.py +++ b/pygal/test/test_date.py @@ -19,6 +19,7 @@ from pygal import DateLine, TimeLine, DateTimeLine, TimeDeltaLine from pygal.test.utils import texts from datetime import datetime, date, time, timedelta +import sys def test_date(): @@ -96,9 +97,9 @@ def test_timedelta(): ]) q = timedelta_chart.render_pyquery() - assert list( - q(".axis.x text").map(texts)) == [ + t for t in q(".axis.x text").map(texts) if t != '0:00:00' + ) == [ '1 day, 3:46:40', '2 days, 7:33:20', '3 days, 11:20:00',