-
Notifications
You must be signed in to change notification settings - Fork 185
support dx, dy on all marks #488
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
Conversation
What’s the use case? Feels a bit niche. |
I often find I want to translate a mark by a few pixels, and bummed that only Plot.text offers this feature. This would be convenient to add a rule at the side of a bar, make shades, annotations / overlays (manual legends), separation lines between categories, etc. |
return create("svg:g") | ||
.call(applyIndirectStyles, this) | ||
.call(applyTransform, null, Y && y, 0, 0.5) | ||
.call(applyTransform, null, Y && y, dx, offset + dy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe in cases like this it would be preferable to initialize {dx = 0, dy = offset}, rather than adding offset to dy?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's a separate concern. If you want a shape to be 1px to the left of another, they should both be moved by .5px if that helps make them sharper.
oh, cool. I want this also very. :). to tell the truth, I'm hacking my example by using if this becomes a channel like the new behavior of |
Ref.: #174 |
@Fil hi, I've finally made my plot application public. (not on observablehq.com because i wanted full screen..) still, buggy, slow and ugly code. :) I think you can click around even if you don't understand: https://codepen.io/ryoqun/full/JjNbeyE fyi, we're using it like this: solana-labs/solana#18308 (comment) lastly, so, I want to plot multiple circles or rects per y/z with dx/dy shift if possible. :) |
(I'm happy to see a progress on this. thanks for working!) |
On all marks except text, dx and dy are rendered as a transform (translate) property, possibly with the 0.5px offset on high-density screens. On text marks, the dx and dy properties are used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 👍
On all marks except text, dx, dy are rendered as a transform(translate) or (x,y) property, possibly with the 0.5px offset on high-density screens. On text marks, the dx and dy properties are used.
closes #379
build : https://observablehq.com/@fil/plot-dx-dy-488 ; also available in https://observablehq.com/@fil/plot-early-bird