vega / vega-lite

A concise grammar of interactive graphics, built on Vega.
https://vega.github.io/vega-lite/
BSD 3-Clause "New" or "Revised" License
4.61k stars 598 forks source link

useRawDomain should be pre-filter? #1327

Closed light-and-salt closed 7 years ago

light-and-salt commented 8 years ago

Should filter affect the raw data domain? Right now, if I set both transform.filter and config.scale.includeRawDomain in a Vega-lite spec, I get the filtered data domain instead of the raw data domain.

For example, if I filter out Europe and set includeRawDomain to true, I no longer have Europe in my legend. This suggests that the color scale has the filtered data domain instead of the raw data domain.

filter_rawdomain

Similarly, filtering on Horsepower and setting includeRawDomain to true also gives me the filtered data domain. filter_x

Can we make the raw domain pre-filter so that we can always get the raw domain when includeRawDomain is true?

light-and-salt commented 8 years ago

Here's a scenario where I want to use the raw domain. When I have multiple visualizations of the same data set on the same screen (e.g. in narrative visualizations, in visualization recommender systems), I want the color mappings to be consistent across visualizations. Therefore I always want to set the domain of the color scale to raw.

consistent_colors

light-and-salt commented 8 years ago

@domoritz will this be easy or hard to do?

kanitw commented 8 years ago

The right question is how would this affect the transform order we discussed earlier

domoritz commented 8 years ago

So you want it to be pre-filter and also pre selection filter? I'm not sure whether we are putting too much configurability into Vega-Lite with this.

On Fri, Apr 29, 2016 at 6:33 PM Kanit Wongsuphasawat < notifications@github.com> wrote:

The right question is how would this affect the transform order we discussed earlier

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/vega/vega-lite/issues/1327#issuecomment-215898733

kanitw commented 8 years ago

I'm not surewhether we are putting too much configurability into Vega-Lite with this.

Well, it's not extra level of configurabililty. This discuss doesn't add new config, but rather discuss how existing config should behave.

domoritz commented 8 years ago

Well, it's not extra level of configurabililty. This discuss doesn't add new config, but rather discuss how existing config should behave.

My comment was regarding the option to change the behavior of inlcudeRawDomain.

Concerning the default. I don't think there is a clear preference for either behavior.

kanitw commented 8 years ago

Trying the new quick filter UI and I feel very strongly that useRawDomain should be pre-filter.
(Otherwise we're moving quick filter and scale domain changes!)

kanitw commented 8 years ago
// only applied to aggregate table
    fieldDef.aggregate &&
kanitw commented 8 years ago

Hmm Tableau is actually NOT doing this, so I'm not sure about this anymore.

kanitw commented 7 years ago

I think we can just explain in the docs that this is only applied after filter and close this issue?

g3o2 commented 7 years ago

In a high level grammar, if something is named raw then a user would probably expect it to be raw. Otherwise includeFilteredDomain could be an acceptable name.

kanitw commented 7 years ago

Closing in favor of #1656