diff --git a/pages/chart_types.rst b/pages/chart_types.rst index de18d15..bfb6bd3 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 ----