Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

fix: add warning about vegafusion not working with chart selection (#4609)

Myles Scolnick60c740aa89b8
diff --git a/marimo/_plugins/ui/_impl/altair_chart.py b/marimo/_plugins/ui/_impl/altair_chart.py
index e8b6a6c089..0b23a17d57 100644
--- a/marimo/_plugins/ui/_impl/altair_chart.py
+++ b/marimo/_plugins/ui/_impl/altair_chart.py
@@ -79,6 +79,13 @@ def _has_geoshape(spec: altair.TopLevelMixin) -> bool:
return False
+def _using_vegafusion() -> bool:
+ """Return True if the current data transformer is vegafusion."""
+ import altair
+
+ return altair.data_transformers.active.startswith("vegafusion") # type: ignore
+
+
def _filter_dataframe(
native_df: IntoDataFrame, selection: ChartSelection
) -> IntoDataFrame:
@@ -378,6 +385,17 @@ class altair_chart(UIElement[ChartSelection, ChartDataType]):
)
chart_selection = False
+ if _using_vegafusion() and (
+ has_chart_selection or has_legend_selection
+ ):
+ chart_selection = False
+ legend_selection = False
+ sys.stderr.write(
+ "Selection is not yet supported in vegafusion.\n"
+ "You can follow the progress here: "
+ "https://github.com/marimo-team/marimo/issues/4601"
+ )
+
self.dataframe: Optional[ChartDataType] = (
self._get_dataframe_from_chart(chart)
)