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

Trackball - Label displaying value from Y & X axis?

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?
Thanks.

7 Replies

LR Lakshmi Radha Krishnan Syncfusion Team 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  

Regards,
Lakshmi R.



IJ Ian Jones October 27, 2016 01:08 AM UTC

Lakshmi,
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 };
chart.ChartBehaviors.Add(trackballBehavior);
Regards,
Ian



LR Lakshmi Radha Krishnan Syncfusion Team 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(label1);
grid.Children.Add(label2, 0, 1);
return grid;
});

Regards,
Lakshmi R.


IJ Ian Jones November 14, 2016 03:18 AM UTC

Lakshmi,

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?
Thanks,
Ian


LR Lakshmi Radha Krishnan Syncfusion Team 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, 
  
Sample 
  
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. 

Regards,
Lakshmi R.




IJ Ian Jones November 17, 2016 09:45 AM UTC

Lakshmi,
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?
Regards,
Ian

Attachment: Screenshot_20161117171628.png_65e5746b.zip


PS Parthiban Sundaram Syncfusion Team 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.

Regards,
Parthiban S


Loader.
Live Chat Icon For mobile
Up arrow icon