百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
G

GPT-Vis

> AI 编程
开源

GPT Vision,面向 AI 友好型的可视化! AntV 专为 AI 打造,100% 由 AI 生成。

760 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

GPT Vision,面向 AI 友好型的可视化! AntV 专为 AI 打造,100% 由 AI 生成。

English | 简体中文

GPT-Vis

✨ Features

  • Framework Agnostic — Works with vanilla JavaScript, React, Vue, Angular, or any framework
  • ✍️ Markdown-like Syntax — Simple syntax that LLMs can generate directly, easy to learn and use
  • Streaming Rendering — Native support for AI model streaming output, renders as it generates
  • ️ Fault Tolerant — Gracefully handles incomplete or malformed data, adapts to the uncertainty of AI-generated content
  • 26 Chart Types — Statistical charts, relationship graphs, and text visualizations covering mainstream scenarios
  • Theme System — Built-in light, dark, and academy themes with customizable color palettes

Quick Start

Installation

bash
npm install @antv/gpt-vis

Basic Usage

javascript
import { GPTVis } from '@antv/gpt-vis';

const gptVis = new GPTVis({
  container: 'container',
  width: 600,
  height: 400,
});

gptVis.render({
  type: 'line',
  data: [
    { time: '2020', value: 100 },
    { time: '2021', value: 120 },
    { time: '2022', value: 150 },
  ],
});

Streaming Rendering

Charts render as the AI model generates, no need to wait for the full response:

javascript
import { GPTVis, isVisSyntax } from '@antv/gpt-vis';

const gptVis = new GPTVis({ container: 'container', width: 600, height: 400 });
let buffer = '';

function onToken(token) {
  buffer += token;
  if (isVisSyntax(buffer)) {
    gptVis.render(buffer);
  }
}

Syntax Guide

render() supports two input formats: JSON objects (ideal for programmatic use) and DSL syntax (ideal for LLM streaming).

Object Config

Pass JSON objects directly for programmatic chart creation:

Line chart:

javascript
gptVis.render({
  type: 'line',
  data: [
    { time: '2020', value: 100 },
    { time: '2021', value: 120 },
    { time: '2022', value: 150 },
  ],
});

Pie chart:

javascript
gptVis.render({
  type: 'pie',
  data: [
    { category: 'Android', value: 72 },
    { category: 'iOS', value: 28 },
  ],
  innerRadius: 0.6,
});

Themes:

Three built-in themes, switchable via the theme property:

Theme Identifier Background Palette
Default (Light) default #FFF #1783FF #F08F56 #D580FF #00C9C9 #7863FF ...
Dark dark #000 #1783FF #F08F56 #D580FF #00C9C9 #7863FF ...
Academy academy #FFF #4e79a7 #f28e2c #e15759 #76b7b2 #59a14f ...
javascript
gptVis.render({
  type: 'line',
  data: [
    { time: '2020', value: 100 },
    { time: '2021', value: 120 },
  ],
  theme: 'dark',
});

Custom Styles:

javascript
gptVis.render({
  type: 'line',
  data: [
    { time: '2020', value: 100 },
    { time: '2021', value: 120 },
  ],
  style: { lineWidth: 3, palette: ['#5B8FF9', '#5AD8A6'] },
});

DSL Syntax

Declarative markdown-like syntax that LLMs can generate without learning complex APIs:

vis [chart-type]
[property] [value]
data
  - [field] [value]

Pie chart:

vis pie
data
  - category Sales
    value 30
  - category Marketing
    value 25
innerRadius 0.6

Themes:

vis line
data
  - time 2020
    value 100
  - time 2021
    value 120
theme dark

Custom Styles:

Use style to set line width, custom palettes, and more:

vis line
data
  - time 2020
    value 100
  - time 2021
    value 120
style
  lineWidth 3
  palette
    - #5B8FF9
    - #5AD8A6

Quoted string values (for values with spaces):

vis pie
data
  - category "Q1 Sales"
    value 30
  - category "Q2 Sales"
    value 25

