API Reference

FHistogramChartBuilder

Fluent builder for a one-field raw-sample Histogram.

Select exactly one numeric field containing individual observations. The renderer computes bins from those raw samples; do not pass pre-binned ranges or frequencies.

Histogram settings are persisted as authored. Rendering uses Scott Auto when explicit binning is ineffective, never emits more than 1000 visible bins, and falls back to a zero visual gap for ineffective gap values.

Inheritance

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

Example

Sheet

TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')const chartInfo = fWorksheet  .newChart(univerAPI.Enum.ChartTypeString.Histogram)  .setSource('A1:A100')  .setHistogramField(0)  .setBinCount(12)  .setUnderflowThreshold(0)  .setOverflowThreshold(100)  .setBinGap(0.1)  .build()await fWorksheet.insertChart(chartInfo)

Doc

TypeScript
const fDocument = univerAPI.getActiveDocument()const chartInfo = fDocument  .newChart(univerAPI.Enum.ChartTypeString.Histogram)  .setSource([['Duration'], [12], [18], [19], [25], [31], [35]])  .setHistogramField(0)  .setBinCount(12)  .setUnderflowThreshold(0)  .setOverflowThreshold(100)  .setBinGap(0.1)  .build()await fDocument.insertChart(chartInfo)

Slide

TypeScript
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const chartInfo = fSlide  .newChart(univerAPI.Enum.ChartTypeString.Histogram)  .setSource([['Duration'], [12], [18], [19], [25], [31], [35]])  .setHistogramField(0)  .setBinCount(12)  .setUnderflowThreshold(0)  .setOverflowThreshold(100)  .setBinGap(0.1)  .build()await fSlide.insertChart(chartInfo)

Board

TypeScript
const fBoard = univerAPI.getActiveBoard()const chartInfo = fBoard  .newChart(univerAPI.Enum.ChartTypeString.Histogram)  .setSource([['Duration'], [12], [18], [19], [25], [31], [35]])  .setHistogramField(0)  .setBinCount(12)  .setUnderflowThreshold(0)  .setOverflowThreshold(100)  .setBinGap(0.1)  .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

FHistogramChartBuilder.clearHistogramField

Clears the active Histogram value field.

TypeScript
clearHistogramField(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.clearHistogramField()

Package: @univerjs-pro/engine-chart · Type definitions

FHistogramChartBuilder.clearOverflowThreshold

Disables Overflow.

TypeScript
clearOverflowThreshold(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.clearOverflowThreshold()

Package: @univerjs-pro/engine-chart · Type definitions

FHistogramChartBuilder.clearUnderflowThreshold

Disables Underflow.

TypeScript
clearUnderflowThreshold(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.clearUnderflowThreshold()

Package: @univerjs-pro/engine-chart · Type definitions

FHistogramChartBuilder.resetBinGap

Removes the explicit gap and restores the 0.007 runtime default.

TypeScript
resetBinGap(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.resetBinGap()

Package: @univerjs-pro/engine-chart · Type definitions

FHistogramChartBuilder.resetBinning

Removes explicit binning and restores runtime-only Scott Auto.

TypeScript
resetBinning(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.resetBinning()

Package: @univerjs-pro/engine-chart · Type definitions

FHistogramChartBuilder.setBinCount

Stores an explicit total visible-bin count. Integers from 1 through 1000 are effective when enabled edge bins still leave room for a regular bin. Other finite values remain persisted and visible through describe() but render with Scott Auto. Non-finite calls produce no Pending change.

TypeScript
setBinCount(count: number): this

Parameters

  • count — Required. Total visible-bin count.

Returns

This builder for chaining.

Examples

TypeScript
builder.setBinCount(20)

Package: @univerjs-pro/engine-chart · Type definitions

FHistogramChartBuilder.setBinGap

Stores the visual gap ratio. Values from 0 through 0.9 are effective; other finite values remain persisted but render with the 0.007-gap default. Non-finite calls are no-op.

TypeScript
setBinGap(value: number): this

Parameters

  • value — Required. Gap ratio between adjacent bins.

Returns

This builder for chaining.

Examples

TypeScript
builder.setBinGap(0.15)

Package: @univerjs-pro/engine-chart · Type definitions

FHistogramChartBuilder.setBinWidth

Stores an explicit width. A positive finite width is effective only when the current range produces at most 1000 visible bins; otherwise rendering uses Scott Auto without rewriting the stored value. Non-finite calls produce no Pending change.

TypeScript
setBinWidth(width: number): this

Parameters

  • width — Required. Bin width in source-value units.

Returns

This builder for chaining.

Examples

TypeScript
builder.setBinWidth(2.5)

Package: @univerjs-pro/engine-chart · Type definitions

FHistogramChartBuilder.setHistogramField

Selects the only active Histogram value field by zero-based source index.

TypeScript
setHistogramField(index: number): this

Parameters

  • index — Required. Zero-based source field index.

Returns

This builder for chaining.

Examples

TypeScript
builder.setHistogramField(2)

Package: @univerjs-pro/engine-chart · Type definitions

FHistogramChartBuilder.setOverflowThreshold

Enables the exclusive x > threshold Overflow bin. An ineffective finite threshold pair remains persisted but both thresholds are ignored for rendering. Non-finite calls are no-op.

TypeScript
setOverflowThreshold(value: number): this

Parameters

  • value — Required. Exclusive Overflow threshold.

Returns

This builder for chaining.

Examples

TypeScript
builder.setOverflowThreshold(100)

Package: @univerjs-pro/engine-chart · Type definitions

FHistogramChartBuilder.setUnderflowThreshold

Enables the inclusive x <= threshold Underflow bin. If both thresholds are present, they are effective only when Underflow is less than Overflow. Non-finite calls are no-op.

TypeScript
setUnderflowThreshold(value: number): this

Parameters

  • value — Required. Inclusive Underflow threshold.

Returns

This builder for chaining.

Examples

TypeScript
builder.setUnderflowThreshold(0)

Package: @univerjs-pro/engine-chart · Type definitions

How is this guide?

© 2026 DreamNum Co., Ltd.