@diagrammo/dgmo 0.8.12 → 0.8.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +115 -719
- package/dist/index.cjs +11 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -6
- package/dist/index.js.map +1 -1
- package/docs/guide/chart-arc.md +71 -0
- package/docs/guide/chart-area.md +73 -0
- package/docs/guide/chart-bar-stacked.md +61 -0
- package/docs/guide/chart-bar.md +62 -0
- package/docs/guide/chart-boxes-and-lines.md +243 -0
- package/docs/guide/chart-c4.md +300 -0
- package/docs/guide/chart-chord.md +43 -0
- package/docs/guide/chart-class.md +204 -0
- package/docs/guide/chart-doughnut.md +38 -0
- package/docs/guide/chart-er.md +218 -0
- package/docs/guide/chart-flowchart.md +102 -0
- package/docs/guide/chart-function.md +56 -0
- package/docs/guide/chart-funnel.md +38 -0
- package/docs/guide/chart-gantt.md +368 -0
- package/docs/guide/chart-heatmap.md +41 -0
- package/docs/guide/chart-infra.md +694 -0
- package/docs/guide/chart-kanban.md +156 -0
- package/docs/guide/chart-line.md +79 -0
- package/docs/guide/chart-multi-line.md +84 -0
- package/docs/guide/chart-org.md +209 -0
- package/docs/guide/chart-pie.md +39 -0
- package/docs/guide/chart-polar-area.md +38 -0
- package/docs/guide/chart-quadrant.md +69 -0
- package/docs/guide/chart-radar.md +38 -0
- package/docs/guide/chart-sankey.md +103 -0
- package/docs/guide/chart-scatter.md +94 -0
- package/docs/guide/chart-sequence.md +332 -0
- package/docs/guide/chart-sitemap.md +248 -0
- package/docs/guide/chart-slope.md +56 -0
- package/docs/guide/chart-state.md +171 -0
- package/docs/guide/chart-timeline.md +229 -0
- package/docs/guide/chart-venn.md +81 -0
- package/docs/guide/chart-wordcloud.md +66 -0
- package/docs/guide/colors.md +283 -0
- package/docs/guide/index.md +55 -0
- package/docs/guide/keyboard-shortcuts.md +49 -0
- package/docs/guide/registry.json +51 -0
- package/gallery/fixtures/boxes-and-lines.dgmo +4 -6
- package/package.json +1 -1
- package/src/sharing.ts +3 -4
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# C4 Diagram
|
|
2
|
+
|
|
3
|
+
> **Beta** — C4 diagram support is in beta. The DSL syntax may change in future releases.
|
|
4
|
+
|
|
5
|
+
```dgmo
|
|
6
|
+
c4 Internet Banking System
|
|
7
|
+
|
|
8
|
+
person Customer | description: A customer of the bank
|
|
9
|
+
|
|
10
|
+
system Internet Banking | description: Allows customers to view accounts and make payments
|
|
11
|
+
-Delivers content to [HTTPS]-> Customer
|
|
12
|
+
-Sends emails using [SMTP]-> Email
|
|
13
|
+
|
|
14
|
+
containers
|
|
15
|
+
container Web App | description: SPA for banking features, tech: React
|
|
16
|
+
-Makes API calls [JSON/HTTPS]-> API
|
|
17
|
+
|
|
18
|
+
container API | description: JSON/HTTPS API backend, tech: Node.js
|
|
19
|
+
-Reads from and writes to [SQL/TCP]-> Database
|
|
20
|
+
|
|
21
|
+
container Database | description: Stores account data, tech: PostgreSQL
|
|
22
|
+
|
|
23
|
+
system Email | description: Sendgrid email delivery
|
|
24
|
+
~Sends emails to~> Customer
|
|
25
|
+
|
|
26
|
+
deployment
|
|
27
|
+
Vercel is a cloud
|
|
28
|
+
container Web App
|
|
29
|
+
Railway
|
|
30
|
+
container API
|
|
31
|
+
Neon is a database
|
|
32
|
+
container Database
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Overview
|
|
36
|
+
|
|
37
|
+
C4 diagrams model software architecture at multiple zoom levels, following the [C4 model](https://c4model.com). Define people, systems, containers, and components — then drill down from context to detail. Relationships use the same arrow syntax as sequence diagrams.
|
|
38
|
+
|
|
39
|
+
The diagram starts at the **Context** level (people + systems). Click a system to drill into its **Containers**, then click a container to see its **Components**.
|
|
40
|
+
|
|
41
|
+
## Syntax
|
|
42
|
+
|
|
43
|
+
```
|
|
44
|
+
c4 Diagram Title
|
|
45
|
+
|
|
46
|
+
person Name | description: ...
|
|
47
|
+
system Name | description: ...
|
|
48
|
+
-label [technology]-> Target
|
|
49
|
+
~async label~> Target
|
|
50
|
+
|
|
51
|
+
containers
|
|
52
|
+
container Name | tech: ..., description: ...
|
|
53
|
+
|
|
54
|
+
components
|
|
55
|
+
component Name | tech: ..., description: ...
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Element Types
|
|
59
|
+
|
|
60
|
+
| Type | Description | Example |
|
|
61
|
+
| ----------- | ------------------------------- | -------------------------- |
|
|
62
|
+
| `person` | User or actor | `person Customer` |
|
|
63
|
+
| `system` | Top-level software system | `system Banking` |
|
|
64
|
+
| `container` | Runtime unit within a system | `container API` |
|
|
65
|
+
| `component` | Logical part within a container | `component AuthController` |
|
|
66
|
+
|
|
67
|
+
Elements are declared with their type keyword followed by a name. Add metadata after `|`:
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
system Analytics Platform | description: Multi-tenant analytics, tech: Node.js
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Shapes
|
|
74
|
+
|
|
75
|
+
Shapes can be inferred from the element's technology or name, or declared explicitly:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
container Database is a database
|
|
79
|
+
container Cache is a cache
|
|
80
|
+
container Event Bus is a queue
|
|
81
|
+
system AWS is a cloud
|
|
82
|
+
system Stripe is an external
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
| Shape | Inferred from |
|
|
86
|
+
| ---------- | --------------------------------------------------------- |
|
|
87
|
+
| `database` | `tech: PostgreSQL`, `tech: MySQL`, names ending in `DB` |
|
|
88
|
+
| `cache` | `tech: Redis`, `tech: Memcache`, names containing `Cache` |
|
|
89
|
+
| `queue` | `tech: RabbitMQ`, `tech: Kafka`, names containing `Queue` |
|
|
90
|
+
| `cloud` | Explicit `is a cloud` only |
|
|
91
|
+
| `external` | Explicit `is an external` only |
|
|
92
|
+
|
|
93
|
+
## Metadata
|
|
94
|
+
|
|
95
|
+
Key-value pairs on the same line with `|`, or indented below the element:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
container API Gateway | tech: Node.js, team: Platform
|
|
99
|
+
description: REST API serving all frontends
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Or fully inline:
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
container API Gateway | tech: Node.js, team: Platform, description: REST API
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Relationships
|
|
109
|
+
|
|
110
|
+
### Arrow Types
|
|
111
|
+
|
|
112
|
+
| Arrow | Meaning | Example |
|
|
113
|
+
| ----- | ----------------------- | ------------------------ |
|
|
114
|
+
| `->` | Synchronous | `-Makes API calls-> API` |
|
|
115
|
+
| `~>` | Async / fire-and-forget | `~Sends events~> Queue` |
|
|
116
|
+
|
|
117
|
+
For bidirectional relationships, use two separate lines:
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
API -Makes API calls-> Database
|
|
121
|
+
Database -Returns results-> API
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Labeled Relationships
|
|
125
|
+
|
|
126
|
+
Place the label inside the arrow. Add `[technology]` to annotate the protocol:
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
-Makes API calls [JSON/HTTPS]-> API
|
|
130
|
+
-Reads from and writes to [SQL/TCP]-> Database
|
|
131
|
+
~Submits analytics queries [AMQP]~> Query Engine
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Arrow-Label Syntax
|
|
135
|
+
|
|
136
|
+
Labels can also be placed inside the arrow:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
-Makes API calls [JSON/HTTPS]-> API
|
|
140
|
+
~Sends events [AMQP]~> Queue
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Hierarchy
|
|
144
|
+
|
|
145
|
+
Systems contain containers (via `containers`), containers contain components (via `components`). Indentation defines the hierarchy:
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
system Banking
|
|
149
|
+
containers
|
|
150
|
+
container Web App
|
|
151
|
+
container API
|
|
152
|
+
components
|
|
153
|
+
component AuthController
|
|
154
|
+
component PaymentService
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
At the **Context** level, container-level relationships are automatically rolled up to their parent system.
|
|
158
|
+
|
|
159
|
+
## Groups
|
|
160
|
+
|
|
161
|
+
Organize containers or components into visual boundaries:
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
containers
|
|
165
|
+
[Frontend]
|
|
166
|
+
container Dashboard | tech: React
|
|
167
|
+
container Admin Console | tech: React
|
|
168
|
+
|
|
169
|
+
[Backend]
|
|
170
|
+
container API Gateway | tech: Node.js
|
|
171
|
+
container Query Engine | tech: Node.js
|
|
172
|
+
|
|
173
|
+
[Data]
|
|
174
|
+
container Database | tech: PostgreSQL
|
|
175
|
+
container Cache is a cache | tech: Redis
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Tag Groups
|
|
179
|
+
|
|
180
|
+
Color-code elements by technology, team, or any custom category:
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
tag Technology alias tech
|
|
184
|
+
React(blue)
|
|
185
|
+
Node.js(green)
|
|
186
|
+
PostgreSQL(purple)
|
|
187
|
+
Redis(red)
|
|
188
|
+
|
|
189
|
+
tag Team alias t
|
|
190
|
+
Product(blue) default
|
|
191
|
+
Data(orange)
|
|
192
|
+
Infrastructure(teal)
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
Then reference tags in metadata: `container API | tech: Node.js, t: Product`.
|
|
196
|
+
|
|
197
|
+
## Deployment
|
|
198
|
+
|
|
199
|
+
Map containers to infrastructure with the `deployment` section:
|
|
200
|
+
|
|
201
|
+
```
|
|
202
|
+
deployment
|
|
203
|
+
AWS us-east-1 is a cloud
|
|
204
|
+
ECS Cluster
|
|
205
|
+
container API
|
|
206
|
+
container Worker
|
|
207
|
+
RDS is a database
|
|
208
|
+
container Database
|
|
209
|
+
ElastiCache is a cache
|
|
210
|
+
container Cache
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
- Nest deployment nodes to any depth
|
|
214
|
+
- Use `container Name` to reference a defined container
|
|
215
|
+
- Shapes (`is a database`, `is a cloud`) work on deployment nodes too
|
|
216
|
+
|
|
217
|
+
## Comments
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
// This line is ignored by the parser
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Complete Example
|
|
224
|
+
|
|
225
|
+
```dgmo
|
|
226
|
+
c4 SaaS Analytics Platform
|
|
227
|
+
|
|
228
|
+
tag Technology alias tech
|
|
229
|
+
React(blue)
|
|
230
|
+
Node.js(green)
|
|
231
|
+
PostgreSQL(purple)
|
|
232
|
+
Redis(red)
|
|
233
|
+
|
|
234
|
+
tag Team alias t
|
|
235
|
+
Product(blue) default
|
|
236
|
+
Data(orange)
|
|
237
|
+
Infrastructure(teal)
|
|
238
|
+
|
|
239
|
+
person End User | description: Views dashboards and creates reports
|
|
240
|
+
person Account Admin | description: Manages workspace settings and members
|
|
241
|
+
|
|
242
|
+
system Analytics Platform | description: Multi-tenant analytics and reporting
|
|
243
|
+
-Serves dashboards to [HTTPS]-> End User
|
|
244
|
+
-Provides admin console to [HTTPS]-> Account Admin
|
|
245
|
+
~Sends scheduled reports via [SMTP]~> Email Service
|
|
246
|
+
|
|
247
|
+
containers
|
|
248
|
+
[Frontend]
|
|
249
|
+
container Dashboard App | tech: React, t: Product
|
|
250
|
+
description: Interactive data visualization SPA
|
|
251
|
+
-Fetches data from [JSON/HTTPS]-> API Gateway
|
|
252
|
+
|
|
253
|
+
container Admin Console | tech: React, t: Product
|
|
254
|
+
description: Workspace and user management
|
|
255
|
+
-Manages settings via [JSON/HTTPS]-> API Gateway
|
|
256
|
+
|
|
257
|
+
[Backend]
|
|
258
|
+
container API Gateway | tech: Node.js, t: Product
|
|
259
|
+
description: REST API serving all frontends
|
|
260
|
+
-Reads/writes user data [SQL/TCP]-> App Database
|
|
261
|
+
-Reads/writes sessions [TCP]-> Cache
|
|
262
|
+
~Submits analytics queries [AMQP]~> Query Engine
|
|
263
|
+
|
|
264
|
+
container Query Engine | tech: Node.js, t: Data
|
|
265
|
+
description: Processes analytics queries asynchronously
|
|
266
|
+
-Runs queries against [SQL/TCP]-> Data Warehouse
|
|
267
|
+
~Publishes results [AMQP]~> Event Bus
|
|
268
|
+
|
|
269
|
+
[Data]
|
|
270
|
+
container App Database | tech: PostgreSQL, t: Product
|
|
271
|
+
description: Users, workspaces, and dashboard configs
|
|
272
|
+
|
|
273
|
+
container Data Warehouse | tech: PostgreSQL, t: Data
|
|
274
|
+
description: Aggregated analytics data
|
|
275
|
+
|
|
276
|
+
container Cache is a cache | tech: Redis, t: Infrastructure
|
|
277
|
+
description: Session store and rate limiter
|
|
278
|
+
|
|
279
|
+
container Event Bus | tech: RabbitMQ, t: Infrastructure
|
|
280
|
+
description: Async messaging backbone
|
|
281
|
+
|
|
282
|
+
system Email Service | description: Transactional email delivery
|
|
283
|
+
~Delivers report emails to~> End User
|
|
284
|
+
|
|
285
|
+
deployment
|
|
286
|
+
GCP us-central1 is a cloud
|
|
287
|
+
Cloud Run — Frontend
|
|
288
|
+
container Dashboard App
|
|
289
|
+
container Admin Console
|
|
290
|
+
Cloud Run — Backend
|
|
291
|
+
container API Gateway
|
|
292
|
+
container Query Engine
|
|
293
|
+
Cloud SQL is a database
|
|
294
|
+
container App Database
|
|
295
|
+
container Data Warehouse
|
|
296
|
+
Memorystore is a cache
|
|
297
|
+
container Cache
|
|
298
|
+
Cloud Pub/Sub
|
|
299
|
+
container Event Bus
|
|
300
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Chord Diagram
|
|
2
|
+
|
|
3
|
+
```dgmo
|
|
4
|
+
chord Pirate Alliance Network
|
|
5
|
+
|
|
6
|
+
Blackbeard -> Bonnet 150
|
|
7
|
+
Blackbeard -> Vane 80
|
|
8
|
+
Blackbeard -> Hornigold 120
|
|
9
|
+
Bonnet -> Rackham 40
|
|
10
|
+
Vane -> Rackham 60
|
|
11
|
+
Rackham -> Bonny 200
|
|
12
|
+
Bonny -> Read 180
|
|
13
|
+
Roberts -> Davis 90
|
|
14
|
+
Roberts -> Anstis 70
|
|
15
|
+
Hornigold -> Bonnet 50
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Syntax
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
chord Chart Title
|
|
22
|
+
|
|
23
|
+
Source -> Target value
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Metadata Keys
|
|
27
|
+
|
|
28
|
+
| Key | Description | Required |
|
|
29
|
+
| ------- | ------------------------------------- | -------- |
|
|
30
|
+
| `chart` | Must be `chord` | Yes |
|
|
31
|
+
| `title` | Chart title displayed above the chart | No |
|
|
32
|
+
|
|
33
|
+
## Data Format
|
|
34
|
+
|
|
35
|
+
Each data line defines a connection between two entities with a numeric weight:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
Blackbeard -> Bonnet 150
|
|
39
|
+
Blackbeard -> Vane 80
|
|
40
|
+
Bonnet -> Rackham 40
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Nodes are arranged around a circle. The width of each chord represents the strength of the connection.
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Class Diagram
|
|
2
|
+
|
|
3
|
+
```dgmo
|
|
4
|
+
class Ship Class Hierarchy
|
|
5
|
+
|
|
6
|
+
Vessel [interface]
|
|
7
|
+
+ sail(): void
|
|
8
|
+
+ anchor(): void
|
|
9
|
+
|
|
10
|
+
Ship implements Vessel [abstract]
|
|
11
|
+
# name: string
|
|
12
|
+
# crew: number
|
|
13
|
+
+ getName(): string
|
|
14
|
+
|
|
15
|
+
Galleon extends Ship
|
|
16
|
+
- cannons: number
|
|
17
|
+
+ fire(): void
|
|
18
|
+
|
|
19
|
+
Sloop extends Ship
|
|
20
|
+
- speed: number
|
|
21
|
+
+ flee(): void
|
|
22
|
+
|
|
23
|
+
ShipType [enum]
|
|
24
|
+
Galleon
|
|
25
|
+
Sloop
|
|
26
|
+
Frigate
|
|
27
|
+
|
|
28
|
+
Ship -> ShipType : has type
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Overview
|
|
32
|
+
|
|
33
|
+
Class diagrams render UML-style boxes with three compartments per the UML spec: name, attributes, and methods. Classes connect via relationships like inheritance, composition, and association. Layout is automatic via Dagre.
|
|
34
|
+
|
|
35
|
+
## Syntax
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
class Diagram Title
|
|
39
|
+
|
|
40
|
+
ClassName [modifier] (color)
|
|
41
|
+
+ publicField: type
|
|
42
|
+
- privateField: type
|
|
43
|
+
# protectedField: type
|
|
44
|
+
+ method(params): returnType
|
|
45
|
+
|
|
46
|
+
ChildClass extends ParentClass
|
|
47
|
+
+ field: type
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Settings
|
|
51
|
+
|
|
52
|
+
| Key | Description | Default |
|
|
53
|
+
| ------- | --------------- | ------- |
|
|
54
|
+
| `chart` | Must be `class` | — |
|
|
55
|
+
| `title` | Diagram title | None |
|
|
56
|
+
|
|
57
|
+
## Classes
|
|
58
|
+
|
|
59
|
+
Declare a class on an unindented line. Members are indented below:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
User
|
|
63
|
+
+ name: string
|
|
64
|
+
+ email: string
|
|
65
|
+
+ login(password: string): boolean
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Modifiers
|
|
69
|
+
|
|
70
|
+
Add a modifier in brackets to change the class type:
|
|
71
|
+
|
|
72
|
+
| Modifier | Syntax | Appearance |
|
|
73
|
+
| --------- | ------------------ | --------------------------------------- |
|
|
74
|
+
| Interface | `Name [interface]` | `«interface»` badge, blue |
|
|
75
|
+
| Abstract | `Name [abstract]` | `«abstract»` badge, italic name, purple |
|
|
76
|
+
| Enum | `Name [enum]` | `«enum»` badge, yellow |
|
|
77
|
+
|
|
78
|
+
### Enum Values
|
|
79
|
+
|
|
80
|
+
Enum classes list plain values instead of typed fields:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
OrderStatus [enum]
|
|
84
|
+
Pending
|
|
85
|
+
Confirmed
|
|
86
|
+
Shipped
|
|
87
|
+
Delivered
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Fields and Methods
|
|
91
|
+
|
|
92
|
+
Indented lines under a class are parsed as members.
|
|
93
|
+
|
|
94
|
+
### Visibility
|
|
95
|
+
|
|
96
|
+
| Symbol | Meaning |
|
|
97
|
+
| ------ | --------- |
|
|
98
|
+
| `+` | Public |
|
|
99
|
+
| `-` | Private |
|
|
100
|
+
| `#` | Protected |
|
|
101
|
+
| (none) | Public |
|
|
102
|
+
|
|
103
|
+
### Fields
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
+ name: string
|
|
107
|
+
- password: string
|
|
108
|
+
# id: number
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Methods
|
|
112
|
+
|
|
113
|
+
Methods are detected by the presence of parentheses:
|
|
114
|
+
|
|
115
|
+
```
|
|
116
|
+
+ login(email: string, pass: string): boolean
|
|
117
|
+
- validate(): void
|
|
118
|
+
+ getInstance(): Logger {static}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Add `{static}` at the end to mark a member as static.
|
|
122
|
+
|
|
123
|
+
## Relationships
|
|
124
|
+
|
|
125
|
+
### Inheritance & Implementation
|
|
126
|
+
|
|
127
|
+
Use `extends` or `implements` in the class declaration header:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
Dog extends Animal
|
|
131
|
+
+ breed: string
|
|
132
|
+
|
|
133
|
+
Circle implements Drawable
|
|
134
|
+
- radius: number
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
This declares the class and establishes the relationship in one line. Members are indented below as usual.
|
|
138
|
+
|
|
139
|
+
### Arrow Syntax
|
|
140
|
+
|
|
141
|
+
For other relationships, use arrow notation:
|
|
142
|
+
|
|
143
|
+
| Relationship | Arrow | Example |
|
|
144
|
+
| -------------- | ------- | ------------------------ |
|
|
145
|
+
| Inheritance | `--\|>` | `Dog --\|> Animal` |
|
|
146
|
+
| Implementation | `..\|>` | `Dog ..\|> Serializable` |
|
|
147
|
+
| Composition | `*--` | `Car *-- Engine` |
|
|
148
|
+
| Aggregation | `o--` | `Team o-- Player` |
|
|
149
|
+
| Dependency | `..>` | `Service ..> Logger` |
|
|
150
|
+
| Association | `->` | `Order -> Customer` |
|
|
151
|
+
|
|
152
|
+
### Labels
|
|
153
|
+
|
|
154
|
+
Add a label after a colon:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
Car *-- Engine : powered by
|
|
158
|
+
Service ..> Logger : uses
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Colors
|
|
162
|
+
|
|
163
|
+
Colors are auto-assigned by modifier type. Override with a color name in parentheses:
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
Ship (red)
|
|
167
|
+
Engine [abstract] (purple)
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Comments
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
// This line is ignored by the parser
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Complete Example
|
|
177
|
+
|
|
178
|
+
```dgmo
|
|
179
|
+
class Design Patterns
|
|
180
|
+
|
|
181
|
+
Drawable [interface]
|
|
182
|
+
+ draw(): void
|
|
183
|
+
+ resize(w: number, h: number): void
|
|
184
|
+
|
|
185
|
+
Shape implements Drawable [abstract] (purple)
|
|
186
|
+
# x: number
|
|
187
|
+
# y: number
|
|
188
|
+
+ area(): number
|
|
189
|
+
|
|
190
|
+
Circle extends Shape
|
|
191
|
+
- radius: number
|
|
192
|
+
+ getRadius(): number
|
|
193
|
+
|
|
194
|
+
Rectangle extends Shape
|
|
195
|
+
- width: number
|
|
196
|
+
- height: number
|
|
197
|
+
|
|
198
|
+
Canvas
|
|
199
|
+
- shapes: Shape[]
|
|
200
|
+
+ render(): void
|
|
201
|
+
|
|
202
|
+
Canvas *-- Shape : contains
|
|
203
|
+
Canvas ..> Logger : uses
|
|
204
|
+
```
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Doughnut Chart
|
|
2
|
+
|
|
3
|
+
```dgmo
|
|
4
|
+
doughnut Plunder Distribution
|
|
5
|
+
|
|
6
|
+
Captain's Share: 40
|
|
7
|
+
Quartermaster: 20
|
|
8
|
+
Crew Split: 25
|
|
9
|
+
Ship Repairs: 10
|
|
10
|
+
Provisions: 5
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Syntax
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
doughnut Chart Title
|
|
17
|
+
|
|
18
|
+
Label: value
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Metadata Keys
|
|
22
|
+
|
|
23
|
+
| Key | Description | Required |
|
|
24
|
+
| ------- | ------------------------------------- | -------- |
|
|
25
|
+
| `chart` | Must be `doughnut` | Yes |
|
|
26
|
+
| `title` | Chart title displayed above the chart | No |
|
|
27
|
+
|
|
28
|
+
## Data Format
|
|
29
|
+
|
|
30
|
+
Each data line follows the pattern `Label: value`:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
Captain's Share: 40
|
|
34
|
+
Quartermaster: 20
|
|
35
|
+
Crew Split: 25
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Segments are automatically colored using the Nord palette.
|