Skip to content

Leader line elbows - #396

Open
sam-ctrl wants to merge 5 commits into
mainfrom
leader-line-elbows
Open

Leader line elbows#396
sam-ctrl wants to merge 5 commits into
mainfrom
leader-line-elbows

Conversation

@sam-ctrl

Copy link
Copy Markdown
Contributor

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

@henryjameslau

Copy link
Copy Markdown
Contributor

I bet this is gonna break slope charts #387

@sam-ctrl

Copy link
Copy Markdown
Contributor Author

I bet this is gonna break slope charts #387

Could we have a createDirectLabelsSlope() function for now, and then work on integrating the two once the separate PRs are merged?

@henryjameslau

Copy link
Copy Markdown
Contributor
image I feel like this is more confusing when they overlap so we might need to have to add staggering

@broadpeter

broadpeter commented Feb 9, 2026

Copy link
Copy Markdown
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.

@henryjameslau

Copy link
Copy Markdown
Contributor

Let's use the ELS algorithm
image

@nrennie

nrennie commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Is this PR still "Ready to merge" if we're going to use the ELS algorithm?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants