Skip to content
Browse documentation
Reference

GPTVis API

Constructor options, rendering, and instance cleanup.

Constructor

js
new GPTVis(options: VisualizationOptions)

Creates a new GPTVis instance. Parameters:

  • container: string | HTMLElement — container element or CSS selector (required)
  • width?: number — chart width in pixels (optional)
  • height?: number — chart height in pixels (optional)
  • theme?: 'default' | 'light' | 'dark' | 'academy' | ThemeSpec — built-in theme name or reusable custom theme object (default: 'default'). See custom themes.
  • wrapper?: boolean — enable wrapper UI with tabs, download and copy controls (default: false)
  • locale?: string — locale for wrapper labels (default: 'zh-CN')

render()

ts
gptVis.render(config: string | GPTVisConfig): void

Renders a visualization. Accepts either:

  • A string — GPT-Vis markdown-like syntax starting with vis [chart-type] · Syntax Guide →
  • A GPTVisConfig object — plain config object with a type field and chart data · JSON Config →

destroy()

js
gptVis.destroy(): void

Destroys the GPTVis instance and cleans up all allocated resources.

GPT-Vis · An AntV project · MIT licensed