---
id: "M:cAlgo.API.Line.#ctor"
kind: "constructor"
type: "T:cAlgo.API.Line"
url: "https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Shapes/Line/Constructor/"
---

> Documentation index for agents: https://help.ctrader.com/ctrader-algo/llms.txt · machine index: https://help.ctrader.com/ctrader-algo/api.json

# Line constructor

Member of [Line](https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Shapes/Line/index.md).

## Line()

Initializes a new instance of the [`Line`](https://help.ctrader.com/ctrader-algo/references/Controls/Layout/Shapes/Line/index.md) class.

Environments: Desktop supported · CLI not supported · Cloud not supported.

- CLI: Accepted without error but never displayed, so control events such as Click are never raised.
- Cloud: Accepted without error but never displayed, so control events such as Click are never raised.

C#:

```csharp
public Line()
```

Python:

```python
Line()
```

### Examples

C#:

```csharp
var line = new Line { X1 = 10, Y1 = 10, X2 = 200, Y2 = 10, StrokeColor = Color.Yellow, StrokeThickness = 2 };
var canvas = new Canvas();
canvas.AddChild(line);
Chart.AddControl(canvas);
```

Python:

```python
line = Line()
line.X1 = 10
line.Y1 = 10
line.X2 = 200
line.Y2 = 10
line.StrokeColor = Color.Yellow
line.StrokeThickness = 2
canvas = Canvas()
canvas.AddChild(line)
api.Chart.AddControl(canvas)
```