Hierarchical data:

vis mindmap
data
  - name Project Plan
    children
      - name Phase 1
      - name Phase 2

Render DSL syntax:

javascript
const visSyntax = `
vis line
data
  - time 2020
    value 100
  - time 2021
    value 120
  - time 2022
    value 150
`;

gptVis.render(visSyntax);

Chart Types

26 chart types covering statistical analysis, relationship networks, and text visualization.

Statistical Charts (18)

Chart Type Identifier
Line line
Area area
Column column
Bar bar
Pie pie
Scatter scatter
Radar radar
Funnel funnel
Waterfall waterfall
Dual Axes dual-axes
Histogram histogram
Boxplot boxplot
Violin violin
Venn venn
Sankey sankey
Treemap treemap
Word Cloud word-cloud
Liquid liquid

Relationship Charts (6)

Chart Type Identifier
Flow Diagram flow-diagram
Network Graph network-graph
Mindmap mindmap
Indented Tree indented-tree
Organization Chart organization-chart
Fishbone Diagram fishbone-diagram

Text Visualization (2)

Chart Type Identifier
Table table
Summary summary

Explore all examples → Examples Gallery

Framework Integration

Vanilla JavaScript

javascript
import { GPTVis } from '@antv/gpt-vis';

const gptVis = new GPTVis({ container: 'chart', width: 600, height: 400 });
gptVis.render(visSyntaxString);

React

javascript
import { GPTVis } from '@antv/gpt-vis';
import { useEffect, useRef } from 'react';

function ChartComponent({ visSyntax }) {
  const containerRef = useRef();
  const gptVisRef = useRef();

  useEffect(() => {
    gptVisRef.current = new GPTVis({ container: containerRef.current, width: 600, height: 400 });
    return () => gptVisRef.current?.destroy();
  }, []);

  useEffect(() => {
    if (gptVisRef.current && visSyntax) {
      gptVisRef.current.render(visSyntax);
    }
  }, [visSyntax]);

  return 

Markdown Renderer (marked)

GPT-Vis syntax naturally works with Markdown code fences and integrates with any Markdown renderer. The following example uses marked + marked-highlight — normal code blocks get syntax highlighting, while vis code blocks are rendered as interactive charts.

Install dependencies:

bash
npm install @antv/gpt-vis marked marked-highlight highlight.js

Complete example:

…

Shadcn/ui

Copy GPT-Vis React components directly into your project via shadcn CLI — full source control, fully customizable.

Base Component

The universal GPTVis component accepts vis syntax strings or config objects for all 26 chart types:

bash
npx shadcn@latest add @gpt-vis/gpt-vis
typescript
import { GPTVis } from '@/components/ui/gpt-vis';

;

Typed Chart Components

Each chart type has its own component with a typed config prop — JSON only, chart-specific TypeScript validation:

bash
npx shadcn@latest add @gpt-vis/line
typescript
import { Line } from '@/components/ui/line';

;

All 26 chart types are available. Install any by name:

bash
npx shadcn@latest add @gpt-vis/pie
npx shadcn@latest add @gpt-vis/bar
npx shadcn@latest add @gpt-vis/mindmap
# ...and more

Each typed component automatically bundles the base GPTVis component as a dependency. Props like width, height, theme, wrapper, locale, className, and containerStyle are the same across all components.

AI Ecosystem

GPT-Vis provides a complete AI integration solution:

  • MCP Server — Enable AI models to directly invoke visualization capabilities via Model Context Protocol
  • Chart Skill — Provide AI assistants with chart recommendation and generation capabilities, supporting both syntax mode and code mode output

Contributing

AI-Generated Code Policy: This project only merges AI-generated code.

  1. Submit an Issue describing the problem or feature request
  2. Tag @copilot to generate the implementation
  3. Submit a PR with AI-generated code

License

MIT © AntV

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

TypeScriptantvisgptsllmlui

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类AI 编程
定价开源

> 相关工具

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.