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

Trackball - Label displaying value from Y & X axis?

Thread ID:





126966 Oct 19,2016 05:44 AM UTC Nov 18,2016 01:00 PM UTC Xamarin.Forms 7
Tags: SfChart
Ian Jones
Asked On October 19, 2016 05:44 AM UTC

Does anyone know if its possible to display in the trackball label the formatted value for a data point AND the formatted value from the date/time (x) axis?

Lakshmi Radha Krishnan [Syncfusion]
Replied On October 19, 2016 12:31 PM UTC

Hi Ian Jones,

Thanks for using Syncfusion product,

We had prepared a sample based on your requirement with help of trackball template property in ChartSeries and it can be download from the following location.

Sample: http://www.syncfusion.com/downloads/support/forum/126966/ze/ChartSample696631172  

Lakshmi R.

Ian Jones
Replied On October 27, 2016 01:08 AM UTC

Thanks for the sample.
I should have mentioned that the Xam.Forms project is in c#, not XAML.
I've got an existing app running with medical data on charts and the trackball all working.
If I try :-
lineSeries1.TrackballLabelTemplate = new DataTemplate(() =>
var lblData = new Label() { Text = "Hello" };
return new ViewCell { View = lblData };
expecting the DataTemplate to fire as required (similar to ListView DataTemplate), it never does.
The built in data label always displays, never the one from the DataTemplate.
Is there anything else I'm missing in the Trackball line to get the data template working?
Current code looks like :-
var trackballBehavior = new ChartTrackballBehavior();
trackballBehavior.ShowLabel = true;
trackballBehavior.ShowLine = true;
trackballBehavior.LineStyle.StrokeDashArray = new double[2] { 2, 3 };

Lakshmi Radha Krishnan [Syncfusion]
Replied On October 27, 2016 10:59 AM UTC

Hi Ian,

We have checked your code snippet and found that you have added ViewCell in trackball template. ViewCell is not needed in trackball template. So you have to just directly add view to the template. We have included the code snippet for your reference.

Code snippet:

lineSeries.TrackballLabelTemplate = new DataTemplate(() =>
var grid = new Grid();
var label1 = new Label();
var label2 = new Label();
label1.SetBinding(Label.TextProperty, "XValue",stringFormat:"{0:MMM dd}");
label2.SetBinding(Label.TextProperty, "YValue" ,stringFormat:"{0:C}");
grid.Children.Add(label2, 0, 1);
return grid;

Lakshmi R.

Ian Jones
Replied On November 14, 2016 03:18 AM UTC


I've tried the provided sample, and still no joy.
I simplified it to just return a basic text based label, 

lineSeries1.TrackballLabelTemplate = new DataTemplate(() =>
return new Label() { Text = "Hello" };

and still nothing!

Any ideas?

Lakshmi Radha Krishnan [Syncfusion]
Replied On November 14, 2016 01:23 PM UTC

Hi Ian, 
We are unable to reproduce the reported issue at our end. We have prepared a demo sample for your reference by provided code snippet and it can be downloaded from the below link, 
If you are still able to reproduce the reported issue, please revert by modifying the sample. It would be helpful for us to serve you better. 

Lakshmi R.

Ian Jones
Replied On November 17, 2016 09:45 AM UTC

Apologies, I've been able to clarify further.
Interestingly the iOS graph is the one not working, while the Android one works perfectly - normally the other way round in my experience!
See attached screen shots.
The page is fully Xamarin Forms, with no special compiler directives etc (i.e. exactly same code for iOS and Android).
Hope this helps?

Attachment: Screenshot_20161117171628.png_65e5746b.zip

Parthiban Sundaram [Syncfusion]
Replied On November 18, 2016 01:00 PM UTC

Hi Ian,

We are unable to reproduce the reported issue at our end. Can you please conform whether the sample provided by last update is working or not. If it is not working please modify the code based on your application. It will be helpful for us to solve the reported issue.

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