observablehq / plot

A concise API for exploratory data visualization implementing a layered grammar of graphics
https://observablehq.com/plot/
ISC License
4.25k stars 173 forks source link

Interactive legends #1184

Open EE2dev opened 1 year ago

EE2dev commented 1 year ago

It would be great to have interactive legends

There are many interaction patterns where the user interacting with the legend is most intuitive, e.g.: 1) legend represents the mapping of categories to colors --> user may want to unselect/ select categories by clicking on the corresponding color/category in the legend --> user may want to change color mappings by clicking on the colors

2) legend represents the mapping of intervals to colors --> user may want to change the interval ranges which would update the Plot

Is it planned the legends will become interactive at one point? Or will the legends remain static and the recommendation is e.g. to build custom Inputs on observable for that?

Fil commented 1 year ago

It's not planned in the short run, but contributions and experiments are welcome. You can use the chart.scale method to retrieve the scale and create an interactive widget that in turn will make changes to some global state that controls the chart definition?

Fil commented 1 year ago

See @tophtucker 's experiment https://observablehq.com/@tophtucker/interactive-plot-legend

brylie-wolt commented 1 year ago

Interaction, in general, is essential for exploratory data analysis. Often, programmers can't anticipate the questions people will raise when reviewing data dashboards, presentations, etc. So, adding interactive filtering, slicing, etc., will open doors for real-time exploration.

For comparison, Altair supports interactive legends, selection, and cross-filtering.

helloromana commented 4 months ago

Just dropping in to say "I'm begging you,,, please ADD INTERACTIVE LEGEND"