# antvis/infographic architecture

> Architecture diagram of the GitHub repository antvis/infographic, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/antvis/infographic
- Repository: https://github.com/antvis/infographic

## Overview

AntV Infographic is a declarative infographic-generation and SVG-rendering framework, with an editor and browser-based demos. Its main user flow is to supply infographic syntax and options to the runtime, which parses and resolves templates, themes, and designs before rendering SVG; users can then edit or export the result. The README documents streaming rendering, built-in templates, theming, and editing. Some runtime wiring was not sampled, so uncertain relationships are shown as unverified or omitted.

Main entry points: [`src/index.ts`](https://github.com/antvis/infographic/blob/main/src/index.ts) (Public API), [`src/syntax/index.ts`](https://github.com/antvis/infographic/blob/main/src/syntax/index.ts) (Syntax parser), [`src/runtime/Infographic.tsx`](https://github.com/antvis/infographic/blob/main/src/runtime/Infographic.tsx) (Infographic runtime), [`src/options/parser.ts`](https://github.com/antvis/infographic/blob/main/src/options/parser.ts) (Option resolver)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Generation and rendering"]
  node_api["Public API<br/>[index.ts]"]
  node_runtime["Infographic runtime<br/>[Infographic.tsx]"]
  node_syntax["Syntax parser<br/>[index.ts]"]
  node_syntax_ast["Syntax AST parser<br/>[parser.ts]"]
  node_syntax_mapper["Schema mapper<br/>[mapper.ts]"]
  node_syntax_relations["Relation parser<br/>[relations.ts]"]
  node_options["Option resolver<br/>[parser.ts]"]
  node_renderer["SVG renderer<br/>[renderer.ts]"]
  node_jsx["SVG element runtime<br/>[jsx-runtime.ts]"]
  node_bounds["Element bounds<br/>[bounds.ts]"]
  node_resources["Resource loaders"]
end

subgraph group_content["Design system"]
  node_templates["Template registry<br/>[registry.ts]"]
  node_builtin_templates["Built-in templates<br/>[built-in.ts]"]
  node_designs["Design catalog"]
  node_themes["Theme system"]
end

subgraph group_editing["Editing and output"]
  node_editor["Interactive editor<br/>[base.ts]"]
  node_exporter["SVG export<br/>[svg.ts]"]
end

subgraph group_experiences["User experiences"]
  node_ai_playground["AI playground<br/>[Service.ts]"]
  node_site_editor["Live editor"]
  node_dev_preview["Template preview<br/>[Preview.tsx]"]
  node_dev_stream["Streaming preview<br/>[StreamPreview.tsx]"]
  node_dev_composite["Composite preview<br/>[Composite.tsx]"]
  node_preview_settings["Preview settings"]
  node_preview_data["Preview data<br/>[usePreviewData.ts]"]
  node_preview_interactions["Preview interactions"]
  node_datasets["Preview datasets<br/>[datasets.ts]"]
  node_storage["Local storage<br/>[storage.ts]"]
end

node_developer(("Application developer"))

node_developer -->|"uses"| node_api
node_api -->|"exports"| node_runtime
node_api -->|"exports"| node_syntax
node_api -->|"exports"| node_templates
node_syntax -->|"parses AST"| node_syntax_ast
node_syntax -->|"maps schemas"| node_syntax_mapper
node_syntax -->|"parses relations"| node_syntax_relations
node_options -->|"resolves templates"| node_templates
node_options -->|"resolves designs"| node_designs
node_options -->|"resolves themes"| node_themes
node_templates -->|"loads built-ins"| node_builtin_templates
node_api -->|"exports"| node_designs
node_api -->|"exports"| node_themes
node_api -->|"exports"| node_renderer
node_api -->|"exports"| node_jsx
node_api -->|"exports"| node_resources
node_api -->|"exports"| node_editor
node_api -->|"exports"| node_exporter
node_runtime -.->|"parses input"| node_syntax
node_runtime -.->|"resolves options"| node_options
node_runtime -.->|"renders graphic"| node_renderer
node_renderer -.->|"creates SVG"| node_jsx
node_jsx -.->|"measures elements"| node_bounds
node_api -.->|"enables editing"| node_editor
node_api -->|"exports SVG"| node_exporter
node_developer -.->|"generates content"| node_ai_playground
node_developer -.->|"edits infographic"| node_site_editor
node_developer -.->|"previews templates"| node_dev_preview
node_developer -.->|"views streaming"| node_dev_stream
node_dev_preview -->|"composes preview"| node_dev_composite
node_dev_stream -.->|"shares preview"| node_dev_composite
node_dev_composite -->|"uses settings"| node_preview_settings
node_dev_composite -->|"uses data"| node_preview_data
node_preview_interactions -->|"coordinates"| node_preview_settings
node_preview_interactions -->|"updates data"| node_preview_data
node_preview_interactions -->|"selects dataset"| node_datasets
node_preview_settings -->|"persists settings"| node_storage
node_preview_data -->|"persists data"| node_storage

click node_api "https://github.com/antvis/infographic/blob/main/src/index.ts"
click node_runtime "https://github.com/antvis/infographic/blob/main/src/runtime/Infographic.tsx"
click node_syntax "https://github.com/antvis/infographic/blob/main/src/syntax/index.ts"
click node_syntax_ast "https://github.com/antvis/infographic/blob/main/src/syntax/parser.ts"
click node_syntax_mapper "https://github.com/antvis/infographic/blob/main/src/syntax/mapper.ts"
click node_syntax_relations "https://github.com/antvis/infographic/blob/main/src/syntax/relations.ts"
click node_options "https://github.com/antvis/infographic/blob/main/src/options/parser.ts"
click node_templates "https://github.com/antvis/infographic/blob/main/src/templates/registry.ts"
click node_builtin_templates "https://github.com/antvis/infographic/blob/main/src/templates/built-in.ts"
click node_designs "https://github.com/antvis/infographic/tree/main/src/designs"
click node_themes "https://github.com/antvis/infographic/tree/main/src/themes"
click node_renderer "https://github.com/antvis/infographic/blob/main/src/renderer/renderer.ts"
click node_jsx "https://github.com/antvis/infographic/blob/main/src/jsx/jsx-runtime.ts"
click node_bounds "https://github.com/antvis/infographic/blob/main/src/jsx/utils/bounds.ts"
click node_resources "https://github.com/antvis/infographic/tree/main/src/resource"
click node_editor "https://github.com/antvis/infographic/blob/main/src/editor/interactions/base.ts"
click node_exporter "https://github.com/antvis/infographic/blob/main/src/exporter/svg.ts"
click node_ai_playground "https://github.com/antvis/infographic/blob/main/site/src/components/AIPlayground/Service.ts"
click node_site_editor "https://github.com/antvis/infographic/tree/main/site/src/components/LiveEditor"
click node_dev_preview "https://github.com/antvis/infographic/blob/main/dev/src/Preview.tsx"
click node_dev_stream "https://github.com/antvis/infographic/blob/main/dev/src/StreamPreview.tsx"
click node_dev_composite "https://github.com/antvis/infographic/blob/main/dev/src/Composite.tsx"
click node_preview_settings "https://github.com/antvis/infographic/blob/main/dev/src/hooks/usePreviewSettings.ts"
click node_preview_data "https://github.com/antvis/infographic/blob/main/dev/src/hooks/usePreviewData.ts"
click node_preview_interactions "https://github.com/antvis/infographic/blob/main/dev/src/hooks/usePreviewInteractions.ts"
click node_datasets "https://github.com/antvis/infographic/blob/main/shared/datasets.ts"
click node_storage "https://github.com/antvis/infographic/blob/main/dev/src/utils/storage.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_api,node_runtime,node_syntax,node_syntax_ast,node_syntax_mapper,node_syntax_relations,node_options,node_renderer,node_jsx,node_bounds,node_resources toneBlue
class node_templates,node_builtin_templates,node_designs,node_themes toneAmber
class node_editor,node_exporter toneMint
class node_ai_playground,node_site_editor,node_dev_preview,node_dev_stream,node_dev_composite,node_preview_settings,node_preview_data,node_preview_interactions,node_datasets,node_storage toneRose
class node_developer toneIndigo
```

## Components

### Generation and rendering

- [Public API](https://github.com/antvis/infographic/blob/main/src/index.ts): `src/index.ts`
- [Infographic runtime](https://github.com/antvis/infographic/blob/main/src/runtime/Infographic.tsx): `src/runtime/Infographic.tsx`
- [Syntax parser](https://github.com/antvis/infographic/blob/main/src/syntax/index.ts): `src/syntax/index.ts`
- [Syntax AST parser](https://github.com/antvis/infographic/blob/main/src/syntax/parser.ts): `src/syntax/parser.ts`
- [Schema mapper](https://github.com/antvis/infographic/blob/main/src/syntax/mapper.ts): `src/syntax/mapper.ts`
- [Relation parser](https://github.com/antvis/infographic/blob/main/src/syntax/relations.ts): `src/syntax/relations.ts`
- [Option resolver](https://github.com/antvis/infographic/blob/main/src/options/parser.ts): `src/options/parser.ts`
- [SVG renderer](https://github.com/antvis/infographic/blob/main/src/renderer/renderer.ts): `src/renderer/renderer.ts`
- [SVG element runtime](https://github.com/antvis/infographic/blob/main/src/jsx/jsx-runtime.ts): `src/jsx/jsx-runtime.ts`
- [Element bounds](https://github.com/antvis/infographic/blob/main/src/jsx/utils/bounds.ts): `src/jsx/utils/bounds.ts`
- [Resource loaders](https://github.com/antvis/infographic/tree/main/src/resource): `src/resource`

### Design system

- [Template registry](https://github.com/antvis/infographic/blob/main/src/templates/registry.ts): `src/templates/registry.ts`
- [Built-in templates](https://github.com/antvis/infographic/blob/main/src/templates/built-in.ts): `src/templates/built-in.ts`
- [Design catalog](https://github.com/antvis/infographic/tree/main/src/designs): `src/designs`
- [Theme system](https://github.com/antvis/infographic/tree/main/src/themes): `src/themes`

### Editing and output

- [Interactive editor](https://github.com/antvis/infographic/blob/main/src/editor/interactions/base.ts): `src/editor/interactions/base.ts`
- [SVG export](https://github.com/antvis/infographic/blob/main/src/exporter/svg.ts): `src/exporter/svg.ts`

### User experiences

- [AI playground](https://github.com/antvis/infographic/blob/main/site/src/components/AIPlayground/Service.ts): `site/src/components/AIPlayground/Service.ts`
- [Live editor](https://github.com/antvis/infographic/tree/main/site/src/components/LiveEditor): `site/src/components/LiveEditor`
- [Template preview](https://github.com/antvis/infographic/blob/main/dev/src/Preview.tsx): `dev/src/Preview.tsx`
- [Streaming preview](https://github.com/antvis/infographic/blob/main/dev/src/StreamPreview.tsx): `dev/src/StreamPreview.tsx`
- [Composite preview](https://github.com/antvis/infographic/blob/main/dev/src/Composite.tsx): `dev/src/Composite.tsx`
- [Preview settings](https://github.com/antvis/infographic/blob/main/dev/src/hooks/usePreviewSettings.ts): `dev/src/hooks/usePreviewSettings.ts`
- [Preview data](https://github.com/antvis/infographic/blob/main/dev/src/hooks/usePreviewData.ts): `dev/src/hooks/usePreviewData.ts`
- [Preview interactions](https://github.com/antvis/infographic/blob/main/dev/src/hooks/usePreviewInteractions.ts): `dev/src/hooks/usePreviewInteractions.ts`
- [Preview datasets](https://github.com/antvis/infographic/blob/main/shared/datasets.ts): `shared/datasets.ts`
- [Local storage](https://github.com/antvis/infographic/blob/main/dev/src/utils/storage.ts): `dev/src/utils/storage.ts`

### Other components

- **Application developer**

## Connections

- Application developer → Public API: uses (evidence: `README.md`)
- Public API → Infographic runtime: exports (evidence: `src/index.ts`)
- Public API → Syntax parser: exports (evidence: `src/index.ts`)
- Public API → Template registry: exports (evidence: `src/index.ts`)
- Syntax parser → Syntax AST parser: parses AST (evidence: `src/syntax/index.ts`)
- Syntax parser → Schema mapper: maps schemas (evidence: `src/syntax/index.ts`)
- Syntax parser → Relation parser: parses relations (evidence: `src/syntax/index.ts`)
- Option resolver → Template registry: resolves templates (evidence: `src/options/parser.ts`)
- Option resolver → Design catalog: resolves designs (evidence: `src/options/parser.ts`)
- Option resolver → Theme system: resolves themes (evidence: `src/options/parser.ts`)
- Template registry → Built-in templates: loads built-ins (evidence: `src/templates/index.ts`)
- Public API → Design catalog: exports (evidence: `src/index.ts`)
- Public API → Theme system: exports (evidence: `src/index.ts`)
- Public API → SVG renderer: exports (evidence: `src/index.ts`)
- Public API → SVG element runtime: exports (evidence: `src/index.ts`)
- Public API → Resource loaders: exports (evidence: `src/index.ts`)
- Public API → Interactive editor: exports (evidence: `src/index.ts`)
- Public API → SVG export: exports (evidence: `src/index.ts`)
- Infographic runtime → Syntax parser: parses input
- Infographic runtime → Option resolver: resolves options
- Infographic runtime → SVG renderer: renders graphic
- SVG renderer → SVG element runtime: creates SVG
- SVG element runtime → Element bounds: measures elements
- Public API → Interactive editor: enables editing (evidence: `README.md`)
- Public API → SVG export: exports SVG (evidence: `src/index.ts`)
- Application developer → AI playground: generates content (evidence: `README.md`)
- Application developer → Live editor: edits infographic (evidence: `README.md`)
- Application developer → Template preview: previews templates
- Application developer → Streaming preview: views streaming (evidence: `README.md`)
- Template preview → Composite preview: composes preview (evidence: `dev/src/App.tsx`)
- Streaming preview → Composite preview: shares preview
- Composite preview → Preview settings: uses settings
- Composite preview → Preview data: uses data
- Preview interactions → Preview settings: coordinates (evidence: `dev/src/hooks/usePreviewInteractions.ts`)
- Preview interactions → Preview data: updates data (evidence: `dev/src/hooks/usePreviewInteractions.ts`)
- Preview interactions → Preview datasets: selects dataset (evidence: `dev/src/hooks/usePreviewInteractions.ts`)
- Preview settings → Local storage: persists settings (evidence: `dev/src/hooks/usePreviewSettings.ts`)
- Preview data → Local storage: persists data (evidence: `dev/src/hooks/usePreviewData.ts`)
