From f2466270b5d5a318b5b164381546c940f59a51dd Mon Sep 17 00:00:00 2001 From: Phil Date: Mon, 31 Mar 2014 22:08:49 +0100 Subject: [PATCH] Additional DateY Description Updated the DateY notes to describe the x_label_format and the x_labels options, with an example. --- pages/chart_types.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pages/chart_types.rst b/pages/chart_types.rst index 66ffb48..c8722c2 100644 --- a/pages/chart_types.rst +++ b/pages/chart_types.rst @@ -145,7 +145,26 @@ You can index values by dates (Thanks to `Snarkturne `_ +The x labels can also be specified, using an array of datetime objects. + +.. pygal-code:: + + from datetime import datetime, timedelta + datey = pygal.DateY(x_label_rotation=20) + datey.add("Visits", [ + (datetime(2013, 1, 2), 300), + (datetime(2013, 1, 12), 412), + (datetime(2013, 2, 2), 823), + (datetime(2013, 2, 22), 672) + ]) + datey.x_label_format = "%Y-%m-%d" + datey.x_labels = [ + datetime(2013, 1, 1), + datetime(2013, 2, 1), + datetime(2013, 3, 1) + ] Pies ----