Author |
Topic  |
|
peter.cook
UK
356 Posts |
Posted - 08/23/2004 : 11:42:04 AM
|
Hi,
I would like to be able to manually draw a region around some data points on a graph and then remove all the values from within...anyone have any thoughts as to how this could done?
Transparent would be required. Rectangle would do (.. free draw of loop would be nice but I suspect more complicated.)
Thanks,
Cheers,
Pete
|
|
Mike Buess
USA
3037 Posts |
Posted - 08/23/2004 : 2:25:41 PM
|
Hi Pete,
It would probably be easiest to use a rectangle and create it in advance. Set it's properties through normal GUI and save it as an OGO file...
draw -n Rect -f save %YRect.ogo;
You could use a 2-button toolbar. 1st button draws the rectangle. User positions and sizes it. 2nd button removes the points inside.
[Button1] draw -n Rect -f read %YRect.ogo; Rect.x=(X2-X1)/2; // center it horizontally Rect.y=(Y2-Y1)/2; // center it vertically
[Button2] xx1=Rect.x-Rect.dx/2; // x value at left xx2=Rect.x+Rect.dx/2; // x value at right ii1=xindex1(xx1,%C); // index of left-most point inside rect ii2=xindex(xx2,%C); // index of right-most point inside yy1=Rect.y-Rect.dy/2; // y value at bottom yy2=Rect.y+Rect.dy/2; // y value at top for(ii=ii2;ii>=ii1;ii--) { yy=%C[ii]; // delete the row if y value is inside rect (next line) if(yy>yy1 && yy<yy2) mark -d %C -b ii -e ii; };
...Corrections in red.
There might be a more efficient way to remove the rows but that should work.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 08/23/2004 2:34:41 PM
Edited by - Mike Buess on 08/24/2004 10:48:10 AM |
 |
|
rlewis
Canada
253 Posts |
Posted - 08/23/2004 : 3:17:02 PM
|
Be aware, however one of the quirks of the mark -d LT-command
mark -d dataset [range] Delete elements from dataset. If dataset is in a worksheet, this command deletes the specified rows from the worksheet
If there are many Y-datasets in a single worksheet, it will do the same for all datasets in that worksheet. This could be either very convenient or quite awkward depending on what one wants ... |
 |
|
peter.cook
UK
356 Posts |
Posted - 08/24/2004 : 09:31:54 AM
|
Hi Mike,
Thanks for this..I was thinking along these lines but hadn't considered your approach of using a rectangle created in advance. This is useful!
Ruthven..cheers for the reminder. Inpractice i always tend to set to missing values rather than delete in order to keep integrity in layouts etc and allow for easier 'return' of data in our applications.
Cheers,
Pete
|
 |
|
Mike Buess
USA
3037 Posts |
Posted - 08/24/2004 : 10:34:58 AM
|
Pete,
If you prefer to use missing values you can replace the mark command with %C[ii]=0/0;
Also, there are errors in the Button2 script. Replace xvalue() with xindex() and xvalue1() with xindex1(). Arguments are the same as before.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 08/24/2004 10:37:53 AM |
 |
|
|
Topic  |
|