Title in Xamarin.iOS Chart(SfChart)

You can define and customize the Chart title using Title property of SFChart. The Text property of SFChartTitle is used to set the text for the title.

Following properties are used to customize its appearance.

  • TextColor – used to change the color of the text.
  • BackgroundColor – used to change the background color.
  • BorderColor – used to change the border color.
  • Opacity - used to control the transparency of the title.
  • BorderWidth – used to change the border width.
  • Font – used to change the text size, font family and font weight.
  • EdgeInsets - used to change the margin for title.
  • c#
  • chart.Title.Text        = "Efficiency of Oil Fired Power Production";
    
    chart.Title.TextColor   = UIColor.Blue;

    Title for Xamarin.iOS Chart

    Text Alignment

    You can align the title text content to the Start, Center or End of the title using the TextAlignment property of the SFChartTitle.

  • c#
  • chart.Title.Text            = "Efficiency of Oil Fired Power Production";
    
    chart.Title.TextAlignment   = UITextAlignment.Left; 
    
    chart.Title.TextColor       = UIColor.Blue;

    Text alignment support for title in Xamarin.iOS Chart

    Text Wrap

    By using the LineBreakMode property, You can wrap the chart title text content. The default value of this property is NoWrap.

  • c#
  • chart.Title.Text = "Percentage change in efficiency of oil-fired power production in Russia for six months;
    
    chart.Title.TextColor = UIColor.Blue; 
    
    chart.Title.LineBreakMode = UILineBreakMode.TailTruncation;

    Text alignment support for title in Xamarin.iOS Chart