Skip to content

Edge Label Styling

An edge's label sits on a plate that can be restyled, padded, rounded or removed, and the text itself styled - all properties of the BlowEdge. Use them to match labels to a theme, to make one label stand out, or to fit the plate to an unusual font.

defaultapprovedno plateillili vs WWMMWW
Plain
…
Styled
…
No plate
…
Mixed width
…
bit Blow

Try it

  • Compare the four labels: the default plate, a green one with its own text and plate styles, one with no plate at all, and one of letters of very different widths.
  • Move Padding X and Padding Y: every plate widens or deepens round its text; the label with no plate stays as it is.
  • Move Radius: the plates' corners go from square at 0 to pills.
  • Look at the illili vs WWMMWW label at Padding X 0: the plate still roughly fits, since narrow and wide letters are counted at different widths.
  • Scroll to zoom: labels are drawn in the zoomed layer, so they scale with the flow.

How it works

  • Label is drawn at the path's midpoint, and is also the edge's accessible name.
  • LabelStyle is an inline style for the SVG text (fill, font-weight, ...), and LabelBgStyle one for the plate behind it (fill, stroke, ...). The plate's default fill is 85% opaque, so the green one sets fill-opacity:1.
  • LabelShowBg (true by default) draws the plate; false leaves the bare text on the line.
  • LabelBgPaddingX (4) and LabelBgPaddingY (2) are the space between the text and the plate's edge, and LabelBgBorderRadius (3) rounds its corners; the sliders set them on every edge.
  • SVG cannot size a rectangle to its text, and measuring every label in the browser would cost a round trip per edge per render, so the plate is sized from BlowTextMetrics.EstimateWidth, which weighs each character by its rough width. For an unusual font, tune LabelBgPaddingX.
  • For a label that keeps one size at any zoom, or needs HTML, use EdgeLabelTemplate instead: see the Edge Renderer example.
An unhandled error has occurred. Reload 🗙