FLineChartBuilder
Fluent, type-specific Builder for Line Charts.
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.Line) .setSource('A1:D8') .setLineStyle({ width: 2 }) .build()await fWorksheet.insertChart(chartInfo)Doc
const fDocument = univerAPI.getActiveDocument()const chartInfo = fDocument .newChart(univerAPI.Enum.ChartTypeString.Line) .setSource([ ['Month', 'Sales'], ['Jan', 120], ['Feb', 180], ]) .setLineStyle({ width: 2 }) .build()await fDocument.insertChart(chartInfo)Slide
const fPresentation = univerAPI.getActivePresentation()const fSlide = fPresentation.getSlideByIndex(0)const chartInfo = fSlide .newChart(univerAPI.Enum.ChartTypeString.Line) .setSource([ ['Month', 'Sales'], ['Jan', 120], ['Feb', 180], ]) .setLineStyle({ width: 2 }) .build()await fSlide.insertChart(chartInfo)Board
const fBoard = univerAPI.getActiveBoard()const chartInfo = fBoard .newChart(univerAPI.Enum.ChartTypeString.Line) .setSource([ ['Month', 'Sales'], ['Jan', 120], ['Feb', 180], ]) .setLineStyle({ width: 2 }) .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
FLineChartBuilder.clearLineStyle
Clears the line style override so the line uses a 2 px solid stroke in its active theme color.
This method executes synchronously.
clearLineStyle(): thisReturns
This builder for chaining.
Examples
builder.clearLineStyle()Package: @univerjs-pro/engine-chart · Type definitions
FLineChartBuilder.setLineStyle
Sets the line style configuration and returns this builder for chaining.
Omitted fields keep their current values. Without explicit overrides, lines use a 2 px solid stroke at full opacity in their active theme color.
This method executes synchronously.
setLineStyle(value: IChartSeriesBorderSpec): thisParameters
value— Required. The semantic value to record.
Returns
This builder for chaining.
Examples
builder.setLineStyle({ width: 2, color: '#1677ff' })Types: IChartSeriesBorderSpec
Package: @univerjs-pro/engine-chart · Type definitions
你觉得这篇文档如何?