FParetoChartBuilder
Fluent, type-specific Builder for Pareto Charts.
Select one category field with setCategoryField() and one numeric value field with
setValueFields([index]). Field indexes are zero-based in the normalized data source.
Explicit mapping is necessary when the source shape is ambiguous, such as a Sheet range
containing only numeric values; without both roles, the Chart has no renderable series.
Rows with the same category are aggregated. By default, zero and negative totals are
excluded, the remaining categories are sorted from largest to smallest, and the renderer
derives the cumulative-percentage line from the selected value field. Use
setIncludeZeroValues(true) to retain zero totals; negative totals remain excluded.
Inheritance
Extends FCartesianChartBuilder. Its inherited members are available on this object.
Example
Sheet
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')const chartInfo = fWorksheet .newChart(univerAPI.Enum.ChartTypeString.Pareto) .setSource('A1:B8') .setCategoryField(0) .setValueFields([1]) .setBarStyle({ color: '#2563eb', opacity: 0.8 }) .setCumulativeLineStyle({ color: '#dc2626', width: 2 }) .setIncludeZeroValues(false) .build()await fWorksheet.insertChart(chartInfo)Doc
const fDocument = univerAPI.getActiveDocument()const chartInfo = fDocument .newChart(univerAPI.Enum.ChartTypeString.Pareto) .setSource([ ['Cause', 'Count'], ['A', 42], ['B', 28], ['C', 15], ]) .setCategoryField(0) .setValueFields([1]) .setBarStyle({ color: '#2563eb', opacity: 0.8 }) .setCumulativeLineStyle({ color: '#dc2626', width: 2 }) .setIncludeZeroValues(false) .build()await fDocument.insertChart(chartInfo)Slide
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const chartInfo = fSlide .newChart(univerAPI.Enum.ChartTypeString.Pareto) .setSource([ ['Cause', 'Count'], ['A', 42], ['B', 28], ['C', 15], ]) .setCategoryField(0) .setValueFields([1]) .setBarStyle({ color: '#2563eb', opacity: 0.8 }) .setCumulativeLineStyle({ color: '#dc2626', width: 2 }) .setIncludeZeroValues(false) .build()await fSlide.insertChart(chartInfo)Board
const fBoard = univerAPI.getActiveBoard()const chartInfo = fBoard .newChart(univerAPI.Enum.ChartTypeString.Pareto) .setSource([ ['Cause', 'Count'], ['A', 42], ['B', 28], ['C', 15], ]) .setCategoryField(0) .setValueFields([1]) .setBarStyle({ color: '#2563eb', opacity: 0.8 }) .setCumulativeLineStyle({ color: '#dc2626', width: 2 }) .setIncludeZeroValues(false) .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.
@univerjs-pro/engine-chart
FParetoChartBuilder.clearBarStyle
Clears the complete Pareto bar style.
After clearing, bars again use the active chart theme palette, full opacity, and renderer-default borders and labels.
This method executes synchronously.
clearBarStyle(): thisReturns
This builder for chaining.
Examples
builder.clearBarStyle()const barStyle = builder.build().config.pareto?.barStylePackage: @univerjs-pro/engine-chart · Type definitions
FParetoChartBuilder.clearCumulativeLineStyle
Clears the complete Pareto cumulative-line style.
The cumulative line remains visible and falls back to the fourth active theme color, a 2 px solid stroke, full opacity, and 7 px points.
This method executes synchronously.
clearCumulativeLineStyle(): thisReturns
This builder for chaining.
Examples
builder.clearCumulativeLineStyle()const lineStyle = builder.build().config.pareto?.cumulativeLineStylePackage: @univerjs-pro/engine-chart · Type definitions
FParetoChartBuilder.resetIncludeZeroValues
Restores the default of excluding zero-valued categories and returns this builder for chaining.
This method executes synchronously.
resetIncludeZeroValues(): thisReturns
This builder for chaining.
Examples
builder.resetIncludeZeroValues()Package: @univerjs-pro/engine-chart · Type definitions
FParetoChartBuilder.setBarStyle
Deep-merges supported Pareto bar appearance.
Omitted fields keep their current values. Without explicit overrides, bars use the active chart theme palette, full opacity, and renderer-default borders and labels.
This method executes synchronously.
Read the current value from builder.build().config.pareto?.barStyle.
setBarStyle(value: IChartParetoBarStyleSpec): thisParameters
value— Required. Supported bar appearance fields.
Returns
This builder for chaining.
Examples
builder.setBarStyle({ color: '#1677ff', opacity: 0.8 })const barStyle = builder.build().config.pareto?.barStyleTypes: IChartParetoBarStyleSpec
Package: @univerjs-pro/engine-chart · Type definitions
FParetoChartBuilder.setCumulativeLineStyle
Deep-merges supported Pareto cumulative-line appearance.
Omitted fields keep their current values. Without explicit overrides, the line uses the fourth active theme color, a 2 px solid stroke, full opacity, and 7 px points.
This method executes synchronously.
Non-positive widths are ignored because the cumulative line remains part of Pareto.
Read the current value from builder.build().config.pareto?.cumulativeLineStyle.
setCumulativeLineStyle(value: IChartParetoLineStyleSpec): thisParameters
value— Required. Supported cumulative-line appearance fields.
Returns
This builder for chaining.
Examples
builder.setCumulativeLineStyle({ color: '#f5222d', width: 2 })const lineStyle = builder.build().config.pareto?.cumulativeLineStyleTypes: IChartParetoLineStyleSpec
Package: @univerjs-pro/engine-chart · Type definitions
FParetoChartBuilder.setIncludeZeroValues
Sets the include zero values configuration and returns this builder for chaining.
This method executes synchronously.
setIncludeZeroValues(value: boolean): thisParameters
value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
builder.setIncludeZeroValues(true)Package: @univerjs-pro/engine-chart · Type definitions
你觉得这篇文档如何?