Search code examples
altair

Can the interactive legend multiple field selection's default key be changed from shift to another key?


Take the example from the docs: https://altair-viz.github.io/gallery/interactive_legend.html. One can select multiple fields by using the shift key, but can the default behavior be changed so that one can use a different key, e.g., ctrl?

My issue with the default behavior is that the shift key selects the underlying text (see image):

enter image description here


Solution

  • I was able to change the key from shift to ctrl by adding toggle="event.ctrlKey" to the selection_point.