Skip to content

Commit f3079e7

Browse files
author
Nick Canzoneri
committed
Add date formatting to x-axis
1 parent 8f6fa77 commit f3079e7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/penn_chime/charts.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from .parameters import Parameters
99
from .utils import add_date_column
10+
from .presentation import DATE_FORMAT
1011

1112

1213
def new_admissions_chart(
@@ -26,7 +27,7 @@ def new_admissions_chart(
2627
tooltip_dict = {False: "day", True: "date:T"}
2728
if as_date:
2829
projection_admits = add_date_column(projection_admits)
29-
x_kwargs = {"shorthand": "date:T", "title": "Date"}
30+
x_kwargs = {"shorthand": "date:T", "title": "Date", "axis": alt.Axis(format=(DATE_FORMAT))}
3031
else:
3132
x_kwargs = {"shorthand": "day", "title": "Days from today"}
3233

@@ -58,7 +59,7 @@ def admitted_patients_chart(
5859
as_date = parameters.as_date
5960
if as_date:
6061
census = add_date_column(census)
61-
x_kwargs = {"shorthand": "date:T", "title": "Date"}
62+
x_kwargs = {"shorthand": "date:T", "title": "Date", "axis": alt.Axis(format=(DATE_FORMAT))}
6263
idx = "date:T"
6364
else:
6465
x_kwargs = {"shorthand": "day", "title": "Days from today"}
@@ -101,7 +102,7 @@ def additional_projections_chart(
101102

102103
if as_date:
103104
dat = add_date_column(dat)
104-
x_kwargs = {"shorthand": "date:T", "title": "Date"}
105+
x_kwargs = {"shorthand": "date:T", "title": "Date", "axis": alt.Axis(format=(DATE_FORMAT))}
105106
else:
106107
x_kwargs = {"shorthand": "day", "title": "Days from today"}
107108

0 commit comments

Comments
 (0)