We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Font Family

Hello,
I'm trying to change PrimaryAxis font family as:

MyChart.PrimaryAxis.LabelStyle.Font = Font.OfSize("Arial  ",14);

or using xaml as:

<chart:CategoryAxis.LabelStyle>
     <chart:ChartAxisLabelStyle TextColor="White" LabelsPosition="Inside">
          <chart:ChartAxisLabelStyle.Font>
               <Font FontSize="14" FontFamily="Arial"/>
          </chart:ChartAxisLabelStyle.Font>
     </chart:ChartAxisLabelStyle>
</chart:CategoryAxis.LabelStyle>


but without success.
Can anyone help me?

1 Reply

SP Saravana Pandian Murugan Syncfusion Team May 30, 2017 03:51 PM UTC

Hi Costanza, 
 
Sorry for the delay. 
 
If we set the default FontFamily which are available in mobile phones, it will work by default. If we set custom FontFamily, it wouldn`t work. In your sample, you have set the “Arial” font which is a custom font. So, we need to follow the below platform specific steps to set custom FontFamily. For Example, 
 
In Xamarin.Forms Android platform: 
 
1. Download the custom font (arial.ttf) file. 
 
2. Add that font file to the Assets folder in the application project. 
 
3. Set Build Action = AndroidAsset. 
 
4. Then, use the below code snippet in your application. 
 
Code Snippet: 
 
 
<chart:CategoryAxis.LabelStyle> 
 
   <chart:ChartAxisLabelStyle> 
 
      <chart:ChartAxisLabelStyle.Font> 
 
         <Font FontSize="20" FontFamily="arial.ttf#arial "/> 
 
      </chart:ChartAxisLabelStyle.Font> 
 
   </chart:ChartAxisLabelStyle> 
 
</chart:CategoryAxis.LabelStyle> 
 
 
In Xamarin.Forms iOS and UWP platforms, the above mentioned four steps will change slightly. 
 
Please refer the below link for more details about how to set custom font. 
 
 
We have attached a sample for your reference which can be downloaded from the following location. 
 
 
Note: This sample will work only in UWP platform. We are facing issues in Android and iOS platform. We will update you with more details in one business day (May 31, 2017). 
 
Regards, 
Saravana Pandian M. 


Loader.
Up arrow icon