| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
If you are interested in this please let me know. #7870 was just merged into v4.0, and would need some rework here to incorporate correct positioning. |
Sorry, something went wrong.
|
@wf-r go for it. You'll need to change the target branch to v4.0. |
Sorry, something went wrong.
I think I am not allowed to do it (or I don't find the option). Can you do this, please? |
Sorry, something went wrong.
|
Please have a look at this. |
Sorry, something went wrong.
…ominant-baseline, use block-shift like node labels), thread _d3locale/_meta/fallback through texttemplateString, and dedupe the orientation counter-transform into a shared uprightTransform helper.Also make opted-out traces free of per-link work by short-circuiting linkTextGetter to null.
|
I'm done for today. Things one could discuss:
|
Sorry, something went wrong.
… group (fixes z-order with entering link paths), thread the label selection through updateShapes/attachDragHandler/startForce instead of DOM-querying every drag frame, and build each link's model once via a shared linkModels cache instead of duplicating it for paths and labels; exiting labels now fade out like links, and per-link texttemplate lookups use pointNumber instead of the loop index. Also switch link.texttemplate to the shared texttemplateAttrs() helper for a standard description and %{meta} support. More details in draftlog.
|
Sorry, something went wrong.
|
I'm back, sorry I was busy with other work.
You are right, link.valueformat could be removed in favor of trace.valueformat (which is already used for link and node hovers). As for link.textfont: Would we like to style labels different from nodes or node hovers? If not we could remove it and use trace.textfont. There are some plots that use different textfonts for different components (treemap), I have no preference how to do it here.
Sankey nodes and links do a ....exit()
.transition()
.ease(c.ease).duration(c.duration)
.style('opacity', 0)
.remove();
while the link label just does sankeyLinkLabel.exit().remove();. So if we e.g. filter links we get a slightly different behaviour between link label and link itself. |
Sorry, something went wrong.
|
This got closed by accident! I still want to get the work merged, but the v4.0 branch got deleted and now I can't change the base branch of the PR. I'll see if there's another way to get this open again. |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Add permanent text labels to Sankey links
What
Adds persistent, always-visible text labels to Sankey links, analogous to the existing node
labels. Five new attributes under link:
Why
Link information is currently hover-only, making Sankey diagrams unsuitable for static export
(PNG/SVG/print) wherever flow values or names need to be visible at all times. There is
long-standing community interest in this — see #4746.
External SVG overlays (the current workaround) are fragile: they break on node drags, require
timing hacks after layout transitions, and are excluded from toImage export. Native labels
solve all three problems.
How
Labels are rendered as real SVG <text> elements inside the .sankey group, immediately after
the link paths. This means:
h and v layouts with no extra handling.
needed.
For circular (backward) links the label anchor reuses the same circularPathData midpoint as
the hover label, so the position is consistent. Vertical centering on the anchor uses
dominant-baseline="central".
Template rendering follows the established funnel/pie pattern via Lib.texttemplateString.
Available template variables: %{label}, %{value}, %{valueLabel} (formatted value +
suffix), %{source}, %{target}, %{customdata}.
Backward compatibility
Fully backward compatible. All new attributes default to textinfo: 'none' / texttemplate: '',
so existing figures render identically. No existing tests or baselines are affected.
Related