I am trying to plot a chart which needs to have duration times in terms of "days, hours, minutes" on the Y axis and just dates on the X axis. I can do this easily if the duration is expressed in seconds but in order to improve readability I'd like to change the Y labels to be something like DTHH:MM, e.g., 1 Day(s) 10:23. Does anyone know how can this be accomplished?
This is my current code snippet:
chart = (
alt.Chart(aggregated_df, title=metric_name_to_display)
.mark_line(point=True)
.encode(
alt.X(f"yearmonthdatehours({QUERY_TIME_COLUMN_NAME}):O").title("Date"),
alt.Y(f"{metric_name}:Q").title(metric_name_to_display),
alt.Color("Index:N"), # type: ignore
alt.Tooltip(
[metric_name, f"yearmonthdatehours({QUERY_TIME_COLUMN_NAME}):O"]
),
)
)
where aggregated_df is of the form
query_time recovered_seconds_all_ingest
0 2024-01-01 00:00:00+00:00 827183
1 2024-01-01 12:00:00+00:00 1832
2 2024-01-02 00:00:00+00:00 829301
3 2024-01-02 12:00:00+00:00 29191