Legend

Use Legends to map certain colors or symbols to their respective series. A Chart can have multiple Legends. If the first Series added to the Chart's PlotArea does not already have a Legend then a legend will be automatically created and added to the Chart's LegendList. If the Chart's Auto Layout property is true, the Legends will visually occupy 35% of the Chart width. If Chart's AutoLayout property is set to false then the Legend's X, Y, Width and Height properties should be set manually to control the placement of the Legend. A Legend can either be accessed through the Chart that it belongs to or through the Series that belongs to that Legend. The actual location of the placement of the Legend is controlled using the LegendPlacement enumeration. By default, the LegendPlacement is set to RightCenter.

Creating a Legend

The following example illustrates creating a new legend.

Legend legend = chart.Legends.Add();     
Dim MyLegend As Legend = MyChart.Legends.Add() 

You can also change the properties of a Chart's Legend.

Legend legend = chart.Legends[0];
legend.BackgroundColor = RgbColor.GreenYellow;       
Dim MyLegend As Legend = MyChart.Legends(0)
MyLegend.BackgroundColor = RgbColor.GreenYellow

In this topic