Skip to content

Commit e595c38

Browse files
committed
Avoid calling to_dict() since validate=False is currently not supported for channels
1 parent 80a0431 commit e595c38

File tree

1 file changed

+23
-13
lines changed

1 file changed

+23
-13
lines changed

altair/vegalite/v5/api.py

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3076,21 +3076,31 @@ def interactive(
30763076
interactive_chart.mark.tooltip = tooltip
30773077
if legend:
30783078
if not isinstance(legend, list):
3079-
# Detect common legend encodings used in the spec
3079+
# Set the legend to commonly used encodings by default
30803080
legend = [
3081-
enc
3082-
for enc in self.encoding.to_dict().keys()
3083-
if enc
3084-
in [
3085-
"angle",
3086-
"radius",
3087-
"color",
3088-
"fill",
3089-
"shape",
3090-
"size",
3091-
"stroke",
3092-
]
3081+
"angle",
3082+
"radius",
3083+
"color",
3084+
"fill",
3085+
"shape",
3086+
"size",
3087+
"stroke",
30933088
]
3089+
# Detect common legend encodings used in the spec
3090+
# legend = [
3091+
# enc
3092+
# for enc in interactive_chart.encoding.to_dict(validate=False).keys()
3093+
# if enc
3094+
# in [
3095+
# "angle",
3096+
# "radius",
3097+
# "color",
3098+
# "fill",
3099+
# "shape",
3100+
# "size",
3101+
# "stroke",
3102+
# ]
3103+
# ]
30943104
legend_selection = selection_point(bind="legend", encodings=legend)
30953105
interactive_chart = interactive_chart.add_params(
30963106
legend_selection,

0 commit comments

Comments
 (0)