---
id: "P:cAlgo.API.ChartObject.ZIndex"
kind: "property"
type: "T:cAlgo.API.ChartObject"
url: "https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/ZIndex/"
---

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

# ChartObject.ZIndex

Member of [ChartObject](https://help.ctrader.com/ctrader-algo/references/Chart/Drawings/ChartObject/index.md).

## ZIndex

Gets or sets the location of a chart object on the Z-axis in respect to the other chart objects.

Environments: Desktop supported · CLI works differently · Cloud works differently.

- CLI: Created and kept with all its properties, but never drawn: the CLI displays no chart.
- Cloud: Created and kept with all its properties, but never drawn: the cloud displays no chart.

C#:

```csharp
int ZIndex {get; set;}
```

Python:

```python
chartObject.ZIndex: int
```

### Returns

`int` — 

### Examples

C#:

```csharp
var rectangle = Chart.DrawRectangle("zone", Bars.OpenTimes.Last(20), Bars.LowPrices.Last(20), Bars.OpenTimes.LastValue, Bars.HighPrices.LastValue, Color.FromArgb(80, Color.Blue));
var line = Chart.DrawHorizontalLine("support", Bars.LowPrices.LastValue, Color.Green);
line.ZIndex = rectangle.ZIndex + 1;
Print("Line Z-index: {0} | Rectangle Z-index: {1}", line.ZIndex, rectangle.ZIndex);
```

Python:

```python
rectangle = api.Chart.DrawRectangle("zone", api.Bars.OpenTimes.Last(20), api.Bars.LowPrices.Last(20), api.Bars.OpenTimes.LastValue, api.Bars.HighPrices.LastValue, Color.FromArgb(80, Color.Blue))
line = api.Chart.DrawHorizontalLine("support", api.Bars.LowPrices.LastValue, Color.Green)
line.ZIndex = rectangle.ZIndex + 1
api.Print(f"Line Z-index: {line.ZIndex} | Rectangle Z-index: {rectangle.ZIndex}")
```

