Articles in this section
Category / Section

How to change the legend position.

1 min read

SFChart allows you to position the legend, relative to the chart area or using coordinates, using the dockPosition property of legend.

By default, legend items are arranged horizontally or vertically based on its dock position, but you can also set specific orientation using Orientation property.

Following code example illustrates how to position legend to the left side of chart.

Objective-C

chart.legend.visible = true;
chart.legend.dockPosition  = SFChartLegendPositionLeft;

 

Swift

chart.legend.visible = true;
chart.legend.dockPosition = SFChartLegendPosition.Left;

 

Xamarin.iOS (C#)

chart.Legend.Visible = true;chart.Legend.DockPosition = SFChartLegendPosition.Left;

 

C:\Users\yuvaraj.palanisamy\Pictures\android3.png

 

Following code example illustrates how to position legend using coordinates,

Objective-C

chart.legend.dockPosition   = SFChartLegendPositionFloat;
chart.legend.offsetX = 70;
chart.legend.offsetY = 90;

 

Swift

chart.legend.dockPosition = SFChartLegendPosition.Float;
chart.legend.offsetX = 70;
chart.legend.offsetY = 90;

Xamarin.iOS

chart.Legend.DockPosition = SFChartLegendPosition.Float;chart.Legend.OffsetX = 70;
chart.Legend.OffsetY = 90;

 

C:\Users\yuvaraj.palanisamy\Pictures\android4.png

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied