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.
For converting quantitative or temporal data into ordinal data.
The previous implementation of ordinal intervals #513 #849 uses a scale transform. This is fine if there’s no mark transform involved, but since the mark transforms run before the scale transform (i.e., the scale transform applies to the output of the mark transform rather than the input), it doesn’t help much in the case above, when grouping. I originally considered adding an interval option to the group transform, but that starts to get confusing with the existing interval mark option (which applies to the opposite dimension in the case of barY!), so I thought it better to have an explicit transform.
Regarding the implementation, I like the reuse of Plot.map, but I don’t like the plumbing required to propagate the knowledge that a channel has an associated interval. I added the plumbing to the group transform for x and y, but I didn’t add it anywhere else, so there’s probably some cases where this isn’t going to work. This plumbing is needed to ensure that the (ordinal) scale produces a tick for every interval value in the domain, and to suppress the warning that would otherwise occur when using quantitative or temporal data with an ordinal scale.
Another confusing aspect is that there’s already the interval mark option, but that does something else, which is converting a singular value into an extent [start, stop]. Like, in the case of barY, now I wonder if the interval option should instead apply to the x channel to quantize values, instead of applying to the y channel like it does now. I don’t want to make a backwards-incompatible change, though.Maybe this suggests that we should call this the “quantize” transform instead of the “interval” transform? Update: Yes, we’ll use the name “quantize” instead.TODO
Plot.intervalPlot.quantize transform for any channel (akin to Plot.map)?