Drag Series Plot to New Form?

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
plotter
Posts: 41
Joined: Thu Apr 06, 2017 2:29 am

Drag Series Plot to New Form?

Post by plotter » Mon May 01, 2017 8:59 pm

I really like the drag n drop series, but have 2 questions...

1: Is there any way to drop on to chart in different form?

2: Once I drop to different Y Axis, what do I need to do to display the series Axis Scale and title at the left of the plot.
So that when I drag and drop a plot, 'everything' about the plot (Title, Axis Scale, etc) is moved to the new drop target.

Love your product...

Thanks,

ArctionKestutis
Posts: 552
Joined: Mon Mar 14, 2016 9:22 am

Re: Drag Series Plot to New Form?

Post by ArctionKestutis » Tue May 02, 2017 11:29 am

Hi,

1. ChartManager control can be used to coordinate interoperation of several LightningChartUltimate controls (works also with different Forms). See our Demo App example "Lissajous monitor" how to create ChartManager.

2. In practice, when you drag-and-drop series you are changing owner (x/y axis assignment). Therefore, all properties what belong to series moves together (e.g. Title, LineStyle etc). However, axis scale/range is not part of that group. To tune-in other properties use _chartManager.SeriesDragFinished and/or _chartManager.SeriesDragStarted events.

Al the best.

lokesh
Posts: 45
Joined: Tue Feb 14, 2017 8:48 am

Re: Drag Series Plot to New Form?

Post by lokesh » Wed May 03, 2017 2:48 pm

Hi Dr.,

I am a bit confused. Can I use chart manager to drag a PointLineSeries from one chart to another chart?
Earlier Pasi told me that, changing parent of the PointLineSeries is not allowed as the whole library has a tree structure(viewtopic.php?f=15&t=1073).
Further if dragging is possible, when we drag a series, won't the parent chart of the PointLineSeries be changed? Or is it internally keeping the references to its original chart but drawing it on a different chart?
Finally, can I change the parent view of PointLineSeries programmatically?

Sorry for piling up with questions. :|

Thanks,

Lokesh

ArctionKestutis
Posts: 552
Joined: Mon Mar 14, 2016 9:22 am

Re: Drag Series Plot to New Form?

Post by ArctionKestutis » Thu May 04, 2017 12:34 pm

Hi Lokesh,

Yes, you could use ChartManager control to drag the LineSeries between charts! ChartManager is basically created for that.

The change the parent of PointLineSeries programmatically is slightly different issue. Strictly speaking LightningChart not allow parent sharing viewtopic.php?f=29&t=973, while parent change is possible in theory. However, complexity of parent-child relationship inside of the chart and numerous cross-references could create a lot of practical problems. The situation like this arise from limitation of .NET, C# and how LightningChart was originally implemented.
Under certain condition, changing owner/parent is allowed (like LineSeries changing axes / chart), but this could not be simply generalized. For other cases, user should take care that all child's references properly updated - where many things can go wrong. Therefore, we do not recommend exploit parent change too much (if at all).

All the best.

plotter
Posts: 41
Joined: Thu Apr 06, 2017 2:29 am

Re: Drag Series Plot to New Form?

Post by plotter » Thu May 04, 2017 1:07 pm

So then might the best (safest) way to implement this would be to use the Chart Manager to basically identify what is being moved, then in code, remove completely from parent, and then delete the 'dropped' components, and recreate the dropped series completely in the target form?

ArctionKestutis
Posts: 552
Joined: Mon Mar 14, 2016 9:22 am

Re: Drag Series Plot to New Form?

Post by ArctionKestutis » Fri May 05, 2017 11:12 am

The ChartManager control should handle dragging LineSeries correctly (by removing/updating references). Nobody identify problem with that control yet. Although it is possible that it is not widely used :roll: .
If you feel that there is problem with ChartManager let us know.

lokesh
Posts: 45
Joined: Tue Feb 14, 2017 8:48 am

Re: Drag Series Plot to New Form?

Post by lokesh » Fri Jun 02, 2017 6:47 pm

Hi Dr.,
You are absolutely right. Everything is handled perfectly by the chart manager so far.

I have a small question though. I am able to drag and drop a PointLineSeries onto an axis but, for some reason, I am not able to drag and drop it onto the ViewXY area.
My chart.AllowDrop is set to true. Is there any other setting that I have to modify in order for this to work? I am using the 7.2.1.4001 version of LCU.

Edit:
Also, is there a way to cancel the drag based on some check condition in the SeriesDragFinished event?

Thanks,
Lokesh

ArctionKestutis
Posts: 552
Joined: Mon Mar 14, 2016 9:22 am

Re: Drag Series Plot to New Form?

Post by ArctionKestutis » Mon Jun 05, 2017 12:56 pm

Hi Lokesh,

The drag-drop of Series is design to work with 'drop-point' being active-area of x/y-axis. The increasing zone to ViewXY area would create unnecessary uncertainties: e.g. in case of multiple axis layout.

Series have DisableDragToAnotherAxis property, and it must be set to False to enable the dragging. It is True by default.
Axes have AllowSeriesDragDrop property which can be set to False to prevent dragging over specific axis. Default is True.

Move mouse over the series to be dragged, press left mouse button down to start dragging. Release mouse button over Y/X axis.

To cancel Series dragging while doing it, press another mouse button or release over original Series' axis.

There is no good way to cancel programmatically when drag already started. You have two ChartManager events:

Code: Select all

_chart.ChartManager.SeriesDragStarted += ChartManager_SeriesDragStarted;
_chart.ChartManager.SeriesDragFinished += ChartManager_SeriesDragFinished;
However, they just inform about axes, charts and series involved.

Probably the best solution is to prevent dragging over specific axis. If it is specific to Series, when you may need use MouseMove event and check Series.IsMouseOver(). This would allow you to disable specific axis prior SeriesDrag started.

Hope this helps.
All the best.

lokesh
Posts: 45
Joined: Tue Feb 14, 2017 8:48 am

Re: Drag Series Plot to New Form?

Post by lokesh » Mon Jun 05, 2017 2:03 pm

I see. Thanks Dr.

- Lokesh

Post Reply