Home » U++ Library support » ScatterDraw & ScatterCtrl » ScatterDraw data ownership
ScatterDraw data ownership [message #54066] |
Fri, 29 May 2020 11:27  |
busiek
Messages: 70 Registered: February 2011 Location: Poland
|
Member |
|
|
Hi,
After creating new serie (say with AddSeries<Vector<Pointf>>) I want ScatterDraw to take control over this data. How to do it?
I mean if someone deletes the serie using ScatterCtrl, the data stored with it should be deleted too. I tried several approaches with SetDataSource_Internal or with creating DataSource based class storing Vector<Pointf>, but it seems it is not a way to do it.
Jakub
|
|
|
|
|
Re: ScatterDraw data ownership [message #54085 is a reply to message #54084] |
Sat, 30 May 2020 20:02   |
 |
koldo
Messages: 3432 Registered: August 2008
|
Senior Veteran |
|
|
Dear Jakob
If your application is interactive, I would not unlink Scatter from data. That is the nice thing of having all coupled.
In case that you need, for any case, to unlink them, SetDataSourceInternal() does the job just once after all AddSeries() calls.
In addition, if your user updates the data, you would have to call Refresh(). If you unlink the data, you would have to call SetDataSourceInternal(), so this does not require additional lines of code.
Best regards
Iñaki
[Updated on: Sat, 30 May 2020 20:03] Report message to a moderator
|
|
|
Re: ScatterDraw data ownership [message #54087 is a reply to message #54085] |
Sat, 30 May 2020 22:45   |
busiek
Messages: 70 Registered: February 2011 Location: Poland
|
Member |
|
|
Dear Koldo,
OK. Currently, I simply call SetDataSourceInternal() whenever I need - i.e. when new serie is created. It works. However, when I want to add some another serie, I need to call SetDataSourceInternal() again and - as I understand - it copies all data for all series once again, while only the data of the new serie should be copied. Correct me, if I am wrong.
I operate on a very big data. The main functionality of my app is to find some nice smoothing of the given data interactively. I try several settings, create new series basing on some previous one and compare visually how they match. Currently, the interface you provided simply suffices. I just wonder what would happen if a single serie needed ~1 GB memory to store. Then avoiding any kind of copying is welcome, but it is hypothetical setting 
Jakub
P.S. Scatter{Draw,Ctrl} is great and it saved me a lot of work
|
|
|
Re: ScatterDraw data ownership [message #54094 is a reply to message #54087] |
Sun, 31 May 2020 20:51   |
 |
koldo
Messages: 3432 Registered: August 2008
|
Senior Veteran |
|
|
Dear Jakob
If you handle lots of data interactively, SetDataSourceInternal() is not the best option, as it copies the data from your source to the internal storage.
In this case, I strongly advice you to use Scatter normally, so you manage that the data will be always available for Scatter.
Best regards
Iñaki
[Updated on: Sun, 31 May 2020 20:52] Report message to a moderator
|
|
|
|
|
Re: ScatterDraw data ownership [message #54102 is a reply to message #54066] |
Mon, 01 June 2020 08:03   |
busiek
Messages: 70 Registered: February 2011 Location: Poland
|
Member |
|
|
Well, in ScatterCtrl, under Properties you can remove or rearrange series. So this action can be performed by a user interactively. I use this functionality in my app. There is no way to get feedback whether such action by a user was performed.
[Updated on: Mon, 01 June 2020 08:03] Report message to a moderator
|
|
|
Re: ScatterDraw data ownership [message #54105 is a reply to message #54102] |
Mon, 01 June 2020 10:35   |
 |
koldo
Messages: 3432 Registered: August 2008
|
Senior Veteran |
|
|
Yes, you are right.
I have added and documented this:
bool RemoveSeries(int index);
bool SwapSeries(int i1, int i2);
Function <bool(int)> WhenRemoveSeries;
Function <bool(int, int)> WhenSwapSeries; The callbacks are called just before, and if they return false, the operation is not done and RemoveSeries() or SwapSeries() return also false.
Best regards
Iñaki
[Updated on: Mon, 01 June 2020 10:40] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Tue Apr 29 01:49:52 CEST 2025
Total time taken to generate the page: 0.01309 seconds
|