sadpandajoe commented on code in PR #42910:
URL: https://github.com/apache/superset/pull/42910#discussion_r4339770598
##########
superset/mcp_service/chart/preview_utils.py:
##########
@@ -2773,18 +2809,24 @@ def threshold_details(
)
layers: list[dict[str, Any]] = []
+ # Custom colors (if any) are authored positionally against the original,
+ # pre-sort `ranges` order via the `range_colors` control -- capture each
+ # range's color here, before the descending sort below reorders them.
+ # Mirrors Bullet/transformProps.ts exactly, so the MCP preview matches
+ # what Explore actually renders for the saved chart.
range_entries = sorted(
[
(
threshold,
label_at(model.range_labels, index, threshold, "Range"),
+ model.range_colors[index] if index < len(model.range_colors)
else "",
Review Comment:
A Bullet chart whose Ranges were cleared still carries its hidden
`range_colors` (the control keeps them on hide), and this line paints the
synthesized `[0, measure * 1.1]` band with that leftover color in the MCP
preview. For example, `ranges: ""`, `range_colors: ["#ff0000", "#00ff00"]` and
a metric result of 100 gives a green automatic band here, while Explore now
ignores `range_colors` unless `ranges` has user-entered values
(`Bullet/transformProps.ts`) and uses the default theme fill. Should the color
lookup apply only when `ranges` was explicitly supplied, so the preview matches
the saved chart?
--
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]