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

How to set the milliseconds label format for axis and trackball label in Xamarin.Forms Chart?

Platform: Xamarin.Forms |
Control: SfChart

You can set the milliseconds label format for axis labels and trackball axis labels by using LabelFormat  property of LabelStyle and TrackballLabelStyle in ChartAxis. The following code illustrates how to set the milliseconds label format for axis and trackball axis labels.

XAML:

<chart:SfChart.PrimaryAxis>
    <chart:DateTimeAxis ShowTrackballInfo="True">
        <chart:DateTimeAxis.LabelStyle>
        <chart:ChartAxisLabelStyle LabelFormat="MM/dd/yyyy (HH:mm:ss.fff)" />
        </chart:DateTimeAxis.LabelStyle>
        <chart:DateTimeAxis.TrackballLabelStyle>
            <chart:ChartTrackballAxisLabelStyle LabelFormat="MM/dd/yyyy (HH:mm:ss.fff)"/>
        </chart:DateTimeAxis.TrackballLabelStyle>
    </chart:DateTimeAxis>
</chart:SfChart.PrimaryAxis>
. . .
 
<chart:SfChart.ChartBehaviors>
    <chart:ChartTrackballBehavior />
</chart:SfChart.ChartBehaviors>

 

C#:

DateTimeAxis dateTimeAxis = new DateTimeAxis();
dateTimeAxis.ShowTrackballInfo = true;
dateTimeAxis.LabelStyle.LabelFormat = "MM/dd/yyyy (HH:mm:ss.fff)";
dateTimeAxis.TrackballLabelStyle.LabelFormat = "MM/dd/yyyy (HH:mm:ss.fff)";
chart.PrimaryAxis = dateTimeAxis;
. . .
 
ChartTrackballBehavior trackballBehavior = new ChartTrackballBehavior();
chart.ChartBehaviors.Add(trackballBehavior);

Output:

Label format for axis and trackball axis labels

 

 

2X faster development

The ultimate Xamarin UI toolkit to boost your development speed.
ADD COMMENT
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon 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.Close Icon

Live Chat Icon For mobile