Demography graph with text marks? #1073
Unanswered
knutwannheden
asked this question in
Q&A
Replies: 1 comment
-
You can specify two text marks with separate options. Then apply a filter to one for the left values, and an opposite filter for the right values. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am trying to render a classical demography mark using
Plot.barX()
withPlot.stackX2()
(somewhat similar to https://observablehq.com/@observablehq/plot-stack?collection=@observablehq/plot#cell-521). Now I would also like text marks to display the actual values.I was able to get the text mark to show, but since I have bars going "left" and "right", the text is always inside the bar on one side and outside of the bar on the opposite side. I was hoping that I would be able to specify the value for
textAnchor
(orframeAnchor
) using a function, in which case I would have been able to get it to work, but that doesn't seem to be work. Same thing goes fordx
. The only thing I got working was when I "manually" added an offset to thex
property. I am just unsure if it is expected that I cannot definetextAnchor
anddx
as a function (something likedx: d => ...
) just like I can with most other properties.This is the result I was trying to obtain (which also works by manually adding the offset in the
x
computation):Beta Was this translation helpful? Give feedback.
All reactions