Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Supersedes #438.
Ref. #417 (comment).
This adds special logic to marks with continuous position dimensions such that when the associated scale’s domain is collapsed (i.e., all values in the input domain map to the same value in the output range), the mark spans the full extent of the chart. For example, here is a plot with the collapsed y-domain [0, 0]; note that the bar and rule span the full y-extent of the chart. Previously this chart would be empty because the bar and rule would have zero height.
In practice, this seems most likely to occur when binning values that all happen to be equal, but unlike #438 this does not change the semantics of the chart and thus is more robust and general.
The isCollapsed check could be memoized if performance is a concern in the future, given how rare it is for a scale to be collapsed. And also it’s slightly unfortunate that this logic must be applied by mark implementations rather than somehow generalizing to the scales. I think it might be possible to do this more generically, and faster, but this seems fine for now?