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

Allow config to set default scale.zero per marktype #8324

Closed
yhoonkim opened this issue Jul 27, 2022 · 7 comments
Closed

Allow config to set default scale.zero per marktype #8324

yhoonkim opened this issue Jul 27, 2022 · 7 comments
Assignees
Milestone

Comments

@yhoonkim
Copy link
Contributor

yhoonkim commented Jul 27, 2022

scale.zero is true as default for x and y channels if the quantitative field is not binned and no custom domain is provided; false otherwise. (https://vega.github.io/vega-lite/docs/scale.html )
Though, for some range-based-marktype (e.g., point, box plot). zero: true might not be useful default; if the data are mostly distributed 10M~11M and if the scale includes zero, the point marks for those data will look like just a single dot.

Even the example scatter plot in VL editor uses zero: false. If we delete it, it looks like this:
image

--
Suggestion
Assuming that many VL users may be already used to the current default, I would like to suggest adding config.scale.zero to change the default instead of changing system default.

{
  "config": { "scale": {"zero": "always" } } 
}

-> Keep the system defulat: scale.zero is true as default for x and y channels if the quantitative field is not binned and no custom domain is provided; false otherwise.

{
  "config": { "scale": {"zero": "range-mark-only" } } 
}

-> scale.zero is true as default for y(/x) channel if the quantitative field is not binned and no custom domain is provided and it is vertical (/horizontal) bar and area; false otherwise.

CC; @kanitw

@kanitw
Copy link
Member

kanitw commented Jul 27, 2022

For implementation, you can look at zero() in src/compile/scale/properties.ts.

@kanitw
Copy link
Member

kanitw commented Jul 27, 2022

Btw, look at existing behavior, I just realize that "always" isn't very accurate.

So maybe:

zero: "all-marks" | "bar-and-area-only" 

@kanitw
Copy link
Member

kanitw commented Jul 27, 2022

cc: @domoritz @arvind @jheer any opinion about the config name?

@domoritz
Copy link
Member

domoritz commented Aug 9, 2022

If we only have two options, I wonder whether we could consider a Boolean.

Otherwise I think all marks, and range marks or bar and area makes sense. I don't think we need to say range marks only.

@kanitw
Copy link
Member

kanitw commented Aug 9, 2022

FWIW, vega/vega#1471 is related to this.
(Adding dynamic zero with threshold is probably gonna be a better default than always off.)

In terms of sequencing, I think add this config in Vega-Lite first would be easier (since it's simpler).

@kanitw kanitw added this to the 2022 Aug Polishes milestone Aug 9, 2022
@kanitw
Copy link
Member

kanitw commented Aug 9, 2022

Some more thoughts:

  • Btw, I think "range mark" is a bit vague -- I don't think we have use the key word anywhere else.

  • Suppose we add dynamic default in the future with some syntax like {threshold: 0.25} (it might not be this syntax, but we need to make our syntax future proof).

  • Thinking more, we could also just add zero: boolean; to config.scale but make it not applicable to non-range bar/area

    • Basically config.scale.zero will be applicable for point/line, etc., but not for non-range bar/area chart.
    • For ranged bar (e.g., gantt chart and ranged area, we also don't need to include zero), so config.scale.zero should also be applicable to them.

@kanitw
Copy link
Member

kanitw commented Aug 16, 2022

fixed in #8354

@kanitw kanitw closed this as completed Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants