Articles in this section
Category / Section

How to add prefix and suffix for axis labels in Chart?

1 min read

SfChart provides support to add prefix and suffix to axis labels. The LabelFormat property is used to add prefix and suffix to axis labels, which are available in LabelStyle of chart axis.

The following code illustrates how to add prefix and suffix to axis labels.

XAML

<chart:SfChart.SecondaryAxis>
      <chart:NumericalAxis>
          <chart:NumericalAxis.LabelStyle>
              <chart:ChartAxisLabelStyle LabelFormat = "$###K" />
          </chart:NumericalAxis.LabelStyle>
      </chart:NumericalAxis>
</chart:SfChart.SecondaryAxis>

C#

NumericalAxis secondary = new NumericalAxis();
secondary.LabelStyle = new ChartAxisLabelStyle()
{
     LabelFormat = "$###K",
};

Output:

Chart with prefix and suffix added axis labels in Xamarin.Forms

 

 

 

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment