Conversation
|
I guess this should probably set default insets, too, like e.g. bin does? |
Fil
left a comment
There was a problem hiding this comment.
Should we expose this in some way, so that custom marks could have access to this new transform?
I'm sending a few suggestions in another PR
|
|
||
| function maybeInset(inset, inset1, inset2) { | ||
| return inset === undefined && inset1 === undefined && inset2 === undefined | ||
| ? (offset ? [1, 0] : [0.5, 0.5]) |
There was a problem hiding this comment.
(This is not new) The default inset makes the marks vanish if they are too narrow. For example in aapl-volume-rect, if you take the whole dataset instead of just a slice, the resulting chart is blank.
There was a problem hiding this comment.
I’m aware of this problem but not going to fix it here. 👍
|
I don’t think we should expose the interval (or inset) transform yet, out of conservatism, but we can always chose to do so in the future if we think it’s useful. |
|
I think I want to add the interval transform to bar and rule, too. |
56d3da8 to
cb26d3f
Compare
|
Added. Works nicely! |
Adds an interval option for rects which transforms x to x1 and x2 using interval.floor and interval.offset. This provides a suitable replacement for bars when an axis is temporal rather than ordinal. Related #513, and perhaps this could be considered a fix.
I’d further love to be able to specify a named interval such as “day” or “hour”, but this requires knowing the time zone (or for now, whether the associated scale is “utc” or local “time”). That’s not easily accessible when evaluating a transform since this happens before scales are constructed. Although I suspect that with a top-level timeZone option #531 we could find some way of passing this down to the transform. At any rate, convenience shorthand can be added in the future.