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
close icon

Repainting graph on mouse drag

Hi,
I have 2 issues which i would like to know if it would be possible to do with Syncfusion chart in windows forms.
1. I have a line graph which needs a drag and drop of cruve points. Iam able to drag and drop points to new location, but the curve is not drawn in new location until i drop it. i.e the curve is not dynamically drawn to every new location in drag when mouse is still down.Its only drawn to new location as i leave the mousebutton. Is it possible to draw the curve for every point i drag even before i leave the mousebutton ?.
2. i need to put some restriction in dragging the curve.i.e i should not be able to drag the curve before the previous point and ahead of next point, iam programatically able to acehive it but visually can i restrict the mouse cursor entry before the previous point or ahead of next point in chart area ?.
Please let me know if these could be acheived in syncfusion chart ?.
Regards,
Ashok

21 Replies

AD Administrator Syncfusion Team September 20, 2006 02:34 PM UTC


Hi Ashok,

I regret very much for the delay in updating you.

1) Yes. It is possible to update the curve dynamically with dragging effect.

Using ChartRegionClick and ChartRegionMouseMove Events you can update the curve for every point you drag before releasing the mousebutton. i.e

You can get the clicked PointIndex using ChartRegionClick and update the new X and Y values dynamically with ChartControl in the ChartRegionMouseMove Events.

2) It is possible to put some restriction in dragging the curve

((e.Region.PointIndex==0)||(e.Region.PointIndex==1))

Using the above code in ChartRegionClick Event helps the user to drag only the respective PointIndex i.e only the first and second PointIndex and not other points.

Thank you for your patience.

Regards,
Jaya


JS Jst September 21, 2006 07:00 AM UTC

Hi Jaya,
Thanks a lot for replying.
Its great to hear that repaint of graph on drag with mouse down is possible. I have tried the same as you have said and not able to acheive the same. Attached sample is the one i have tried with mouse move event which doesnt redraw the curve on drag until i leave the mouse button. Please let me know how to visualize the same!.
Again for the second issue sorry for not making my point clear. I was able to acheive the restriction programatically as i said in the thread above. My query was i need to VISUALLY RESTRICT the MOSUE POINTER entry inside itself, i.e The mouse cursor even though i drag it before the previous point the mouse cursor should NOT MOVE beyond the previous point but it can be moved normally in allowed area. I need to RESTRICT the MOUSE CUSOR MOVEMENT itself.
Please let me know if my query is clear to understand and if it is possible to acheive the same?.


ChartDrag.zip


AD Administrator Syncfusion Team September 26, 2006 10:48 AM UTC

Hi Ashok,

I regret very much for the delay in updating you.

It is possible to dynamically update the linechart with dragging effect using ChartRegionMouseMove and ChartRegionClick Events.

It is also possible to visually restrict the mousepointer at particular PointIndex using Cursor.Hide() and Cursor.Show() methods.

Please try the attached sample which helps you to redraw the curve on drag until you leave the mouse button and also helps to hide the mousepointer in the particular PointIndex.

You can also restrict the mousepointer in any area of the ChartRegion.

Kindly let me know if this helps.

Thank you for your patience.

Regards,
Jaya

DragDropDynamic.zip


JS Jst September 27, 2006 06:39 AM UTC

Hi Jaya,
Thanks a lot for replying and sample. I dont know if iam missing something. I was not able to acheive the drag effect when i click the left button down on a point and drag it to another new position and leave it. but after leaving the mouse left button when i move the mouse cursor iam able to see the dragging of curve to every new location of mouse move. I tried to acheive the drag effect when mouse LEFT BUTTON IS DOWN (PRESSED). but its not happening on down.
The restricting mouse entry issue''s solution of hiding the mouse cursor itself is good alternate solution, thank you for sample. i was thinking something like pausing the mouse cursor on the border, within border the mouse cursor can move freely but the position where it crosses the border the cursor gets freezed in the (same place) border.
Please let me know if iam missing something.
Regards,
Ashok


AD Administrator Syncfusion Team October 3, 2006 07:27 AM UTC


Hi Ashok,

I regret very much for the delay in updating you.

I am still working on the first issue.

Regarding second issue, you can restrict the cursor movement to the certain area of a chart by drawing rectangle using ChartAreaPaint and restrict the cursor movement inside the rectangle in the chartControl1_MouseMove Event handler.

Please try the attached sample which helps you to restrict the cursor movement inside the ChartRegion.

Thank you for your patience.

Regards,
Jaya

LimitCursor.zip


JS Jst October 6, 2006 05:17 AM UTC

Hi Jaya,
Thanx for update. That sample helps a lot. Eagerly waiting for solution for first issue.
Regards,
Ashok


AD Administrator Syncfusion Team October 10, 2006 02:57 PM UTC


Hi Ashok,

I regret very much for the delay in updating you.

Could you please let me know the current version of Essential Chart you are using?

The attached sample working well in 4.1.0.50 i.e, the drag effect can be achieved dynamically when left mouse button is pressed.

Thank you for your patience.

Regards,
Jaya

DragDropDynamic0.zip


JS Jst October 11, 2006 11:55 AM UTC

Hi Jaya,
Thanks for the sample. Iam using Syncfusion version 4.1.0.62. Iam still not able to acheive the visual drag effect when left mouse button is down in the sample above.


JS Jst October 11, 2006 11:55 AM UTC

Hi Jaya,
Thanks for the sample. Iam using Syncfusion version 4.1.0.62. Iam still not able to acheive the visual drag effect when left mouse button is down in the sample above.


JS Jst October 11, 2006 11:55 AM UTC

