API 參考

FBoxplotChartBuilder

此 API 頁面目前提供英文內容。程式碼簽名與識別符不隨介面語言變更。

Boxplot keeps its existing automatic preset but does not expose explicit gradients.

Each selected numeric field is one distribution and must contain its raw samples. The renderer calculates the five-number summary; do not supply precomputed Min/Q1/Median/Q3/Max rows. Field headers become distribution labels.

Inheritance

Extends FCartesianChartBuilder. Its inherited members are available on this object.

Example

Sheet

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')fWorksheet.getRange('A1:C6').setValues([  ['Group A', 'Group B', 'Group C'],  [12, 18, 9],  [15, 20, 13],  [19, 24, 16],  [22, 28, 21],  [25, 31, 24],])const chartInfo = fWorksheet  .newChart(univerAPI.Enum.ChartTypeString.Boxplot)  .setSource({    range: 'A1:C6',    orientation: univerAPI.Enum.ChartSourceOrientation.Columns,  })  .setValueFields([0, 1, 2])  .setTitle('Distribution')  .build()await fWorksheet.insertChart(chartInfo)

Doc

TypeScript
const fDocument = univerAPI.getActiveDocument()const chartInfo = fDocument  .newChart(univerAPI.Enum.ChartTypeString.Boxplot)  .setSource([    ['Group A', 'Group B'],    [12, 18],    [15, 20],    [19, 24],    [22, 28],  ])  .setValueFields([0, 1])  .setTitle('Distribution')  .build()await fDocument.insertChart(chartInfo)

Slide

TypeScript
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const chartInfo = fSlide  .newChart(univerAPI.Enum.ChartTypeString.Boxplot)  .setSource([    ['Group A', 'Group B'],    [12, 18],    [15, 20],    [19, 24],    [22, 28],  ])  .setValueFields([0, 1])  .setTitle('Distribution')  .build()await fSlide.insertChart(chartInfo)

Board

TypeScript
const fBoard = univerAPI.getActiveBoard()const chartInfo = fBoard  .newChart(univerAPI.Enum.ChartTypeString.Boxplot)  .setSource([    ['Group A', 'Group B'],    [12, 18],    [15, 20],    [19, 24],    [22, 28],  ])  .setValueFields([0, 1])  .setTitle('Distribution')  .build()await fBoard.insertChart(chartInfo)

Setup

Register @univerjs-pro/engine-chart or a preset that includes it. In plugin mode, import @univerjs-pro/engine-chart/facade. Additional methods below require their listed plugin packages. See Facade setup.

你覺得這篇文檔如何?

© 2026 DreamNum Co., Ltd.