1 # AntV Infographic Syntax Reference
2
3 AntV Infographic syntax is a custom DSL used to describe infographic rendering configurations. It uses indentation to describe information, has strong robustness, and is convenient for streaming output and infographic rendering.
4
5 ## Core Structure
6
7 Every infographic has three parts:
8
9 1. **template** — the first line selects the visual template
10 2. **data** — the content: title, description, and data items
11
12 3. **theme** — optional style customization (palette, font, effects)
13
14 ## Syntax Rules
15
16 - First line must be `infographic <template-name>`
17 - Use `data`/`theme`blocks with two-space indentation within blocks
18
19 - Key-value pairs use`key space value`(e.g.,`title My Title`)
20 - Arrays use `-`as entry prefix
21
22 -`icon`uses icon keywords (e.g.,`star fill`, `cloud`, `brain`)
23
24 - `data`should contain`title`/`desc`+ the template-specific main data field
25
26 - Do not output JSON, Markdown, or explanatory text — only the DSL syntax
27
28 ## Main Data Field by Template Category
29
30 Use only one main data field per infographic. Do not mix them.
31
32 | Template Category | Main Data Field | Notes |
33
34 |-------------------|----------------|-------|
35
36 |`list-*`|`lists`| Array of items with label, desc, icon |
37
38 |`sequence-*`|`sequences`| Optional`order asc\\desc`|
39
40 |`compare-*`|`compares`| Supports`children`for grouped comparisons |
41
42 |`hierarchy-structure`|`items`| Each item is an independent hierarchy, nestable up to 3 levels |
43
44 |`hierarchy-*`(others) |`root`| Single root, nested through`children`|
45
46 |`relation-*`|`nodes`+`relations`| Simple relations can omit`nodes`, using arrow syntax |
47
48 | `chart-*`|`values`| Numeric statistics, optional`category`|
49
50 | Fallback |`items`| Use when uncertain about which field to use |
51
52 ## Special Rules
53
54 -`compare-binary-*`and`compare-hierarchy-left-right-*`templates: must have exactly two root nodes; all comparison items hang under these two root nodes'`children`-`hierarchy-*`(non-structure): use single`root`, nested through `children`— do not repeat root
55
56 -`relation-*`edge label syntax:`A -label-> B`or`A -->|label| B`
57
58 ## Basic Example
59
60 ```text
61
62 infographic list-row-horizontal-icon-arrow
63
64 data
65
66 title Title
67
68 desc Description
69
70 lists
71
72 - label Label
73
74 value 12.5
75
76 desc Explanation
77
78 icon document text
79
80 theme
81
82 palette \#3b82f6 \#8b5cf6 \#f97316
83
84 ```
85
86 ## Data Syntax Examples by Category
87
88 ### list-* templates
89
90 ```text
91
92 infographic list-grid-badge-card
93
94 data
95
96 title Feature List
97
98 lists
99
100 - label Fast
101
102 icon flash fast
103
104 - label Secure
105
106 icon secure shield check
107
108 ```
109
110 ### sequence-* templates
111
112 ```text
113
114 infographic sequence-steps-simple
115
116 data
117
118 sequences
119
120 - label Step 1
121 - label Step 2
122
123 - label Step 3
124
125 order asc
126
127 ```
128
129 ### hierarchy-* templates
130
131 ```text
132
133 infographic hierarchy-structure
134
135 data
136
137 root
138
139 label Company
140
141 children
142
143 - label Dept A
144 - label Dept B
145
146 ```
147
148 ### compare-* templates
149
150 ```text
151
152 infographic compare-swot
153
154 data
155
156 compares
157
158 - label Strengths
159
160 children
161
162 - label Strong brand
163 - label Loyal users
164
165 - label Weaknesses
166
167 children
168
169 - label High cost
170 - label Slow release
171
172 ```
173
174 ### Quadrant diagram
175
176 ```text
177
178 infographic compare-quadrant-quarter-simple-card
179
180 data
181
182 compares
183
184 - label High Impact & Low Effort
185 - label High Impact & High Effort
186
187 - label Low Impact & Low Effort
188 - label Low Impact & High Effort
189
190 ```
191
192 ### chart-* templates
193
194 ```text
195
196 infographic chart-column-simple
197
198 data
199
200 values
201
202 - label Visits
203
204 value 1280
205
206 - label Conversion
207
208 value 12.4
209
210 ```
211
212 ### relation-* templates
213
214 Edge label syntax: `A -label-> B`or`A -->|label| B`
215
216 ```text
217
218 infographic relation-dagre-flow-tb-simple-circle-node
219
220 data
221
222 nodes
223
224 - id A
225
226 label Node A
227
228 - id B
229
230 label Node B
231
232 relations
233
234 A - approves -> B
235
236 A -->|blocks| B
237
238 ```
239
240 ### Fallback items example
241
242 ```text
243
244 infographic list-row-horizontal-icon-arrow
245
246 data
247
248 items
249
250 - label Item A
251
252 desc Description
253
254 icon sun
255
256 - label Item B
257
258 desc Description
259
260 icon moon
261
262 ```
263
264 ## Theme Customization
265
266 ### Custom palette
267
268 ```text
269
270 infographic list-row-horizontal-icon-arrow
271
272 theme
273
274 palette \#3b82f6 \#8b5cf6 \#f97316
275
276 ```
277
278 ### Dark theme with custom colors
279
280 ```text
281
282 infographic list-row-horizontal-icon-arrow
283
284 theme dark
285
286 palette
287
288 - \#61DDAA
289 - \#F6BD16
290
291 - \#F08BB4
292
293 ```
294
295 ### Hand-drawn style (rough)
296
297 Use `theme.stylize`for built-in visual styles. Common styles:
298
299 -`rough`— hand-drawn effect
300 -`pattern`— pattern fill
301
302 -`linear-gradient`/`radial-gradient` — gradient fills
303
304 ```text
305
306 infographic list-row-horizontal-icon-arrow
307
308 theme
309
310 stylize rough
311
312 base
313
314 text
315
316 font-family 851tegakizatsu
317
318 ```
319
320 ### Custom font
321
322 ```text
323
324 theme
325
326 base
327
328 text
329
330 font-family 851tegakizatsu
331
332 ```
333
334 ## Available Templates
335
336 ### Chart templates
337
338 - `chart-bar-plain-text`-`chart-column-simple`-`chart-line-plain-text`-`chart-pie-compact-card`-`chart-pie-donut-pill-badge`-`chart-pie-donut-plain-text`-`chart-pie-plain-text`-`chart-wordcloud`
339
340 ### Comparison templates
341
342 - `compare-binary-horizontal-badge-card-arrow`-`compare-binary-horizontal-simple-fold`-`compare-binary-horizontal-underline-text-vs`-`compare-hierarchy-left-right-circle-node-pill-badge`-`compare-quadrant-quarter-circular`-`compare-quadrant-quarter-simple-card`-`compare-swot`
343
344 ### Hierarchy templates
345
346 - `hierarchy-mindmap-branch-gradient-capsule-item`-`hierarchy-mindmap-level-gradient-compact-card`-`hierarchy-structure`-`hierarchy-tree-curved-line-rounded-rect-node`-`hierarchy-tree-tech-style-badge-card`-`hierarchy-tree-tech-style-capsule-item`
347
348 ### List templates
349
350 - `list-column-done-list`-`list-column-simple-vertical-arrow`-`list-column-vertical-icon-arrow`-`list-grid-badge-card`-`list-grid-candy-card-lite`-`list-grid-ribbon-card`-`list-row-horizontal-icon-arrow`-`list-sector-plain-text`-`list-zigzag-down-compact-card`-`list-zigzag-down-simple`-`list-zigzag-up-compact-card`-`list-zigzag-up-simple`
351
352 ### Relation templates
353
354 - `relation-dagre-flow-tb-animated-badge-card`-`relation-dagre-flow-tb-animated-simple-circle-node`-`relation-dagre-flow-tb-badge-card`-`relation-dagre-flow-tb-simple-circle-node`
355
356 ### Sequence templates
357
358 - `sequence-ascending-stairs-3d-underline-text`-`sequence-ascending-steps`-`sequence-circular-simple`-`sequence-color-snake-steps-horizontal-icon-line`-`sequence-cylinders-3d-simple`-`sequence-filter-mesh-simple`-`sequence-funnel-simple`-`sequence-horizontal-zigzag-underline-text`-`sequence-mountain-underline-text`-`sequence-pyramid-simple`-`sequence-roadmap-vertical-plain-text`-`sequence-roadmap-vertical-simple`-`sequence-snake-steps-compact-card`-`sequence-snake-steps-simple`-`sequence-snake-steps-underline-text`-`sequence-stairs-front-compact-card`-`sequence-stairs-front-pill-badge`-`sequence-timeline-rounded-rect-node`-`sequence-timeline-simple`-`sequence-zigzag-pucks-3d-simple`-`sequence-zigzag-steps-underline-text`
359
360 ## Template Selection Quick Reference
361
362 | Use Case | Recommended Templates |
363
364 |----------|----------------------|
365
366 | Strict sequence (process/steps) | `sequence-*`|
367
368 | Timeline |`sequence-timeline-*`|
369
370 | Staircase diagram |`sequence-stairs-*`|
371
372 | Roadmap |`sequence-roadmap-vertical-*`|
373
374 | Zigzag path |`sequence-zigzag-*`|
375
376 | Circular progress |`sequence-circular-simple`|
377
378 | Snake steps |`sequence-color-snake-steps-*`, `sequence-snake-steps-*`|
379
380 | Pyramid |`sequence-pyramid-simple`|
381
382 | Funnel |`sequence-funnel-simple`|
383
384 | Opinion listing |`list-row-*`or`list-column-*`|
385
386 | Grid list (key points) |`list-grid-*`|
387
388 | Binary comparison (pros/cons) |`compare-binary-*`|
389
390 | SWOT analysis |`compare-swot`|
391
392 | Quadrant analysis |`compare-quadrant-*`|
393
394 | Tree diagram |`hierarchy-tree-*`|
395
396 | Mind map |`hierarchy-mindmap-*`|
397
398 | Org chart |`hierarchy-structure`|
399
400 | Data charts |`chart-*`|
401
402 | Flow / relationship diagram |`relation-*`|
403
404 | Word cloud |`chart-wordcloud` |
405
406 ## Full Example
407
408 Internet technology evolution infographic:
409
410 ```text
411
412 infographic list-row-horizontal-icon-arrow
413
414 data
415
416 title Internet Technology Evolution
417
418 desc From Web 1.0 to AI era, key milestones
419
420 lists
421
422 - time 1991
423
424 label Web 1.0
425
426 desc Tim Berners-Lee published the first website, opening the Internet era
427
428 icon web
429
430 - time 2004
431
432 label Web 2.0
433
434 desc Social media and user-generated content become mainstream
435
436 icon account multiple
437
438 - time 2007
439
440 label Mobile
441
442 desc iPhone released, smartphone changes the world
443
444 icon cellphone
445
446 - time 2015
447
448 label Cloud Native
449
450 desc Containerization and microservices architecture are widely used
451
452 icon cloud
453
454 - time 2020
455
456 label Low Code
457
458 desc Visual development lowers the technology threshold
459
460 icon application brackets
461
462 - time 2023
463
464 label AI Large Model
465
466 desc ChatGPT ignites the generative AI revolution
467
468 icon brain
469
470 ```