Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed interaction with selection defaults #568

Open
declann opened this issue Oct 28, 2024 · 2 comments
Open

Fixed interaction with selection defaults #568

declann opened this issue Oct 28, 2024 · 2 comments

Comments

@declann
Copy link

declann commented Oct 28, 2024

I'm setting selection defaults through menu inputs that have values set.

Fixed scale domain setting I'm using behaves as advertised in that the scale domain doesn't change on subsequent data updates.

But, I expected the domain calculation to include all data.

It's filtered to the default selection however. It might be ambiguous but this seems like a bug to me?

To reproduce:

  1. Go to specs/yaml/sorted-bars.yaml, which has a default selection for acquatics
  2. add xDomain: Fixed

Here is a gif of the result:

Screencast.from.2024-10-28.20-24-50.webm

The domain is fixed but whenever I select All, then data is truncated.


When I fix the domain with no default selection I see a fuller representation:

image

Should Fixed give this range, independent of the default selection?

@jheer
Copy link
Member

jheer commented Oct 29, 2024

Hi @declann, unfortunately you're running up against a current limitation of vgplot. The Fixed domain setting fixes the domain based on the first values it sees. For many mark types we hand queried data over to Observable Plot and then use the domain settings it chooses based on the chart attributes.

To get the "full" domain we need to get the full range of values from the database. Fortunately, this is something you can also do yourself if you're using the JavaScript API. Though more cumbersome, you can query DuckDB (e.g., using coordinator.query()) to get value ranges and determine a hard-wired domain of your own to pass into your chart spec.

For more automatic support (inc. from YAML/JSON specs), we'd need to extend vgplot to perform this logic behind the scenes. I'll interpret this issue as a feature request for this support.

@declann
Copy link
Author

declann commented Oct 29, 2024

JS API workaround work for me, thanks Jeff and thanks for the explanation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants