Category / Section
How to change the legend icons.
1 min read
You can customize the legend icon symbol for each series using legendIcon property of ChartSeries. Following are the symbols you can set for legendIcon,
- Rectangle
- StraightLine
- Circle
- Diamond
- Pentagon
- Triangle
- InvertedTriangle
- Cross
- SeriesType
[Note: When you set legendIcon to seriesType, the shape of the icon will be the prototype of the respective series]
Objective-C
if(index == 0) { SFColumnSeries *series = [[SFColumnSeries alloc]init]; series.legendIcon = SFChartLegendIconTriangle; return series; } else if(index == 0) { SFColumnSeries *series1 = [[SFColumnSeries alloc]init]; series1.legendIcon = SFChartLegendIconSeriesType; return series1; } else{ SFColumnSeries *series2 = [[SFColumnSeries alloc]init]; series2.legendIcon = SFChartLegendIconInvertedTriangle; return series2; }
Swift
if (index==0){ var series : SFColumnSeries = SFColumnSeries(); series.legendIcon = SFChartLegendIcon.Triangle; return series; } else if(index == 1){ var series1 : SFColumnSeries = SFColumnSeries (); series1.legendIcon = SFChartLegendIcon.Triangle; return series1 } else { var series2 : SFColumnSeries = SFColumnSeries (); series2.legendIcon = SFChartLegendIcon.Triangle; return series2; }
Xamarin.iOS (C#)
if (index == 0) { SFColumnSeries series = new SFColumnSeries (); series.LegendIcon = SFChartLegendIcon.Triangle; return series;} else if (index == 1) { SFColumnSeries series1 = new SFColumnSeries (); series1.LegendIcon = SFChartLegendIcon.SeriesType; return series1;} else { SFColumnSeries series2 = new SFColumnSeries (); series2.LegendIcon = SFChartLegendIcon.InvertedTriangle; return series2;}
The following screenshot displays the different legend icons for each series,