API Reference

FRelationChartBuilder

Configures a relation chart.

Inheritance

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

Example

Sheet A worksheet range A1:C4 can contain this weighted edge list:

SourceTargetWeight
AB5
AC3
CB2
TypeScript
const fWorkbook = univerAPI.getActiveWorkbook()const fWorksheet = fWorkbook.getSheetByName('Sheet1')const chartInfo = fWorksheet  .newChart(univerAPI.Enum.ChartTypeString.Relation)  .setSource({    range: 'A1:C4',    orientation: univerAPI.Enum.ChartSourceOrientation.Columns,  })  .setLayout(univerAPI.Enum.ChartRelationChartLayoutEnum.Force)  .setUseValueAsSymbolSize(true)  .setEmphasisEnabled(true)  .setForce({ gravity: 0.2, repulsion: 50 })  .setNodeShape(univerAPI.Enum.ChartLinePointShape.Circle)  .build()await fWorksheet.insertChart(chartInfo)

Doc

TypeScript
const fDocument = univerAPI.getActiveDocument()const chartInfo = fDocument  .newChart(univerAPI.Enum.ChartTypeString.Relation)  .setSource([    ['Source', 'Target', 'Weight'],    ['A', 'B', 5],    ['A', 'C', 3],    ['C', 'B', 2],  ])  .setLayout(univerAPI.Enum.ChartRelationChartLayoutEnum.Force)  .setUseValueAsSymbolSize(true)  .setEmphasisEnabled(true)  .setForce({ gravity: 0.2, repulsion: 50 })  .setNodeShape(univerAPI.Enum.ChartLinePointShape.Circle)  .build()await fDocument.insertChart(chartInfo)

Slide

TypeScript
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const chartInfo = fSlide  .newChart(univerAPI.Enum.ChartTypeString.Relation)  .setSource([    ['Source', 'Target', 'Weight'],    ['A', 'B', 5],    ['A', 'C', 3],    ['C', 'B', 2],  ])  .setLayout(univerAPI.Enum.ChartRelationChartLayoutEnum.Force)  .setUseValueAsSymbolSize(true)  .setEmphasisEnabled(true)  .setForce({ gravity: 0.2, repulsion: 50 })  .setNodeShape(univerAPI.Enum.ChartLinePointShape.Circle)  .build()await fSlide.insertChart(chartInfo)

Board

TypeScript
const fBoard = univerAPI.getActiveBoard()const chartInfo = fBoard  .newChart(univerAPI.Enum.ChartTypeString.Relation)  .setSource([    ['Source', 'Target', 'Weight'],    ['A', 'B', 5],    ['A', 'C', 3],    ['C', 'B', 2],  ])  .setLayout(univerAPI.Enum.ChartRelationChartLayoutEnum.Force)  .setUseValueAsSymbolSize(true)  .setEmphasisEnabled(true)  .setForce({ gravity: 0.2, repulsion: 50 })  .setNodeShape(univerAPI.Enum.ChartLinePointShape.Circle)  .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

FRelationChartBuilder.clearForce

Clears the force configuration and returns this builder for chaining.

Force layout then uses gravity 0.1, repulsion 5000, and an edge length equal to one fifth of the chart's shorter side.

This method executes synchronously.

TypeScript
clearForce(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.clearForce()

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

FRelationChartBuilder.resetCircularLabelRotation

Restores the default of keeping circular-layout labels unrotated and returns this builder for chaining.

This method executes synchronously.

TypeScript
resetCircularLabelRotation(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.resetCircularLabelRotation()

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

FRelationChartBuilder.resetEmphasisEnabled

Restores the default of emphasizing adjacent nodes and links on hover and returns this builder for chaining.

This method executes synchronously.

TypeScript
resetEmphasisEnabled(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.resetEmphasisEnabled()

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

FRelationChartBuilder.resetLayout

Restores the layout to None, which uses Univer's fixed relation layout, and returns this builder for chaining.

This method executes synchronously.

TypeScript
resetLayout(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.resetLayout()

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

FRelationChartBuilder.resetNodeShape

Removes the node-shape override so relation nodes use the renderer's circular symbol.

This method executes synchronously.

TypeScript
resetNodeShape(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.resetNodeShape()

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

FRelationChartBuilder.resetUseValueAsSymbolSize

Restores the default of scaling node symbols from their values and returns this builder for chaining.

This method executes synchronously.

TypeScript
resetUseValueAsSymbolSize(): this

Returns

This builder for chaining.

Examples

TypeScript
builder.resetUseValueAsSymbolSize()

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

FRelationChartBuilder.setCircularLabelRotation

Sets the circular label rotation configuration and returns this builder for chaining.

This method executes synchronously.

TypeScript
setCircularLabelRotation(value: boolean): this

Parameters

  • value — Required. The semantic value to record.

Returns

This builder for chaining.

Examples

TypeScript
builder.setCircularLabelRotation(true)

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

FRelationChartBuilder.setEmphasisEnabled

Sets the emphasis enabled configuration and returns this builder for chaining.

This method executes synchronously.

TypeScript
setEmphasisEnabled(value: boolean): this

Parameters

  • value — Required. The semantic value to record.

Returns

This builder for chaining.

Examples

TypeScript
builder.setEmphasisEnabled(true)

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

FRelationChartBuilder.setForce

Sets the force configuration and returns this builder for chaining.

Omitted fields keep their current values. Without explicit overrides, force layout uses gravity 0.1, repulsion 5000, and an edge length equal to one fifth of the chart's shorter side.

This method executes synchronously.

TypeScript
setForce(value: IChartRelationForceSpec): this

Parameters

  • value — Required. The semantic value to record.

Returns

This builder for chaining.

Examples

TypeScript
builder.setForce({ gravity: 0.2, repulsion: 50 })

Types: IChartRelationForceSpec

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

FRelationChartBuilder.setLayout

Sets the layout configuration and returns this builder for chaining.

This method executes synchronously.

TypeScript
setLayout(value: RelationChartLayoutEnum): this

Parameters

  • value — Required. The semantic value to record.

Returns

This builder for chaining.

Examples

TypeScript
builder.setLayout(univerAPI.Enum.ChartRelationChartLayoutEnum.Force)

Types: RelationChartLayoutEnum

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

FRelationChartBuilder.setNodeShape

Sets the node shape configuration and returns this builder for chaining.

This method executes synchronously.

TypeScript
setNodeShape(value: LinePointShape): this

Parameters

  • value — Required. The semantic value to record.

Returns

This builder for chaining.

Examples

TypeScript
builder.setNodeShape(univerAPI.Enum.ChartLinePointShape.Circle)

Types: LinePointShape

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

FRelationChartBuilder.setUseValueAsSymbolSize

Sets the use value as symbol size configuration and returns this builder for chaining.

This method executes synchronously.

TypeScript
setUseValueAsSymbolSize(value: boolean): this

Parameters

  • value — Required. The semantic value to record.

Returns

This builder for chaining.

Examples

TypeScript
builder.setUseValueAsSymbolSize(true)

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

How is this guide?

© 2026 DreamNum Co., Ltd.