Permanent trackball
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.
SIGN IN To post a reply.
7 Replies
DA
Devi Aruna Maharasi Murugan
Syncfusion Team
October 3, 2016 12:49 PM UTC
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
TT
Thanh Tomas Dang
October 5, 2016 06:26 AM UTC
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
DA
Devi Aruna Maharasi Murugan
Syncfusion Team
October 6, 2016 01:24 PM UTC
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,
Sample: ChartTrackBallModified
Regards,
Devi
TT
Thanh Tomas Dang
October 7, 2016 08:52 AM UTC
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
DA
Devi Aruna Maharasi Murugan
Syncfusion Team
October 10, 2016 12:10 PM UTC
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
TT
Thanh Tomas Dang
October 10, 2016 12:13 PM UTC
Thank you Devi,
this is what I needed!
Best regards,
Thanh
DA
Devi Aruna Maharasi Murugan
Syncfusion Team
October 11, 2016 04:20 AM UTC
Hi Thanh,
Thanks for your update.
Please let us know, if you need any further assistance.
Regards,
Devi
SIGN IN To post a reply.
- 7 Replies
- 2 Participants
-
TT Thanh Tomas Dang
- Sep 30, 2016 06:38 PM UTC
- Oct 11, 2016 04:20 AM UTC