# Modifying the Legend

## Content



Whenever data exists in the chart, a **Legend** is automatically generated. The chart assigns the name specified in the ChartDataSeries object for the series as the series identifier. **LineStyle** and **SymbolStyle** determine the symbols that accompany the series name in the **Legend**. The positioning, border, colors and font used for the **Legend** can be customized.

### To programmatically modify the Legend properties:

Sample property settings are listed below:

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in Visual Basic

DOC-SUMMARY-TAG-CLOSE

```vbnet
C1Chart3D1.Legend.Compass = CompassEnum.East
C1Chart3D1.Legend.Style.Border.BorderStyle = BorderStyleEnum.Solid
C1Chart3D1.Legend.Style.Border.Thickness = 3
C1Chart3D1.Legend.Style.Border.Color = Color.Black
C1Chart3D1.Legend.Style.BackColor = Color.Gray
C1Chart3D1.Legend.Text = "Legend Text"
```

DOC-DETAILS-TAG-CLOSE

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in C#

DOC-SUMMARY-TAG-CLOSE

```csharp
c1Chart3D1.Legend.Compass = CompassEnum.East;
c1Chart3D1.Legend.Style.Border.BorderStyle = BorderStyleEnum.Solid;
c1Chart3D1.Legend.Style.Border.Thickness = 3;
c1Chart3D1.Legend.Style.Border.Color = Color.Black;
c1Chart3D1.Legend.Style.BackColor = Color.Gray;
c1Chart3D1.Legend.Text = "Legend Text";
```

DOC-DETAILS-TAG-CLOSE


> type=note
> **Note**: In VB.NET, it is still possible to use the With and End With statement which may make it easier to show repeated use of the same object.

The code above would look as follows using this method:

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in Visual Basic

DOC-SUMMARY-TAG-CLOSE

```vbnet
With C1Chart3D1.Legend
   .Compass = CompassEnum.East
   With .Style
       With.Border
          .BorderStyle = BorderStyleEnum.Solid
          .Thickness = 3
          .Color = Color.Black
       End With
       .BackColor = Color.Gray
   End With
.Text = "Legend Text"
End With
```

DOC-DETAILS-TAG-CLOSE

DOC-DETAILS-TAG-OPEN

DOC-SUMMARY-TAG-OPEN

To write code in C#

DOC-SUMMARY-TAG-CLOSE

```csharp
C1.Win.C1Chart3D.Legend legend = C1Chart3D1.Legend;
C1.Win.C1Chart3D.Style style = legend.Style;
C1.Win.C1Chart3D.Border border = style.Border;
legend.Compass = CompassEnum.East;
border.BorderStyle = BorderStyleEnum.Solid;
border.Thickness = 3;
border.Color = Color.Black;
style.BackColor = Color.Grey;
legend.Text = "Legend Text";
```

DOC-DETAILS-TAG-CLOSE

### To modify the Legend properties through the Properties window:

1.  In the Properties window, expand the **Legend** node.<br />![](https://cdn.mescius.io/document-site-files/images/46396fd1-914e-43da-9cb0-e66dcc0ae61b/imagesext/image10_17.png)
2.  Modify the properties as desired. For more information, see [3D Chart Legend](/componentone/docs/win/online-chart3d/3dchartelements/3dchartlegend).

## See Also

[Chart 3D for WinForms Frequently Asked Questions](/componentone/docs/win/online-chart3d/chart3dforwinformsfr)