Skip to content

Commit

Permalink
Avoid calling to_dict() since validate=False is currently not sup…
Browse files Browse the repository at this point in the history
…ported for channels
  • Loading branch information
joelostblom committed Apr 4, 2024
1 parent 80a0431 commit e595c38
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions altair/vegalite/v5/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3076,21 +3076,31 @@ def interactive(
interactive_chart.mark.tooltip = tooltip
if legend:
if not isinstance(legend, list):
# Detect common legend encodings used in the spec
# Set the legend to commonly used encodings by default
legend = [
enc
for enc in self.encoding.to_dict().keys()
if enc
in [
"angle",
"radius",
"color",
"fill",
"shape",
"size",
"stroke",
]
"angle",
"radius",
"color",
"fill",
"shape",
"size",
"stroke",
]
# Detect common legend encodings used in the spec
# legend = [
# enc
# for enc in interactive_chart.encoding.to_dict(validate=False).keys()
# if enc
# in [
# "angle",
# "radius",
# "color",
# "fill",
# "shape",
# "size",
# "stroke",
# ]
# ]
legend_selection = selection_point(bind="legend", encodings=legend)
interactive_chart = interactive_chart.add_params(
legend_selection,
Expand Down

0 comments on commit e595c38

Please sign in to comment.