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.
Unfortunately, activation email could not send to your email. Please try again.

Font Family

Thread ID:

Created:

Updated:

Platform:

Replies:

130698 May 26,2017 11:13 AM May 30,2017 11:51 AM Xamarin.Forms 1
loading
Tags: SfChart
Costanza Federica Minarelli
Asked On May 26, 2017 11:13 AM

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?

Saravana Pandian Murugan [Syncfusion]
Replied On May 30, 2017 11:51 AM

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. 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;