Mercurial > ~darius > hgwebdir.cgi > agl
diff agl.py @ 18:156ab071a9de
Only print the start date if the duration is 1 day
author | Daniel O'Connor <darius@dons.net.au> |
---|---|
date | Mon, 11 Sep 2017 22:46:50 +0930 |
parents | 227a2a524675 |
children | 1d08f777533f |
line wrap: on
line diff
--- a/agl.py Mon Sep 11 22:46:37 2017 +0930 +++ b/agl.py Mon Sep 11 22:46:50 2017 +0930 @@ -280,7 +280,10 @@ ha = 'left', va = 'top') ndays = int(max(1, round(((end - start).total_seconds()) / 86400))) for ax in fig.get_axes(): - ax.set_title('%s to %s' % (startlt.strftime('%Y-%m-%d'), endlt.strftime('%Y-%m-%d'))) + if (endlt - startlt).total_seconds() > 86400: + ax.set_title('%s to %s' % (startlt.strftime('%Y-%m-%d'), endlt.strftime('%Y-%m-%d'))) + else: + ax.set_title('%s' % (startlt.strftime('%Y-%m-%d'))) ax.set_xlim([start, end]) ax.format_xdata = lambda d: matplotlib.dates.num2date(d).strftime('%d %b %H:%M') ax.xaxis.grid(True)