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

Permanent trackball

Thread ID:

Created:

Updated:

Platform:

Replies:

126206 Sep 30,2016 02:38 PM Oct 11,2016 12:20 AM WPF 7
loading
Tags: SfChart
Thanh Tomas Dang
Asked On September 30, 2016 02:38 PM

Hello,

I'm working on a scatter series charting project right now and one of the requirements is a "permanent trackball" - a vertical line marker of sorts that a user could shift around horizontally to "mark" datapoints with the ability to snap to it if close enough. This behavior is very similar to that of the trackball already present, however that is not permanent (and I am not sure if it can provide a binding for the "currently highlighted data point".

Is there any way to implement this? If possible via some bindings (I'd like to avoid code-behind) - if it's not possible, I'll have to live with it, though.

Thank you,
T.D.

Devi Aruna Maharasi Murugan [Syncfusion]
Replied On October 3, 2016 08:49 AM

Hi Thanh, 
  
Thanks for contacting Syncfusion Support. 
  
Your requirement can be achieved by VerticalLineAnnoation of SfChart. We have prepared a demo sample for your reference and it can be downloaded from below link, 
  
Sample: ChartTrackBall 
  
Please refer below UG documentation link to know more about annotation, 
  
  
Regards, 
Devi 




Thanh Tomas Dang
Replied On October 5, 2016 02:26 AM

Hello Devi!

First, thank you so much for your example! This works quite well for me. One thing I'd like to ask is - is it possible to snap the vertical line annotation to the data points?

Thank you again,
Thanh

Devi Aruna Maharasi Murugan [Syncfusion]
Replied On October 6, 2016 09:24 AM

Hi Thanh, 
  
Thanks for your update. 
  
We have achieved your requirement (mark data point in trackball) by custom trackball behavior. In custom trackball behavior class , we have to set the data point for placing trackball as like in below code 
  
private void CalculatePoint() 
  { 
     var xPoint = this.ChartArea.ValueToPoint(ChartArea.PrimaryAxis, 2); 
     var yPoint = this.ChartArea.ValueToPoint(ChartArea.SecondaryAxis, 32); 
     if (this.AdorningCanvas != null) 
          OnPointerPositionChanged(new Point(xPoint, yPoint)); 
 
   } 
 
  
We have prepared a demo sample for your reference and it can be downloaded from below link, 
  
  
Regards, 
Devi 


Thanh Tomas Dang
Replied On October 7, 2016 04:52 AM

Hi Devi,

is the trackball movable?

What I meant/need is a vertical line (It doesn't really matter if it is an annotation or an actual trackball) that I can move around left and right. If it is near a datapoint, it should snap to the point, but I can still move it.

It sounds like a hard thing to do, I tried using Drag Delta events to snap the annotation to the points, but it seems like it doesn't work and only Drag Completed works.

Thank you,
Thanh

Devi Aruna Maharasi Murugan [Syncfusion]
Replied On October 10, 2016 08:10 AM

Hi Thanh, 
  
Thanks for your update. 
  
We are able to achieve your requirement with FindNearestChartPoint method of chart series in DragCompleted event of annotation.We have prepared a demo sample for your requirement and it can be downloaded from below link, 
  
Sample: DragCompleted 
  
Regards, 
Devi 




Thanh Tomas Dang
Replied On October 10, 2016 08:13 AM

Thank you Devi,

this is what I needed!

Best regards,
Thanh

Devi Aruna Maharasi Murugan [Syncfusion]
Replied On October 11, 2016 12:20 AM

Hi Thanh, 
  
Thanks for your update. 
  
Please let us know, if you need any further assistance. 
  
Regards, 
Devi 


CONFIRMATION

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.

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.

;