Charts

Plugins Info

Register chart support

Chart support in Slides consists of a model package and a UI package. @univerjs-pro/chart-ui provides the shared editor controls, locale entries, and styles.

TypeScript
import ChartUIEnUS from '@univerjs-pro/chart-ui/locale/en-US'import { UniverSlidesChartPlugin } from '@univerjs-pro/slides-chart'import { UniverSlidesChartUIPlugin } from '@univerjs-pro/slides-chart-ui'import SlidesChartUIEnUS from '@univerjs-pro/slides-chart-ui/locale/en-US'import { LocaleType, mergeLocales } from '@univerjs/core'import '@univerjs-pro/chart-ui/facade'import '@univerjs-pro/chart-ui/lib/index.css'import '@univerjs-pro/slides-chart-ui/lib/index.css'import '@univerjs-pro/slides-chart/facade'univerAPI.loadLocales(LocaleType.EN_US, mergeLocales(ChartUIEnUS, SlidesChartUIEnUS))univer.registerPlugin(UniverSlidesChartPlugin)univer.registerPlugin(UniverSlidesChartUIPlugin)

Register chart support before opening or importing a presentation that may contain chart elements.

Mobile support

Configure the mobile editor first. In the plugin-mode setup described on this page, replace the desktop registrations below with the mobile exports from the same packages, and make the replacement before opening a document. Keep the model plugins, styles, locales, and Facade imports, and do not register both variants.

PackageDesktop registrationMobile registration
@univerjs-pro/slides-chart-uiUniverSlidesChartUIPluginUniverSlidesChartMobileUIPlugin

Register chart data plugins

Chart data that comes from a reference requires UniverChartEmbedPlugin. Install the plugin and register it once during initialization, before opening the presentation. If UniverEmbedPlugin is configured explicitly, register that plugin first. Mobile setup is identical, and inline arrays do not require this plugin.

Shell
pnpm add @univerjs-pro/chart-embed
TypeScript
import { UniverChartEmbedPlugin } from '@univerjs-pro/chart-embed'univer.registerPlugin(UniverChartEmbedPlugin)

Create and update charts

slide.newChart(type) returns a detached builder. The chart does not appear on the slide until the built chart information is passed to slide.insertChart(info).

TypeScript
const presentation = univerAPI.getActivePresentation()if (!presentation) throw new Error('No active presentation')const slide = presentation.getActiveSlide()const info = slide  .newChart(univerAPI.Enum.ChartTypeString.Column)  .setSource([    ['Month', 'Revenue', 'Cost'],    ['Jan', 120, 80],    ['Feb', 180, 96],    ['Mar', 240, 132],  ])  .setTitle('Quarterly revenue')  .setAbsolutePosition(80, 120)  .setSize(520, 320)  .setZOrder(1)  .build()const chart = await slide.insertChart(info)chart.setLegend({ visible: true }).bringToFront()const updatedInfo = chart.toBuilder(univerAPI.Enum.ChartTypeString.Line).setSubtitle('FY 2026').build()await chart.update(updatedInfo)const svg = await chart.exportImage({ format: 'svg' })

Setters on the inserted chart update the chart immediately. Use toBuilder(type) with update(info) when a complete detached copy or a type change is required. exportImage() returns undefined when no UI renderer can provide an image.

Use slide.getCharts() and slide.getChart(id) to resolve live charts, and call await chart.remove() to delete a chart. Slide builders also provide setPlaceholder(), setStroke(), and setZOrder().

Error bars

Call setErrorBars() on a builder or on a live chart. Basic 2D column, bar, line, and scatter charts support error bars. seriesIndex is zero-based and includes the category field in the source data. Use y for columns and lines, x for bars, and either numeric axis for scatter.

TypeScript
chart.setErrorBars([  { seriesIndex: 1, direction: 'y', type: 'both', valueType: 'percentage', value: 20 },])

FChart.setErrorBars()

Multi-level category axes

For hierarchical inline data, select the category fields in root-to-leaf order and enable multi-level rendering:

TypeScript
const info = slide  .newChart(univerAPI.Enum.ChartTypeString.Column)  .setSource([    ['Region', 'Quarter', 'Revenue'],    ['North', 'Q1', 120],    ['North', 'Q2', 148],    ['South', 'Q1', 98],    ['South', 'Q2', 132],  ])  .setCategoryFields([0, 1])  .setMultiLevelCategoryAxis(true)  .setValueFields([2])  .setAbsolutePosition(80, 120)  .setSize(520, 320)  .build()await slide.insertChart(info)

Bind a chart to Sheet data

If the chart should follow a Sheet range instead of storing a copy of the values, pass a resource reference to setSource():

TypeScript
const info = slide  .newChart(univerAPI.Enum.ChartTypeString.Column)  .setSource({    unit: { selector: 'sales-workbook', type: 'sheet' },    part: {      kind: 'range',      sheetName: 'Data',      range: 'A1:B20',      ref: 'Data!A1:B20',    },  })  .setAbsolutePosition(120, 80)  .setSize(640, 360)  .build()const chart = await slide.insertChart(info)

The Chart Facade reference documents the configuration that all chart types share.

The shared builders also support 3D chart configuration, logarithmic value axes, and radar scale labels. In Slides, use slide.newChart() with inline or referenced data as shown on this page.

How is this guide?

© 2026 DreamNum Co., Ltd.