aminghadersohi commented on code in PR #38403:
URL: https://github.com/apache/superset/pull/38403#discussion_r2931758002
##########
superset/mcp_service/app.py:
##########
@@ -116,6 +116,8 @@ def get_default_instructions(branding: str = "Apache
Superset") -> str:
- chart_type="xy", kind="bar": Bar chart for category comparison
- chart_type="xy", kind="area": Area chart for volume visualization
- chart_type="xy", kind="scatter": Scatter plot for correlation analysis
+- chart_type="big_number": Big Number display (single metric, header only)
+- chart_type="big_number", show_trendline=True: Big Number with trendline
Review Comment:
Valid. Updated the instruction to include `temporal_column="<date_col>"`
since it's required when `show_trendline=True`. Fixed in e96b325.
##########
superset/mcp_service/chart/chart_utils.py:
##########
@@ -615,6 +619,59 @@ def map_pie_config(config: PieChartConfig) -> Dict[str,
Any]:
"date_format": "smart_date",
}
+ if time_range := getattr(config, "time_range", None):
+ form_data["time_range"] = time_range
+
+ if config.filters:
+ form_data["adhoc_filters"] = [
+ {
+ "clause": "WHERE",
+ "expressionType": "SIMPLE",
+ "subject": filter_config.column,
+ "operator": map_filter_operator(filter_config.op),
+ "comparator": filter_config.value,
+ }
+ for filter_config in config.filters
+ if filter_config is not None
+ ]
+
+ return form_data
+
+
+def map_big_number_config(config: BigNumberChartConfig) -> Dict[str, Any]:
+ """Map big number chart config to Superset form_data."""
+ # Determine viz_type: big_number (with trendline) or big_number_total
+ if config.show_trendline and config.temporal_column:
+ viz_type = "big_number"
+ else:
+ viz_type = "big_number_total"
+
+ metric = create_metric_object(config.metric)
+ form_data: Dict[str, Any] = {
+ "viz_type": viz_type,
+ "metric": metric,
+ }
Review Comment:
Valid. Added `form_data["show_trend_line"] = True` in the big_number
trendline branch. Fixed in e96b325.
--
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]