Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions demos/forecast_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def _(np, pl):

@app.cell
def _(AltairWidget):
widget = AltairWidget(width=600, height=400)
widget = AltairWidget(height=400)
return (widget,)


Expand Down Expand Up @@ -115,7 +115,6 @@ def _(df, fit_window, forecast_chart, projection_days, widget):
fit_window=fit_window.value,
projection_days=projection_days.value,
title="Synthetic metric forecast",
width=600,
)
return (time,)

Expand Down Expand Up @@ -152,7 +151,6 @@ def _(df, fit_window, forecast_chart, projection_days, time):
fit_window=fit_window.value,
projection_days=projection_days.value,
title="Synthetic metric forecast (plain)",
width=600,
)
return

Expand Down
7 changes: 3 additions & 4 deletions wigglystuff/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def forecast_chart(
fit_window: int = 180,
projection_days: int = 365,
title: str | None = None,
width: int | None = None,
width: int | str | None = None,
height: int = 400,
):
"""Create a time series chart with an exponential forecast.
Expand All @@ -123,7 +123,7 @@ def forecast_chart(
fit_window: Number of most-recent data points to use for the fit.
projection_days: How many days to project into the future.
title: Optional chart title.
width: Chart width in pixels. If None, uses Altair default.
width: Chart width in pixels, or "container" for responsive. Defaults to "container".
height: Chart height in pixels (default 400).

Returns:
Expand Down Expand Up @@ -229,10 +229,9 @@ def forecast_chart(

props = {
"height": height,
"width": width if width is not None else "container",
"usermeta": {"embedOptions": {"actions": False}},
}
if width is not None:
props["width"] = width
if title:
props["title"] = title

Expand Down
Loading