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

SfChart DragDelta value is always 0

SFChart with a line series. Databound to an observable collection of custom objects. Editing enabled. Chart is fixed at 5 data points. First and last point edits are cancelled inside DragStart.

I would like to enforce a constraint that points must always increase in value from left to right. When increasing a point's value, if it equals the next point to the right, then both points should increase together in parallel.

I wired up the DragStart, DragDelta and DragEnd handlers. Inside the DragDelta I thought I would compare values and update adjacent points when needed.

The current issue is that e.Delta is always zero inside DragDelta according to my debugging.  

Is my expectation wrong or is there something special I need to do to get the delta change in the DragDelta handler?

Thank you,
Gary

3 Replies

RA Rachel A Syncfusion Team February 16, 2015 12:42 PM UTC

Hi Gary,

Thank you for contacting Syncfusion support.

While dragging the segment, the delta value (e.Delta) in DragDelta event remains zero. We have considered this as an issue.

However this can be resolved by manually calculating the delta value, using the arguments BaseYValue and NewYValue in XYSegmentDragEventArgs (i.e., difference between base value and new value). We have prepared the sample based on your requirement and please download the sample in the below location.

Sample: Drag_Delta.zip

Also we request you to create an incident in direct trac support so that we could assist you in providing custom patch for the above mentioned issue.

Please let us know, if you need any further assistance on this.

Thanks,

Rachel. A





GM Gary Montgomery February 16, 2015 11:48 PM UTC

Thank you Rachel! That did the trick.

Here is the relevant snippet for anyone that finds this post after the zip is removed.

        private void SplineSeries_DragDelta(object sender, DragDelta e)
        {
            // get old and new y value
            double oldValue = (e as XySegmentDragEventArgs).BaseYValue;
            double newValue = (e as XySegmentDragEventArgs).NewYValue;

            double delta = 0;
            if (oldValue > newValue)
                delta = oldValue - newValue;
            else
                delta = newValue - oldValue;

             // ....
          }



RA Rachel A Syncfusion Team February 17, 2015 05:17 AM UTC

Hi Gary,

Thanks for the update.

Please let us know if you require further assistance on this.

Thanks,

Rachel.A



Loader.
Live Chat Icon For mobile
Up arrow icon