bito-code-review[bot] commented on code in PR #38403:
URL: https://github.com/apache/superset/pull/38403#discussion_r2894956829


##########
superset/mcp_service/chart/chart_utils.py:
##########
@@ -585,40 +638,55 @@ def map_filter_operator(op: str) -> str:
     return operator_map.get(op, op)
 
 
-def generate_chart_name(config: TableChartConfig | XYChartConfig) -> str:
+def generate_chart_name(
+    config: TableChartConfig | XYChartConfig | BigNumberChartConfig,
+) -> str:
     """Generate a chart name based on the configuration."""
     if isinstance(config, TableChartConfig):
-        return f"Table Chart - {', '.join(col.name for col in config.columns)}"
+        cols = ", ".join(col.name for col in config.columns)
+        return f"Table Chart - {cols}"
     elif isinstance(config, XYChartConfig):
         chart_type = config.kind.capitalize()
         x_col = config.x.name
         y_cols = ", ".join(col.name for col in config.y)
         return f"{chart_type} Chart - {x_col} vs {y_cols}"
+    elif isinstance(config, BigNumberChartConfig):
+        metric_label = (
+            config.metric.label or 
f"{config.metric.aggregate}({config.metric.name})"
+        )
+        if config.show_trendline:
+            return f"Big Number - {metric_label} (with trendline)"
+        return f"Big Number - {metric_label}"
     else:
         return "Chart"
 
 
+def _resolve_viz_type(config: Any) -> str:
+    """Resolve the Superset viz_type from a chart config object."""
+    chart_type = getattr(config, "chart_type", "unknown")
+    if chart_type == "xy":
+        kind = getattr(config, "kind", "line")
+        viz_type_map = {
+            "line": "echarts_timeseries_line",
+            "bar": "echarts_timeseries_bar",
+            "area": "echarts_area",
+            "scatter": "echarts_timeseries_scatter",
+        }
+        return viz_type_map.get(kind, "echarts_timeseries_line")
+    elif chart_type == "table":
+        return getattr(config, "viz_type", "table")
+    elif chart_type == "big_number":
+        show_trendline = getattr(config, "show_trendline", False)
+        return "big_number" if show_trendline else "big_number_total"

Review Comment:
   <!-- Bito Reply -->
   Your explanation clarifies the design intent: _resolve_viz_type uses 
show_trendline as the key differentiator for big_number vs big_number_total, 
while header_only is a separate display option that works with either viz type.



-- 
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