Hi Jaya,
Thanks for the sample. Iam using Syncfusion version 4.1.0.62. Iam still not able to acheive the visual drag effect when left mouse button is down in the sample above.


VR Vinod Raghupathy October 17, 2006 05:53 AM UTC

Hi,
I too have same issue and i would like to get a update on the same. Please let me know if i install the latest version 4.3.0.30 will i be able to get this visual drag ?.
- Vinod.R


AD Administrator Syncfusion Team October 17, 2006 02:36 PM UTC

Hi,

We regret for the inconvenience caused.

We are working on this issue with high priority. After fixing this issue, we will send you the Dll’s or Service pack with in a week.

Thanks for using Syncfusion products.

Thanks,
Sureshbabu


AD Administrator Syncfusion Team October 23, 2006 01:44 PM UTC

Hi,

Sorry for inconvenience caused.

Please open an Incident for Visual drag drop of a point. We will send you the link for service pack within three days.

Thanks for using Syncfusion products.

Best Regards,
Sureshbabu


NT Nikos Triantafyllidis April 26, 2007 08:22 AM UTC

Hi,

i have the same problem too. I want to repaint graph during mouse drag only and additionally when the mouse mouves out of the range of the graph, the latest to be automatically adjusted. I am using DateTime for the x axis and Double for y axis.
Is this possible?

Best,
Nikos


RR Ramya R Syncfusion Team April 26, 2007 03:53 PM UTC

Hi Nikos,

Thanks for your interest in Essential Chart.

Could you please provide me some more information with regard to your requirement along with some screenshots, so that it would help me in meeting your requirement exactly?

Thanks & Regards,
Ramya.


NT Nikos Triantafyllidis April 27, 2007 06:54 AM UTC

Hi Ramya,

I am implementing the the handlers for the events:
ChartRegionMouseDown,
ChartRegionMouseMove,
ChartRegionClick
similarly as you have on the sample in this page called "DragDropDynamic". In this sample you can drag a point on the chart by clicking it and then the latest would be moving along with the mouse movement until you click again and the it will stop. Is it possible the movement to be restricted ONLY when you drag the point. This means that when you hold the mouse down and move it the same time the chart will be repainted?

And a second thing i would like to inquire is that i want my Y axis to change its range as the mouse goes out of bounds of the chart. That means that if i am dragging a point and its value is more than the Ymax or Ymin the Y axis should have new range. I tried to reassign the origin or to change the range or PrimaryYAxis but the results were not looking good. Is there a proper way to achieve such requirement? My X axis have DateTime. Does this causes any problems in the range of Y axis which has Double values?

I want to thank you in advance for your reply.

Best,

Nikos

>Hi Nikos,

Thanks for your interest in Essential Chart.

Could you please provide me some more information with regard to your requirement along with some screenshots, so that it would help me in meeting your requirement exactly?

Thanks & Regards,
Ramya.


NT Nikos Triantafyllidis April 27, 2007 08:30 AM UTC

I am sending you a sample code attached.

Best,

Nikos

DragDrop0.zip


RC Rajesh C Syncfusion Team April 28, 2007 02:15 AM UTC

Hi Nikos,

I have drag the chart point when holding the mouse button and moving the mouse and then changed the value of axis by using Series.BeginUpdate() and Series.EndUpdate() methods. Please refer to the following code snippet.

[ C# ]
private bool IsMouseDown = false;
private ChartPoint ChartPt;

private void chartControl1_ChartRegionMouseDown(object sender, ChartRegionMouseEventArgs e)
{
if (e.Region.IsChartPoint)
{
Cursor = Cursors.SizeAll;
this.currentRegion = e.Region;
IsMouseDown = true;
this.chartControl1.Series.BeginUpdate();
}
}

private void chartControl1_ChartRegionMouseMove(object sender, ChartRegionMouseEventArgs e)
{
if (IsMouseDown)
{
ChartPt = this.chartControl1.ChartArea.GetValueByPoint(e.Point);
this.chartControl1.Series[0].Points[this.currentRegion.PointIndex].X = ChartPt.X;
this.chartControl1.Series[0].Points[this.currentRegion.PointIndex].YValues[0] = ChartPt.YValues[0];
toolTip1.SetToolTip(chartControl1, ChartPt.DateX.ToString(chartControl1.PrimaryXAxis.DateTimeFormat) + ", " + ChartPt.YValues[0]);
this.chartControl1.Redraw(true);
}
}

private void chartControl1_MouseUp(object sender, MouseEventArgs e)
{
if (IsMouseDown)
{
this.chartControl1.Series.EndUpdate(); //refresh the axis value
IsMouseDown = false;
}
}

I have modified the your sample. Please have a look at the sample and let me know if this helps you.

http://websamples.syncfusion.com/samples/Chart.Windows/F49315/main.htm

Regards,
Rajesh


NT Nikos Triantafyllidis April 30, 2007 07:14 AM UTC

Hi,

Thank you for your reply.

Could you please write the link once more because this appears to be inactive.

Best,

Nikos


RR Ramya R Syncfusion Team April 30, 2007 12:03 PM UTC

Hi Nikos,

With reference to your incident #33601 in DirectTrac, I hope your using Syncfusion version 4.3.0.30. But the repainting of graph on mouse drag is not working correctly in this version.

This has been fixed in our latest versions.

Our last major release is version 4.4.0.51.

And RC of our new version 5.1 has also been released.

So could you please upgrade to anyone of these versions and then execute the sample.

I have pasted the link of the sample here once again.

http://websamples.syncfusion.com/samples/Chart.Windows/F49315/main.htm

Let me know if you have any queries.

Thanks & Regards,
Ramya.

Loader.
Live Chat Icon For mobile
Up arrow icon