Trackball Template

Hi, 

I'm using the trackball item template present at https://help.syncfusion.com/xamarin/sfchart/trackball?cs-save-lang=1&cs-lang=csharp. 

However, when I run my code, the template does not appear to be taking effect on the chart. 

Attaching a breakpoint & my template has no bindings or values attached to it. Is this normal?

Regards,

Raymond 

5 Replies

PS Parthiban Sundaram Syncfusion Team November 7, 2017 12:49 PM UTC

Hi Raymond,

Thanks for using Syncfusion products.

We were unable to reproduce the reported issue at our end and we have prepared the sample for this. Please update us the modified sample or chart related code snippet to reproduce the issue which will be helpful for providing further assistance on this.

Sample: http://www.syncfusion.com/downloads/support/forum/133585/ze/TrackballTemplate529463249  

Regards,
Parthiban S.


RD Raymond Dillon November 7, 2017 04:41 PM UTC

Hi, 

I eventually got it going - but I have another question - is it possible to change the TrackBall Item template based on the current value)? i.e showing a different image on the trackball label depending on the value in the y axis?

Kind Regards,


Raymond 



PS Parthiban Sundaram Syncfusion Team November 8, 2017 12:55 PM UTC

Hi Raymond, 
 
Thanks for the update. 
 
You can achieve this requirement by setting a DataTemplate with an IValueConverter for TrackballLabelTemplate property. Please refer the following code snippet for more details. 
 
Code snippet: 
 
DataTemplate 
 
 
    <ResourceDictionary> 
        <local:ImageConverter x:Key="imageConverter" /> 
        <DataTemplate x:Key="trackballTemplate"> 
                         <StackLayout Orientation="Horizontal" Spacing="0"> 
          <Label Text="{Binding YValue}" VerticalOptions="Center" FontSize = "15" /> 
          <Image Source="{Binding YValue, Converter = {StaticResource imageConverter}}" WidthRequest="30" HeightRequest="30" HorizontalOptions="Fill" VerticalOptions="Fill" /> 
        </StackLayout> 
      </DataTemplate> 
    </ResourceDictionary> 
 
       
IValueConverter: 
 
 
public class ImageConverter : IValueConverter 
    { 
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture) 
        { 
            double val = System.Convert.ToInt32(value); 
 
            if (val > 50) 
                return "up.png"; 
            else 
                return "down.png"; 
        } 
 
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) 
        { 
            return value; 
        } 
    } 
 
We have created a simple demo sample to demonstrate this. Please download it from below location. 
 
 
Please let us know, if you need further assistance on this. 
 
Regards, 
Parthiban S 



RD Raymond Dillon November 9, 2017 03:10 PM UTC

Hi, 


Perfect, thank you :) .

One last question - I am using 2 line series on a chart (value vs datetime range).

If I had a date range in set 1 from Sept-Oct and a date range in set 2 from Oct-Nov - is there anyway I can force the chart to use an x axis range from Sep - Not (i.e a combination of both date ranges?)

Cheers!





PS Parthiban Sundaram Syncfusion Team November 10, 2017 11:24 AM UTC

Hi Raymond, 
 
Thanks for the update. 
 
You can achieve this requirement with the help of multiple axes feature by adding additional axis to the chart series. Please refer the following code snippet for more details. 
 
Code snippet: 
 
 
         <chart:LineSeries.XAxis> 
              <chart:DateTimeAxis/> 
          </chart:LineSeries.XAxis> 
 
We have also prepared the simple sample for this. Please download it from following location. 
 
 
Please let us know, if you need further assistance on this. 
 
Regards, 
Parthiban S. 


Loader.
Up arrow icon