Category / Section
How to wrap the title of Xamarin.Forms Charts
1 min read
Title of Xamarin.Forms Chart projects an easier understanding of its usage. In case of having the multi-line title, you can wrap it by using the in-built API as shown in the following image.
It has been achieved by setting the LineBreakMode as WordWrap in ChartTitle. LineBreakMode is an enum. It contains values like, CharacterWrap, HeadTruncation, MiddleTruncation, NoWrap, TailTruncation, and WordWrap. The default value is NoWrap.
[XAML]
<syncfusion:SfChart HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" > <syncfusion:SfChart.Title> <syncfusion:ChartTitle Text="Example shows the LineBreakMode support in Xamarin.Forms Chart's Title" LineBreakMode="WordWrap"/> </syncfusion:SfChart.Title> <syncfusion:SfChart.PrimaryAxis> <syncfusion:CategoryAxis ShowMajorGridLines="False"/> </syncfusion:SfChart.PrimaryAxis> <syncfusion:SfChart.SecondaryAxis> <syncfusion:NumericalAxis ShowMajorGridLines="False" ShowMinorGridLines="False" /> </syncfusion:SfChart.SecondaryAxis> <syncfusion:SfChart.Series> <syncfusion:ColumnSeries Color="Chocolate" Opacity="0.8" ItemsSource="{Binding Data}" XBindingPath="Category" YBindingPath="Value" /> </syncfusion:SfChart.Series> </syncfusion:SfChart>
See also
How to customize the title of Xamarin.Forms ChartsHow to apply custom fonts in Xamarin.Forms Chart
How to remove the default padding of Xamarin.Forms Chart