How to change the legend position.
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;
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;