-
Notifications
You must be signed in to change notification settings - Fork 185
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
Marks, such as Plot.bar[XY], could implement (optional) labels directly to make it easier that using Plot.text. #81
Comments
This feels like a good, practical idea. I wonder if it should also apply to other marks such as lines and areas. |
In #82 it's a bit complicated: the bar labels in this example "work" only because the domain is made of single letters. We also need to have a text fill that depends on whether the label is on the mark or above it. Rather than try to solve all this for all cases from inside the barX mark (as suggested in #82), an interesting alternative might be to have a Plot.textBarX mark which would return the same (x,y) as the corresponding barX. Then the user could call the mark twice, one that filters the cases where the bar's height is too small, and add a negative dy and black fill, the other for large bars, with positive dy and white fill. * * * For areas we already have a few examples in the stack experiments. The most complex example is at https://observablehq.com/@data-workflows/u-s-population-by-state-1790-1990: the label is indexed by z, and follows a textPath based on the "mid" range of the stack ((low+high)/2), with a basis curve, which is less wiggly than "cardinal" or "monotone-x". Plus a heuristic to avoid overlaps between two consecutive labels. Related: #27 |
seems better to implement this as a composite mark (#171), in a "plugin" |
This comment has been minimized.
This comment has been minimized.
Here's a plugin that works well https://observablehq.com/d/0c2e2cbba57730d2 |
No description provided.
The text was updated successfully, but these errors were encountered: