# FLineChartBuilder

- Human documentation: [https://docs.univer.ai/reference/facade/line-chart-builder](https://docs.univer.ai/reference/facade/line-chart-builder)

- Agent Markdown: [https://docs.univer.ai/reference/facade/line-chart-builder.md](https://docs.univer.ai/reference/facade/line-chart-builder.md)

- Requested language: `en-US`

- Content language: `en-US`

- Documentation version: `1.0.0-rc.0`

- Source: [facade/line-chart-builder.mdx](https://github.com/dream-num/documentation/blob/dev/content/reference/facade/line-chart-builder.mdx)

---

Fluent, type-specific Builder for Line Charts.

## Inheritance

Extends [`FCartesianChartBuilder`](https://docs.univer.ai/reference/facade/cartesian-chart-builder.md). Its inherited members are available on this object.

## Example

Sheet

```ts
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

```ts
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

```ts
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

```ts
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`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/engine-chart.md) 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](https://docs.univer.ai/guides/sheets/getting-started/facade.md).

## `@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.

```typescript
clearLineStyle(): this
```

**Returns**

This builder for chaining.

**Examples**

```ts
builder.clearLineStyle()
```

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/engine-chart.md) · [Type definitions](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/facade/builders/f-line-chart-builder.d.ts)

### `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.

```typescript
setLineStyle(value: IChartSeriesBorderSpec): this
```

**Parameters**

* `value` — Required. The semantic value to record.

**Returns**

This builder for chaining.

**Examples**

```ts
builder.setLineStyle({ width: 2, color: '#1677ff' })
```

**Types:** [`IChartSeriesBorderSpec`](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/chart-builder/chart-types.d.ts)

**Package:** [`@univerjs-pro/engine-chart`](https://docs.univer.ai/reference/packages/plugins/univerjs-pro/engine-chart.md) · [Type definitions](https://unpkg.com/@univerjs-pro/engine-chart@1.0.0-rc.0/lib/types/facade/builders/f-line-chart-builder.d.ts)
