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.
Press Tab to move between the nodes and edges of the diagram.
Press Enter or Space to select it, Shift with Enter to add it to the selection, the arrow keys to move the selected nodes, Delete to remove them and Escape to clear the selection. Press C to start a connection from it.
Press Enter or Space to select it, Delete to remove it and Escape to clear the selection. Press C to move its end to another node.
bit BlowTry 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
Labelis drawn at the path's midpoint, and is also the edge's accessible name.LabelStyleis an inline style for the SVG text (fill,font-weight, ...), andLabelBgStyleone for the plate behind it (fill,stroke, ...). The plate's default fill is 85% opaque, so the green one setsfill-opacity:1.LabelShowBg(true by default) draws the plate; false leaves the bare text on the line.LabelBgPaddingX(4) andLabelBgPaddingY(2) are the space between the text and the plate's edge, andLabelBgBorderRadius(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, tuneLabelBgPaddingX. - For a label that keeps one size at any zoom, or needs HTML, use
EdgeLabelTemplateinstead: see the Edge Renderer example.