Leader line elbows - #396
Open
sam-ctrl wants to merge 5 commits into
Open
Conversation
Contributor
|
I bet this is gonna break slope charts #387 |
Contributor
Author
Could we have a createDirectLabelsSlope() function for now, and then work on integrating the two once the separate PRs are merged? |
Contributor
Contributor
|
In this example would be better if the category 2 went down. With less padding and downward shifts it would be a lot better. Possible only needing a leader for the top most 1 or 2. |
Contributor
Contributor
|
Is this PR still "Ready to merge" if we're going to use the ELS algorithm? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


This is a bit of a can of worms, but after the slack conversation about having "elbowed" (orthogonal? horizontal-vertical-horizontal) leader lines, this is what I though we should do.
It now only draws leader lines if they are needed, and it adds some margin to account for them.
It has some special handling for "early ending" series. You can set it with the "labelLocation" to either draw it off to the right vertically aligned with the other labels (labelLocation: "margin") with a leader line (labelLocation: "marginLeader"), or next to the last point (labelLocation: "lastPoint")
You can also set the style of the leader lines to be dashed or solid, and to have the colour of the corresponding series or a standard (configurable) colour.
The leader lines now also point to the vertical centre of the direct labels
It might be a bit too configurable (have added a fair bit to the config files) and could maybe be trimmed down a bit.
When there are many leader lines (>4 in a cluster), it's can a bit difficult to see what is what, this could be helped maybe by offsetting the vertical parts of the leader lines (a bit how ourworldindata do it) but I think it would add significant complexity to something that is already quite complex!
I might implement the "symbols" aspect that was also discussed as a different PR shortly