Change the position of the Chart Legend
Chart Legend can be docked by using the Dock property of DockPanel class. The Legend can be docked to the top, left, bottom or right of either the Chart or Chart Area; also it can be placed anywhere inside or outside the Chart Area (floating).
Property | Description |
---|---|
ChartDockPanel.Dock | Docks the Chart Legend in the Chart or Chart Area. The values provided are as follows:Top: Docks the Chart Legend to the top.Bottom: Docks the Chart Legend to the bottom.Right: Docks the Chart Legend to the right.Left: Docks the Chart Legend to the left.Floating: Chart Legend can be dragged anywhere inside or outside the Chart Area. |
The following code example illustrates how to dock the Chart Legend in the Chart Area.
<chart:Chart.Legends>
<chart:ChartLegend chart:Chart.Dock="Left">
</chart:ChartLegend>
</chart:Chart.Legends>
<syncfusion:ChartArea.Legend>
<syncfusion:ChartLegend Name="Legend1" syncfusion:ChartDockPanel.Dock="Left"/>
</syncfusion:ChartArea.Legend>
ChartDockPanel.SetDock(Legend1, ChartDock.Left);