sadpandajoe commented on code in PR #42910:
URL: https://github.com/apache/superset/pull/42910#discussion_r4323642216


##########
superset/mcp_service/chart/preview_utils.py:
##########
@@ -2799,9 +2834,18 @@ def threshold_details(
                     "x": {"datum": axis_min, "type": "quantitative"},
                     "x2": {"datum": threshold},
                     "y": y_encoding,
-                    "color": legend_color(
-                        (f"{label}: " if label else "")
-                        + f"≤ {_format_bullet_number(model.y_axis_format, 
threshold)}"
+                    # A custom `range_colors` entry wins; otherwise fall back
+                    # to the default categorical legend coloring exactly as
+                    # before this control existed, so a Bullet chart saved
+                    # without `range_colors` previews unchanged.
+                    "color": (
+                        {"value": color}

Review Comment:
   With a custom color set, the band layer switches to a constant `{"value": 
color}` encoding, so it no longer contributes a legend entry. For 
`ranges="50,100"` with both `range_colors` set and `show_legend=True`, the 
preview legend lists only the metric while Explore still lists both ranges. 
Should the custom-colored bands keep a nominal legend entry, for example by 
mapping the label to the color through the encoding's `scale` rather than a 
constant value?



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