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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ChartToolTipBehavior LabelFormat

Thread ID:





132954 Sep 30,2017 10:27 AM UTC Oct 2,2017 04:46 AM UTC Xamarin.Android 1
Tags: SfChart
Albert K
Asked On September 30, 2017 10:27 AM UTC


I have a DateTimeAxis as the PrimaryAxis  and a NumbericAxis as the SecondaryAxis.  How do I display the DateTime and Values in the tooltip ?  
Ii have the code below but it is not displaying the Date and Time.   Thank you.

chartTop.Behaviors.Add(new ChartTooltipBehavior() { LabelFormat = "dd/MM/yy hh:mm" });

Parthiban Sundaram [Syncfusion]
Replied On October 2, 2017 04:46 AM UTC

Hi Albert, 
Thanks for using Syncfusion products. 
You can achieve this requirement by overriding the GetView method in ChartTooltipBehavior class. Please refer the following code snippet for more details. 
Code Snippet: 
   protected override View GetView(TooltipView tooltipView) 
            LinearLayout rootLayout = new LinearLayout(Chart.Context); 
            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent, 
            rootLayout.Orientation = Orientation.Vertical; 
            rootLayout.LayoutParameters = layoutParams; 
            TextView xLabel = new TextView(Chart.Context); 
            string date = (tooltipView.ChartDataPoint as DataModel).XValue.ToString(); 
            var doubleToDate = DateTime.FromOADate(Convert.ToDouble(date)); 
            var formattedDate = doubleToDate.ToString("dd/MM/yy hh:mm"); 
            xLabel.Text = "Date:" + formattedDate.ToString(); 
            xLabel.TextSize = 15; 
            TextView yLabel = new TextView(Chart.Context); 
            yLabel.Text = "YValue: " + (tooltipView.ChartDataPoint as DataModel).YValue.ToString(); 
            yLabel.TextSize = 15; 
            return tooltipView; 
We have prepared the sample based on your requirement. Please download the sample from following location. 
Please let us know, if you need further assistance on this. 
Parthiban S


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.

Please sign in to access our forum

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

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