Title in Xamarin.Android Chart (SfChart)

7 Oct 20201 minute to read

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

Following properties are used to customize its appearance.

  • c#
  • [C#]
    
    SfChart sfChart = new SfChart(this);
    
    sfChart.Title.Text = "Efficiency of oil-fired power production";
    
    sfChart.Title.SetTextColor( Color.Blue);

    Title for Xamarin.Android 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 ChartTitle.

  • c#
  • [C#]
    
    SfChart sfChart = new SfChart(this);
    
    sfChart.Title.Text = "Efficiency of oil-fired power production";
    
    sfChart.Title.TextAlignment = TextAlignment.TextStart;
    
    sfChart.Title.SetTextColor( Color.Blue);

    Text alignment support for title in Xamarin.Android 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#
  • [C#]
    
    SfChart sfChart = new SfChart(this);
    
    sfChart.Title.Text = "Percentage change in efficiency of oil-fired power production in Russia for six months;
    
    sfChart.Title.SetTextColor( Color.Blue);
    
    sfChart.Title.LineBreakMode = LineBreakMode.TailTruncation;

    Text wrap support for title in Xamarin.Android Chart