aminghadersohi commented on code in PR #37639:
URL: https://github.com/apache/superset/pull/37639#discussion_r2760151895


##########
superset/mcp_service/chart/tool/get_chart_preview.py:
##########
@@ -279,6 +292,19 @@ def generate(self) -> VegaLitePreview | ChartError:
                     utils_json.loads(self.chart.params) if self.chart.params 
else {}
                 )
 
+            # Build columns list: include both x_axis and groupby
+            x_axis_config = form_data.get("x_axis")
+            groupby_columns = form_data.get("groupby", [])
+
+            columns = groupby_columns.copy()
+            if x_axis_config and isinstance(x_axis_config, str):
+                if x_axis_config not in columns:
+                    columns.insert(0, x_axis_config)
+            elif x_axis_config and isinstance(x_axis_config, dict):
+                col_name = x_axis_config.get("column_name")
+                if col_name and col_name not in columns:
+                    columns.insert(0, col_name)

Review Comment:
   Same as above — `x_axis` is always a string in MCP-generated charts. The 
dict fallback matches the existing `ASCIIPreviewStrategy` pattern.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to