infographic-creator
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInfographics convert data, information, and knowledge into perceptible visual language. They combine visual design with data visualization, compressing complex information with intuitive symbols to help audiences quickly understand and remember key points.
Infographic = Information Structure + Visual ExpressionThis task uses AntV Infographic to create visual infographics.
Before starting the task, you need to understand the AntV Infographic syntax specifications, including template list, data structure, themes, etc.
信息图将数据、信息和知识转化为易于感知的视觉语言。它将视觉设计与数据可视化相结合,用直观的符号压缩复杂信息,帮助受众快速理解并记住关键要点。
Infographic = Information Structure + Visual Expression本任务使用AntV Infographic创建可视化信息图。
开始任务前,你需要了解AntV Infographic的语法规范,包括模板列表、数据结构、主题等。
Specifications
规范
AntV Infographic Syntax
AntV Infographic语法
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 AI streaming output and infographic rendering. It mainly contains the following information:
- template: Use templates to express the text information structure.
- data: Infographic data, including title, desc, data items, etc. Data items typically contain fields such as label, desc, icon, etc.
- theme: Theme contains style configurations such as palette, font, etc.
For example:
plain
infographic list-row-horizontal-icon-arrow
data
title Title
desc Description
lists
- label Label
value 12.5
desc Explanation
icon document text
theme
palette #3b82f6 #8b5cf6 #f97316AntV Infographic语法是一种用于描述信息图渲染配置的自定义DSL。它使用缩进描述信息,鲁棒性强,便于AI流式输出和信息图渲染。主要包含以下信息:
- template:使用模板表达文本信息结构。
- data:信息图数据,包括标题、描述、数据项等。数据项通常包含label、desc、icon等字段。
- theme:主题包含调色板、字体等样式配置。
示例:
plain
infographic list-row-horizontal-icon-arrow
data
title Title
desc Description
lists
- label Label
value 12.5
desc Explanation
icon document text
theme
palette #3b82f6 #8b5cf6 #f97316Syntax Specifications
语法规范
-
The first line must be, template selected from the list below (see "Available Templates" section).
infographic <template-name> -
Use/
datablocks, with two-space indentation within blocks.theme -
Key-value pairs use "key space value"; arrays useas entry prefix.
- -
icon uses icon keywords (e.g.,).
star fill -
should contain title/desc + template-specific main data field (not necessarily
data).items -
Main data field selection (use only one, avoid mixing):
- →
list-*lists - →
sequence-*(optionalsequences)order asc|desc - →
compare-*(supportscomparesfor grouped comparisons), can contain multiple comparison itemschildren - →
hierarchy-structure(each item corresponds to an independent hierarchy, each level can contain sub-items, can be nested up to 3 levels)items - → single
hierarchy-*(tree structure, nested throughroot);children - →
relation-*+nodes; simple relation diagrams can omitrelations, using arrow syntax in relationsnodes - →
chart-*(numeric statistics, optionalvalues)category - Use as fallback when uncertain
items
-
/
compare-binary-*binary templates: must have two root nodes, all comparison items hang under these two root nodes' childrencompare-hierarchy-left-right-* -
: use single
hierarchy-*, nested throughroot(do not repeatchildren)root -
is used to customize themes (palette, font, etc.) For example: dark theme + custom color scheme
themeplaininfographic list-row-horizontal-icon-arrow theme dark palette - #61DDAA - #F6BD16 - #F08BB4 -
Useto specify font, such as handwriting style
theme.base.text.font-family851tegakizatsu -
Useto select built-in styles and pass parameters Common styles:
theme.stylize- : hand-drawn effect
rough - : pattern fill
pattern - /
linear-gradient: linear/radial gradientradial-gradient
For example: hand-drawn style (rough)plaininfographic list-row-horizontal-icon-arrow theme stylize rough base text font-family 851tegakizatsu -
Do not output JSON, Markdown, or explanatory text
-
第一行必须为,模板从下方的“可用模板”列表中选择。
infographic <template-name> -
使用/
data块,块内使用两个空格缩进。theme -
键值对使用“key 空格 value”;数组使用作为条目前缀。
- -
icon使用图标关键词(如)。
star fill -
应包含title/desc + 模板特定的主数据字段(不一定是
data)。items -
主数据字段选择(仅使用一个,避免混合):
- →
list-*lists - →
sequence-*(可选sequences)order asc|desc - →
compare-*(支持compares用于分组对比),可包含多个对比项children - →
hierarchy-structure(每个条目对应一个独立层级,每个层级可包含子条目,最多嵌套3级)items - → 单个
hierarchy-*(树形结构,通过root嵌套);children - →
relation-*+nodes;简单关系图可省略relations,在relations中使用箭头语法nodes - →
chart-*(数值统计,可选values)category - 不确定时使用作为备选
items
-
/
compare-binary-*二元模板:必须有两个根节点,所有对比项挂在这两个根节点的children下compare-hierarchy-left-right-* -
:使用单个
hierarchy-*,通过root嵌套(不要重复children)root -
用于自定义主题(调色板、字体等) 示例:深色主题 + 自定义配色方案
themeplaininfographic list-row-horizontal-icon-arrow theme dark palette - #61DDAA - #F6BD16 - #F08BB4 -
使用指定字体,例如手写风格
theme.base.text.font-family851tegakizatsu -
使用选择内置样式并传递参数 常见样式:
theme.stylize- :手绘效果
rough - :图案填充
pattern - /
linear-gradient:线性/径向渐变radial-gradient
示例:手绘风格(rough)plaininfographic list-row-horizontal-icon-arrow theme stylize rough base text font-family 851tegakizatsu -
不要输出JSON、Markdown或解释性文本
Data Syntax Examples
数据语法示例
Data syntax examples by template category (use corresponding fields, avoid adding simultaneously):
items- templates
list-*
plain
infographic list-grid-badge-card
data
title Feature List
lists
- label Fast
icon flash fast
- label Secure
icon secure shield check- templates
sequence-*
plain
infographic sequence-steps-simple
data
sequences
- label Step 1
- label Step 2
- label Step 3
order asc- templates
hierarchy-*
plain
infographic hierarchy-structure
data
root
label Company
children
- label Dept A
- label Dept B- templates
compare-*
plain
infographic compare-swot
data
compares
- label Strengths
children
- label Strong brand
- label Loyal users
- label Weaknesses
children
- label High cost
- label Slow releaseQuadrant diagram
plain
infographic compare-quadrant-quarter-simple-card
data
compares
- label High Impact & Low Effort
- label High Impact & High Effort
- label Low Impact & Low Effort
- label Low Impact & High Effort- templates
chart-*
plain
infographic chart-column-simple
data
values
- label Visits
value 1280
- label Conversion
value 12.4- templates
relation-*
Edge label syntax: A -label-> B or A -->|label| B
plain
infographic relation-dagre-flow-tb-simple-circle-node
data
nodes
- id A
label Node A
- id B
label Node B
relations
A - approves -> B
A -->|blocks| B- Fallback example
items
plain
infographic list-row-horizontal-icon-arrow
data
items
- label Item A
desc Description
icon sun
- label Item B
desc Description
icon moon按模板分类的数据语法示例(使用对应字段,避免同时添加):
items- 模板
list-*
plain
infographic list-grid-badge-card
data
title Feature List
lists
- label Fast
icon flash fast
- label Secure
icon secure shield check- 模板
sequence-*
plain
infographic sequence-steps-simple
data
sequences
- label Step 1
- label Step 2
- label Step 3
order asc- 模板
hierarchy-*
plain
infographic hierarchy-structure
data
root
label Company
children
- label Dept A
- label Dept B- 模板
compare-*
plain
infographic compare-swot
data
compares
- label Strengths
children
- label Strong brand
- label Loyal users
- label Weaknesses
children
- label High cost
- label Slow release四象限图
plain
infographic compare-quadrant-quarter-simple-card
data
compares
- label High Impact & Low Effort
- label High Impact & High Effort
- label Low Impact & Low Effort
- label Low Impact & High Effort- 模板
chart-*
plain
infographic chart-column-simple
data
values
- label Visits
value 1280
- label Conversion
value 12.4- 模板
relation-*
边标签语法:A -label-> B 或 A -->|label| B
plain
infographic relation-dagre-flow-tb-simple-circle-node
data
nodes
- id A
label Node A
- id B
label Node B
relations
A - approves -> B
A -->|blocks| B- 备选示例
items
plain
infographic list-row-horizontal-icon-arrow
data
items
- label Item A
desc Description
icon sun
- label Item B
desc Description
icon moonAvailable Templates
可用模板
- 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
- 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
- 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
- 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
- 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
- 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
Template Selection Recommendations:
- Strict sequence (process/steps/development trend) →
sequence-*- Timeline →
sequence-timeline-* - Staircase diagram →
sequence-stairs-* - Roadmap →
sequence-roadmap-vertical-* - Zigzag path →
sequence-zigzag-* - Circular progress →
sequence-circular-simple - Colorful snake steps →
sequence-color-snake-steps-* - Pyramid →
sequence-pyramid-simple
- Timeline →
- Opinion listing → or
list-row-*list-column-* - Binary comparison (pros/cons) →
compare-binary-* - SWOT →
compare-swot - Hierarchical structure (tree diagram) →
hierarchy-tree-* - Data charts →
chart-* - Quadrant analysis →
compare-quadrant-* - Grid list (key points) →
list-grid-* - Relationship display →
relation-* - Word cloud →
chart-wordcloud - Mind map →
hierarchy-mindmap-*
- 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
- 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
- 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
- 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
- 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
- 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
模板选择建议:
- 严格序列(流程/步骤/发展趋势)→
sequence-*- 时间线 →
sequence-timeline-* - 阶梯图 →
sequence-stairs-* - 路线图 →
sequence-roadmap-vertical-* - 之字形路径 →
sequence-zigzag-* - 环形进度 →
sequence-circular-simple - 彩色蛇形步骤 →
sequence-color-snake-steps-* - 金字塔 →
sequence-pyramid-simple
- 时间线 →
- 观点罗列 → 或
list-row-*list-column-* - 二元对比(优缺点)→
compare-binary-* - SWOT分析 →
compare-swot - 层级结构(树形图)→
hierarchy-tree-* - 数据图表 →
chart-* - 四象限分析 →
compare-quadrant-* - 网格列表(关键点)→
list-grid-* - 关系展示 →
relation-* - 词云 →
chart-wordcloud - 思维导图 →
hierarchy-mindmap-*
Example
示例
Creating an Internet technology evolution infographic
plain
infographic list-row-horizontal-icon-arrow
data
title Internet Technology Evolution
desc From Web 1.0 to AI era, key milestones
lists
- time 1991
label Web 1.0
desc Tim Berners-Lee published the first website, opening the Internet era
icon web
- time 2004
label Web 2.0
desc Social media and user-generated content become mainstream
icon account multiple
- time 2007
label Mobile
desc iPhone released, smartphone changes the world
icon cellphone
- time 2015
label Cloud Native
desc Containerization and microservices architecture are widely used
icon cloud
- time 2020
label Low Code
desc Visual development lowers the technology threshold
icon application brackets
- time 2023
label AI Large Model
desc ChatGPT ignites the generative AI revolution
icon brain创建互联网技术演进信息图
plain
infographic list-row-horizontal-icon-arrow
data
title Internet Technology Evolution
desc From Web 1.0 to AI era, key milestones
lists
- time 1991
label Web 1.0
desc Tim Berners-Lee published the first website, opening the Internet era
icon web
- time 2004
label Web 2.0
desc Social media and user-generated content become mainstream
icon account multiple
- time 2007
label Mobile
desc iPhone released, smartphone changes the world
icon cellphone
- time 2015
label Cloud Native
desc Containerization and microservices architecture are widely used
icon cloud
- time 2020
label Low Code
desc Visual development lowers the technology threshold
icon application brackets
- time 2023
label AI Large Model
desc ChatGPT ignites the generative AI revolution
icon brainGeneration Process
生成流程
Step 1: Understand User Requirements
步骤1:理解用户需求
Before creating an infographic, first understand the user's needs and the information they want to express, in order to determine the template and data structure.
If the user provides a clear content description, it should be broken down into a clear and concise structure.
Otherwise, clarification from the user is needed (e.g., "Please provide a clear and concise content description.", "Which template do you want to use?")
- Extract key information structure (title, desc, items, etc.).
- Clarify required data fields (title, desc, items, label, value, icon, etc.).
- Select appropriate template.
- Describe infographic content using AntV Infographic syntax .
{syntax}
Key Note: Must respect the language of user input. For example, if the user inputs in Chinese, the text in the syntax must also be in Chinese.
创建信息图前,首先要理解用户的需求和想要表达的信息,以此确定模板和数据结构。
如果用户提供了清晰的内容描述,应将其拆解为清晰简洁的结构。
否则,需要向用户确认(例如:“请提供清晰简洁的内容描述。”、“你想要使用哪个模板?”)
- 提取关键信息结构(标题、描述、条目等)。
- 明确所需数据字段(标题、描述、条目、标签、数值、图标等)。
- 选择合适的模板。
- 使用AntV Infographic语法描述信息图内容。
{syntax}
重要提示:必须尊重用户输入的语言。例如,如果用户用中文输入,语法中的文本也必须是中文。
Step 2: Render the Infographic
步骤2:渲染信息图
When you have the final AntV Infographic syntax, you can generate a complete HTML file following these steps:
- Create a complete HTML file with the following structure:
- DOCTYPE and HTML meta (charset: utf-8)
- Title:
{title} - Infographic - Include AntV Infographic script:
https://unpkg.com/@antv/infographic@latest/dist/infographic.min.js - Create container div with id
container - Initialize Infographic (,
width: '100%')height: '100%' - Replace with actual title
{title} - Replace with actual AntV Infographic syntax
{syntax} - Add SVG export functionality:
const svgDataUrl = await infographic.toDataURL({ type: 'svg' });
Reference HTML template:
html
<div id="container"></div>
<script src="https://unpkg.com/@antv/infographic@latest/dist/infographic.min.js"></script>
<script>
const infographic = new AntVInfographic.Infographic({
container: '#container',
width: '100%',
height: '100%',
});
document.fonts?.ready.then(() => {
infographic.render(`{syntax}`);
}).catch((error) => {
console.error('Error waiting for fonts to load:', error);
infographic.render(`{syntax}`);
});
</script>-
Use the Write tool to generate HTML file, named as
<title>-infographic.html -
Show to user:
- Generate file path and prompt: "Open directly with a browser to view and save as SVG"
- Output syntax and prompt: "Tell me if you need to adjust template/colors/content"
Note: The HTML file must include:
- SVG export via export button
- Container is responsive, both width and height are 100%
当你得到最终的AntV Infographic语法后,可以按照以下步骤生成完整的HTML文件:
- 创建具有以下结构的完整HTML文件:
- DOCTYPE和HTML meta(字符集:utf-8)
- 标题:
{title} - Infographic - 引入AntV Infographic脚本:
https://unpkg.com/@antv/infographic@latest/dist/infographic.min.js - 创建id为的容器div
container - 初始化Infographic(,
width: '100%')height: '100%' - 将替换为实际标题
{title} - 将替换为实际的AntV Infographic语法
{syntax} - 添加SVG导出功能:
const svgDataUrl = await infographic.toDataURL({ type: 'svg' });
参考HTML模板:
html
<div id="container"></div>
<script src="https://unpkg.com/@antv/infographic@latest/dist/infographic.min.js"></script>
<script>
const infographic = new AntVInfographic.Infographic({
container: '#container',
width: '100%',
height: '100%',
});
document.fonts?.ready.then(() => {
infographic.render(`{syntax}`);
}).catch((error) => {
console.error('Error waiting for fonts to load:', error);
infographic.render(`{syntax}`);
});
</script>-
使用Write工具生成HTML文件,命名为
<title>-infographic.html -
展示给用户:
- 生成文件路径并提示:“直接用浏览器打开即可查看并保存为SVG”
- 输出语法并提示:“如果需要调整模板/颜色/内容,请告诉我”
注意:HTML文件必须包含:
- 通过导出按钮实现SVG导出
- 容器为响应式,宽高均为100%