FChordChartBuilder
Fluent semantic builder for an undirected Source/Target/optional-Value edge list.
Final display labels own node identity. Duplicate and reverse rows aggregate, omitted Value means unit-weight counts, and blank endpoints, self-links, and non-positive/non-finite mapped weights are skipped without coercion. Aggregate values are formatted after summing. Defaults are renderer-owned and require the native ECharts 6.1 Chord series; no renderer nodes, links, or layout are persisted.
Inheritance
Extends FChartBuilderBase. 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.Chord) .setSource('A1:C8') .setChordMapping({ sourceIndex: 0, targetIndex: 1, valueIndex: 2 }) .setChordLayout({ startAngle: 90, clockwise: true, innerRadiusRatio: 0.4, outerRadiusRatio: 0.8 }) .setChordNode({ color: '#2563eb', opacity: 0.8 }) .setChordLabel({ visible: true, position: univerAPI.Enum.ChartChordLabelPosition.Outside, color: '#334155', }) .setChordRibbon({ color: univerAPI.Enum.ChartChordRibbonColorMode.Gradient, opacity: 0.6 }) .setChordEmphasis({ focus: univerAPI.Enum.ChartChordFocusMode.Adjacency }) .build()await fWorksheet.insertChart(chartInfo)Doc
const fDocument = univerAPI.getActiveDocument()const chartInfo = fDocument .newChart(univerAPI.Enum.ChartTypeString.Chord) .setSource([ ['Source', 'Target', 'Value'], ['A', 'B', 5], ['A', 'C', 3], ['B', 'C', 2], ]) .setChordMapping({ sourceIndex: 0, targetIndex: 1, valueIndex: 2 }) .setChordLayout({ startAngle: 90, clockwise: true, innerRadiusRatio: 0.4, outerRadiusRatio: 0.8 }) .setChordNode({ color: '#2563eb', opacity: 0.8 }) .setChordLabel({ visible: true, position: univerAPI.Enum.ChartChordLabelPosition.Outside, color: '#334155', }) .setChordRibbon({ color: univerAPI.Enum.ChartChordRibbonColorMode.Gradient, opacity: 0.6 }) .setChordEmphasis({ focus: univerAPI.Enum.ChartChordFocusMode.Adjacency }) .build()await fDocument.insertChart(chartInfo)Slide
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const chartInfo = fSlide .newChart(univerAPI.Enum.ChartTypeString.Chord) .setSource([ ['Source', 'Target', 'Value'], ['A', 'B', 5], ['A', 'C', 3], ['B', 'C', 2], ]) .setChordMapping({ sourceIndex: 0, targetIndex: 1, valueIndex: 2 }) .setChordLayout({ startAngle: 90, clockwise: true, innerRadiusRatio: 0.4, outerRadiusRatio: 0.8 }) .setChordNode({ color: '#2563eb', opacity: 0.8 }) .setChordLabel({ visible: true, position: univerAPI.Enum.ChartChordLabelPosition.Outside, color: '#334155', }) .setChordRibbon({ color: univerAPI.Enum.ChartChordRibbonColorMode.Gradient, opacity: 0.6 }) .setChordEmphasis({ focus: univerAPI.Enum.ChartChordFocusMode.Adjacency }) .build()await fSlide.insertChart(chartInfo)Board
const fBoard = univerAPI.getActiveBoard()const chartInfo = fBoard .newChart(univerAPI.Enum.ChartTypeString.Chord) .setSource([ ['Source', 'Target', 'Value'], ['A', 'B', 5], ['A', 'C', 3], ['B', 'C', 2], ]) .setChordMapping({ sourceIndex: 0, targetIndex: 1, valueIndex: 2 }) .setChordLayout({ startAngle: 90, clockwise: true, innerRadiusRatio: 0.4, outerRadiusRatio: 0.8 }) .setChordNode({ color: '#2563eb', opacity: 0.8 }) .setChordLabel({ visible: true, position: univerAPI.Enum.ChartChordLabelPosition.Outside, color: '#334155', }) .setChordRibbon({ color: univerAPI.Enum.ChartChordRibbonColorMode.Gradient, opacity: 0.6 }) .setChordEmphasis({ focus: univerAPI.Enum.ChartChordFocusMode.Adjacency }) .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
FChordChartBuilder.resetChordEmphasis
Resets Chord emphasis behavior to renderer defaults.
resetChordEmphasis(): thisReturns
This builder for chaining.
Examples
builder.resetChordEmphasis()Package: @univerjs-pro/engine-chart · Type definitions
FChordChartBuilder.resetChordLabel
Resets Chord labels to renderer defaults.
resetChordLabel(): thisReturns
This builder for chaining.
Examples
builder.resetChordLabel()Package: @univerjs-pro/engine-chart · Type definitions
FChordChartBuilder.resetChordLayout
Resets the Chord layout to renderer defaults.
resetChordLayout(): thisReturns
This builder for chaining.
Examples
builder.resetChordLayout()Package: @univerjs-pro/engine-chart · Type definitions
FChordChartBuilder.resetChordNode
Resets Chord node styling to renderer defaults.
resetChordNode(): thisReturns
This builder for chaining.
Examples
builder.resetChordNode()Package: @univerjs-pro/engine-chart · Type definitions
FChordChartBuilder.resetChordRibbon
Resets Chord ribbon styling to renderer defaults.
resetChordRibbon(): thisReturns
This builder for chaining.
Examples
builder.resetChordRibbon()Package: @univerjs-pro/engine-chart · Type definitions
FChordChartBuilder.setChordEmphasis
Sets hover emphasis and focus behavior.
setChordEmphasis(value: IChartChordEmphasisSpec): thisParameters
value— Required. Chord emphasis settings.
Returns
This builder for chaining.
Examples
builder.setChordEmphasis({ focus: univerAPI.Enum.ChartChordFocusMode.Adjacency })Types: IChartChordEmphasisSpec
Package: @univerjs-pro/engine-chart · Type definitions
FChordChartBuilder.setChordLabel
Sets Chord node-label visibility, position, and styling.
setChordLabel(value: IChartChordLabelSpec): thisParameters
value— Required. Chord label settings.
Returns
This builder for chaining.
Examples
builder.setChordLabel({ visible: true, position: univerAPI.Enum.ChartChordLabelPosition.Outside, color: '#334155',})Types: IChartChordLabelSpec
Package: @univerjs-pro/engine-chart · Type definitions
FChordChartBuilder.setChordLayout
Sets the Chord radius, rotation, and spacing layout.
setChordLayout(value: IChartChordLayoutSpec): thisParameters
value— Required. Chord layout settings.
Returns
This builder for chaining.
Examples
builder.setChordLayout({ startAngle: 90, clockwise: true })Types: IChartChordLayoutSpec
Package: @univerjs-pro/engine-chart · Type definitions
FChordChartBuilder.setChordMapping
Sets the Source, Target, and optional Value field indexes for Chord edges.
setChordMapping(value: IChartChordMappingSpec): thisParameters
value— Required. Zero-based field indexes for each edge component.
Returns
This builder for chaining.
Examples
builder.setChordMapping({ sourceIndex: 0, targetIndex: 1, valueIndex: 2 })Types: IChartChordMappingSpec
Package: @univerjs-pro/engine-chart · Type definitions
FChordChartBuilder.setChordNode
Sets Chart-wide Chord node styling.
setChordNode(value: IChartChordNodeStyleSpec): thisParameters
value— Required. Chord node appearance settings.
Returns
This builder for chaining.
Examples
builder.setChordNode({ color: '#2563eb', opacity: 0.8 })Types: IChartChordNodeStyleSpec
Package: @univerjs-pro/engine-chart · Type definitions
FChordChartBuilder.setChordRibbon
Sets Chord ribbon color, opacity, and border styling.
setChordRibbon(value: IChartChordRibbonStyleSpec): thisParameters
value— Required. Chord ribbon appearance settings.
Returns
This builder for chaining.
Examples
builder.setChordRibbon({ color: univerAPI.Enum.ChartChordRibbonColorMode.Gradient, opacity: 0.6,})Types: IChartChordRibbonStyleSpec
Package: @univerjs-pro/engine-chart · Type definitions
你觉得这篇文档如何?