constant numeric x and y for text marks
position the text relative to the anchor
anchor can be any of "top", "bottom", "left", "right" or combinations such as "top-left"
demo: https://observablehq.com/@observablehq/text-facet-alignment-523
closes #523
todo:
- [x] create unit tests for the possible anchors
- [ ] should "right" and "bottom" be counted "inwards" like in css?
- [ ] generalize to all marks?
A question: here we add x and y regardless of the anchor, but we could decide that the sign of the "right" and "bottom" positions should be negated (to go "inset"). I don't know which is the most intuitive.
converted to draft with the two questions that came up in review
I've now generalized the feature to dots and images. Not sure if it can/should be done for other marks?
Demo https://observablehq.com/@fil/constant-numeric-x-y-594
Obsolete. This can be achieved with frameAnchor: left and dx: 10 instead of x: 10.