# Structural Diagram Layout
Covers: class diagrams, ER diagrams, component diagrams, package diagrams, org charts.
## Class Diagram
### Class Box (3-compartment)
```svg
ClassName
- id: int
- name: string
+ getName(): string
+ setName(s: string)
```
For abstract classes, italicize the class name. For interfaces, add `«interface»` above the name in smaller font.
### Relationship Lines
| Relationship | Line Style | Arrow/End |
|-------------|------------|-----------|
| Inheritance | Solid | Empty triangle (▷) pointing to parent |
| Implementation | Dashed | Empty triangle pointing to interface |
| Composition | Solid | Filled diamond (◆) at owner end |
| Aggregation | Solid | Empty diamond (◇) at owner end |
| Dependency | Dashed | Open arrowhead at dependency target |
| Association | Solid | Open arrowhead or none |
**Markers:**
```svg
```
### Cardinality Labels
Place at each end of the relationship line, offset 5-8px from the box edge:
```svg
1..*
```
## ER Diagram
Similar to class diagrams but:
- Use 2-compartment boxes (entity name + attributes)
- Mark primary keys with `PK` prefix and bold
- Mark foreign keys with `FK` prefix
- Relationship lines use crow's foot notation:
```svg
```
## Org Chart
- Top-down tree layout
- Root at top center
- Each level evenly spaced (100-120px vertical gap)
- Siblings evenly distributed horizontally
- Connection lines: vertical from parent bottom center to horizontal bar, then vertical down to each child top center
- Use color to indicate departments or hierarchy levels
## Layout Tips
- Start by counting the widest level to determine total diagram width
- Center the tree horizontally in the viewBox
- For deep trees (5+ levels), consider horizontal layout instead