All examples By author By category About

ijlyttle

Selection question for Vega-Lite

The dataset has the following columns:

I have set up an interval selection that works on the x and y encodings; the selection resolves globally.

As it currently works, points are highlighted if they are inside the x and y extents of the selection, regardless of the facet that it is in.

What I would like to do

I would like for my interval selection to know which facet it is "inside" (perhaps it does already) such that I could:

  1. Identify the value of key for each point that falls inside the selection interval and has the value of group for the facet used for the selection. In essence, identify only those observations that fall inside the "little grey box". Again, I realize this may already be the case.

  2. Use a condition expression (or a filter expression, if I need to use the filter + layer technique used for the crossfilter example) that identifies those observations where datum.key is in selection.key, where selection is the "selected" part of the dataset from part 1.

Part of my problem is that I don't see that there is a way to use an expression like selection.key.

Other approaches and motivation

I can work around this by using "wide" data, rather than "tall" data. The problem is that once I do this, my Vega-Lite spec is no longer generalizable becuse it will depend on given values for group to be part of the column names.