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

How to drag and drop the chart series points at run time?

Platform: WinForms |
Control: Chart


We can drop and drag the chart series points by calculating new X and Y values while doing any ChartRegionMouse Events like MouseUp, MouseDown, MouseHover, MouseLeave on the chart. The series new X and Y values are calculated from the mousepoint and GetValueByPoint which returns the X and Y values of the mousepoint calculated from the ChartPoint. The following code snippet must be given under the Mouse Event handler.


private void chartControl1_ChartRegionMouseUp(object sender, Syncfusion.Windows.Forms.Chart.ChartRegionMouseEventArgs e)


Cursor = Cursors.SizeAll;

if (this.isDragging)


double newY = Math.Floor(this.chartControl1.ChartArea.GetValueByPoint(e.Point).YValues[0]);

double newX = this.chartControl1.ChartArea.GetValueByPoint(e.Point).X;

if (newY < 0 || newY >= 50 || newX < 0 || newX > 7)

MessageBox.Show("Cannot drag outside chart bounds");






this.isDragging = false;

this.currentRegion = null;

this.selectedDataPoint.Y = 0;

this.selectedDataPoint.X = 0;



this.chartControl1.Series[0].Style.TextFormat = "{0}";




Private Sub chartControl1_ChartRegionMouseUp(ByVal sender As Object, ByVal e As Syncfusion.Windows.Forms.Chart.ChartRegionMouseEventArgs) Handles ChartControl1.ChartRegionMouseUp

Cursor = Cursors.SizeAll

If Me.isDragging Then

Dim newY As Double = Math.Floor(Me.ChartControl1.ChartArea.GetValueByPoint(e.Point).YValues(0))

Dim newX As Double = Me.ChartControl1.ChartArea.GetValueByPoint(e.Point).X

If newY < 0 OrElse newY >= 50 OrElse newX < 0 OrElse newX > 7 Then

MessageBox.Show("Cannot drag outside chart bounds")




End If

Me.selectedDataPoint.Y = 0

Me.selectedDataPoint.X = 0

Me.isDragging = False

Me.currentRegion = Nothing


End If

Me.ChartControl1.Series(0).Style.TextFormat = "{0}"


End Sub

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon 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.Close Icon

Live Chat Icon For mobile