# Displaying both the Chart Legend and Chart Header

## Content



Both the **Header** and **Legend** have **Compass** and **Location** properties, and you can use one or both of these properties to change the position. The **Compass** property can be set to North, South, East, or West through the **ComapssEnum**. By default, the **Header** and **Legend** will be centered within the Compass area. The **Location** property can be set to a **System.Drawing.Point**, which accepts x and y coordinates. Both the x and y coordinates can be set to -1 to use automatic positioning.

### Displaying the Header

The following example positions your chart header at the top. The point coordinates can be adjusted to fine tune the position:

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in Visual Basic

DOC-SUMMARY-TAG-CLOSE

```vbnet
c1Chart1.Header.Text = "My Chart Header"
c1Chart1.Header.Compass = C1.Win.C1Chart.CompassEnum.North
c1Chart1.Header.Location = New Point(-1, -1)
c1Chart1.Header.Visible = True
```

DOC-DETAILS-TAG-CLOSE

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in C#

DOC-SUMMARY-TAG-CLOSE

```csharp
this.c1Chart1.Header.Text = "My Chart Header";
this.c1Chart1.Header.Compass = C1.Win.C1Chart.CompassEnum.East;
this.c1Chart1.Header.Location = new Point(-1, -1);
this.c1Chart1.Header.Visible = true;
```

DOC-DETAILS-TAG-CLOSE

### Displaying the Legend

The following example will position your chart legend to the left and you cana djust the point coordinates to fine tune the position.


> type=note
> **Note**: Remember the -1 just uses the default coordinate for the Compass setting, and one or both coordinates can have absolute positions. Just make sure that the point makes sense for the position. For example you probably do not want to set a very high y value for something that has Compass set to North, because the Chart will shrink to accommodate the header.

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in Visual Basic

DOC-SUMMARY-TAG-CLOSE

```vbnet
c1Chart1.Legend.Text = "My Chart Legend"
c1Chart1.Legend.Compass = C1.Win.C1Chart.CompassEnum.West
c1Chart1.Legend.Location = new Point(-1, -1)
c1Chart1.Legend.Visible = True
```

DOC-DETAILS-TAG-CLOSE

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in C#

DOC-SUMMARY-TAG-CLOSE

```csharp
this.c1Chart1.Legend.Text = "My Chart Legend";
this.c1Chart1.Legend.Compass = C1.Win.C1Chart.CompassEnum.West;
this.c1Chart1.Legend.Location = new Point(-1, -1);
this.c1Chart1.Legend.Visible = true;
```

DOC-DETAILS-TAG-CLOSE

## See Also

[Displaying the Legends Vertically](/componentone/docs/win/online-chart2d/chartforwinformstask/displayingthelegends)