FHeatmapChartBuilder
Fluent, type-specific Builder for Heatmap Charts.
The data source is a matrix-shaped table expressed as one category field plus one or more numeric value fields. Category values become Y-axis rows, value-field headers become X-axis columns, and each aligned numeric observation becomes one cell.
Inheritance
Extends FAxisChartBuilder. 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.Heatmap) .setSource({ range: 'A1:D8', orientation: univerAPI.Enum.ChartSourceOrientation.Columns, }) .setCategoryField(0) .setValueFields([1, 2, 3]) .setVisualMapType(univerAPI.Enum.ChartVisualMapType.Continuous) .setValueRange(0, 100) .setCellLabel({ visible: true, position: univerAPI.Enum.ChartSeriesLabelPosition.Inside }) .setValueUnit('tickets') .build()await fWorksheet.insertChart(chartInfo)Doc
const fDocument = univerAPI.getActiveDocument()const chartInfo = fDocument .newChart(univerAPI.Enum.ChartTypeString.Heatmap) .setSource([ ['Day', 'Morning', 'Evening'], ['Mon', 24, 62], ['Tue', 38, 81], ]) .setCategoryField(0) .setValueFields([1, 2]) .setVisualMapType(univerAPI.Enum.ChartVisualMapType.Continuous) .setValueRange(0, 100) .setCellLabel({ visible: true, position: univerAPI.Enum.ChartSeriesLabelPosition.Inside }) .setValueUnit('tickets') .build()await fDocument.insertChart(chartInfo)Slide
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const chartInfo = fSlide .newChart(univerAPI.Enum.ChartTypeString.Heatmap) .setSource([ ['Day', 'Morning', 'Evening'], ['Mon', 24, 62], ['Tue', 38, 81], ]) .setCategoryField(0) .setValueFields([1, 2]) .setVisualMapType(univerAPI.Enum.ChartVisualMapType.Continuous) .setValueRange(0, 100) .setCellLabel({ visible: true, position: univerAPI.Enum.ChartSeriesLabelPosition.Inside }) .setValueUnit('tickets') .build()await fSlide.insertChart(chartInfo)Board
const fBoard = univerAPI.getActiveBoard()const chartInfo = fBoard .newChart(univerAPI.Enum.ChartTypeString.Heatmap) .setSource([ ['Day', 'Morning', 'Evening'], ['Mon', 24, 62], ['Tue', 38, 81], ]) .setCategoryField(0) .setValueFields([1, 2]) .setVisualMapType(univerAPI.Enum.ChartVisualMapType.Continuous) .setValueRange(0, 100) .setCellLabel({ visible: true, position: univerAPI.Enum.ChartSeriesLabelPosition.Inside }) .setValueUnit('tickets') .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
FHeatmapChartBuilder.clearCellLabel
Clears the explicit Heatmap cell-label style. Heatmap cells render without labels until
labels are enabled again with setCellLabel({ visible: true }).
clearCellLabel(): thisReturns
This builder for chaining.
Examples
builder.clearCellLabel()Package: @univerjs-pro/engine-chart · Type definitions
FHeatmapChartBuilder.clearValueRange
Clears the value range configuration and returns this builder for chaining.
This method executes synchronously.
clearValueRange(): thisReturns
This builder for chaining.
Examples
builder.clearValueRange()Package: @univerjs-pro/engine-chart · Type definitions
FHeatmapChartBuilder.clearValueUnit
Clears the explicit Heatmap value unit.
clearValueUnit(): thisReturns
This builder for chaining.
Examples
builder.clearValueUnit()Package: @univerjs-pro/engine-chart · Type definitions
FHeatmapChartBuilder.resetVisualMapType
Restores the visual map type to Continuous and returns this builder for chaining.
This method executes synchronously.
resetVisualMapType(): thisReturns
This builder for chaining.
Examples
builder.resetVisualMapType()Package: @univerjs-pro/engine-chart · Type definitions
FHeatmapChartBuilder.setCellLabel
Sets the value label rendered inside each Heatmap cell.
With { visible: true }, omitted style fields default to the cell value, an inside position,
12 px text, the chart font (or Arial), and the active theme's mark-text color.
setCellLabel(value: IChartHeatmapLabelSpec): thisParameters
value— Required. Cell-label visibility and typography.
Returns
This builder for chaining.
Examples
builder .setPalette(['#eff6ff', '#1d4ed8']) .setValueRange(0, 80) .setValueUnit('tickets') .setCellLabel({ visible: true, position: univerAPI.Enum.ChartSeriesLabelPosition.Inside })Types: IChartHeatmapLabelSpec
Package: @univerjs-pro/engine-chart · Type definitions
FHeatmapChartBuilder.setValueRange
Sets the value range configuration and returns this builder for chaining.
This method executes synchronously.
setValueRange(min: number, max: number): thisParameters
min— Required. The minimum value.max— Required. The maximum value.
Returns
This builder for chaining.
Examples
builder.setValueRange(0, 100)Package: @univerjs-pro/engine-chart · Type definitions
FHeatmapChartBuilder.setValueUnit
Sets the unit appended to the Heatmap visual-map boundary labels.
setValueUnit(value: string): thisParameters
value— Required. Unit text such astickets.
Returns
This builder for chaining.
Examples
builder.setValueUnit('tickets')Package: @univerjs-pro/engine-chart · Type definitions
FHeatmapChartBuilder.setVisualMapType
Sets the visual map type configuration and returns this builder for chaining.
This method executes synchronously.
setVisualMapType(value: ChartVisualMapType): thisParameters
value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
builder.setVisualMapType(univerAPI.Enum.ChartVisualMapType.Continuous)Types: ChartVisualMapType
Package: @univerjs-pro/engine-chart · Type definitions
How is this guide?