Context
toElkGraph assigns fixed dimensions of
160×64 to all nodes (Service, Network, Volume). This is a deliberate placeholder from Phase 2 so that ELK can
layout the nodes at all—ELK needs width/height in advance, but does not know the eventual text size.
Problem
Actual node labels vary greatly in length (db vs.
payment-gateway-service). With a fixed width, long names are either
truncated, or the box is unnecessarily large for short names. As a result, the layout appears
less clean than it could be.
Context
Only once the actual font size, padding, and node design are determined can the size be
meaningfully derived from the label. Before that, any number would be a guess.
Possible Approach
- After defining the node typography, determine the text width for each label
(e.g., using Canvas measureText or measured character width) and use that to
calculate width plus padding; height is determined by font size and
padding.
- Keep the dimension calculation as a separate, testable function that
toElkGraph
calls for each node—this preserves the mapper’s underlying structure.
- Define a minimum and, if necessary, a maximum width so that very short names do not
appear tiny and very long names do not overflow the graph.
- Check whether network/volume nodes should have a different base size than service nodes
(different types may be visually distinguished).
Acceptance Criteria
Dependency
Blocked by Phase 3 (node typography and design must be finalized first).
Context
toElkGraphassigns fixed dimensions of160×64 to all nodes (Service, Network, Volume). This is a deliberate placeholder from Phase 2 so that ELK can
layout the nodes at all—ELK needs
width/heightin advance, but does not know the eventual text size.Problem
Actual node labels vary greatly in length (
dbvs.payment-gateway-service). With a fixed width, long names are eithertruncated, or the box is unnecessarily large for short names. As a result, the layout appears
less clean than it could be.
Context
Only once the actual font size, padding, and node design are determined can the size be
meaningfully derived from the label. Before that, any number would be a guess.
Possible Approach
(e.g., using Canvas
measureTextor measured character width) and use that tocalculate
widthplus padding;heightis determined by font size andpadding.
toElkGraphcalls for each node—this preserves the mapper’s underlying structure.
appear tiny and very long names do not overflow the graph.
(different types may be visually distinguished).
Acceptance Criteria
Dependency
Blocked by Phase 3 (node typography and design must be finalized first).