Title in Xamarin.Android Chart (SfChart)
25 Nov 20221 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.
-
Text
– used to set the chart title. -
TextColor
– used to change the color of the title. -
TextSize
– used to change the text size. -
Typeface
– used to change the font family and font weight. -
Alpha
- used to set the alpha value of title. It’s range from 0.0 to 1.0 -
SetBackgroundColor(Color)
– used to change the title background color. -
SetPadding(Left, Top, Right, Bottom)
- used to change the padding value for title.
[C#]
SfChart sfChart = new SfChart(this);
sfChart.Title.Text = "Efficiency of oil-fired power production";
sfChart.Title.SetTextColor( Color.Blue);
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#]
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 Wrap
By using the LineBreakMode
property, You can wrap the chart title text content. The default value of this property is NoWrap
.
[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;