The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 GraphObjects - e.g. lines - jut out of layer
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

TreeNode

64 Posts

Posted - 05/10/2011 :  07:00:14 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release: Origin 8 SR6
Operating System: Win XP

Hi,

I am adding several GraphObjects to my Layer, like lines and labels.
The X-Axis of my Layer is representing time, shows data from 0 - 48 hours.

Lets imagine I added a horizontal line spanning from 0 - 24 h. When I set X-Axis to show only
a timeframe from 6 - 12h, my line jut out of the layer frame at the left.

Is there a possibility to avoid the overhanging?


|-- TreeNode
...|-- a??
...|-- ha!!

Penn

China
644 Posts

Posted - 05/11/2011 :  03:30:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi TreeNode,

I am afraid you cannot avoid this overhanging directly. If you are try to use Origin C to avoid this, you can change the line's properties manually for each time you change the axis scale. Firstly, you need to save the corresponding info. of the line to a tree by using PutBinaryStorage method. And then, when the axis scale is changed (by Origin C here), you can get the saved info. from the line object by using GetBinaryStorage method for calculating the new width and position of the line, so that the line will not jut out of the layer frame.

Penn
Go to Top of Page

cpyang

USA
1406 Posts

Posted - 05/11/2011 :  1:36:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You can try using the GOC_AUTOHIDE bit for graphic objects (see oc_const.h). This was added in 2006 so should be Origin 8. When this bit is set, Gr Object will become hidden once outside the layer frame.



From LT, you can do

line.states=hex(100)

and from OC, the following was the testing code I found when this was implemented:


void selected_grobj_autohide(BOOL bSet)
{
   GraphLayer gl = Project.ActiveLayer();
   GraphObject go;
   go = Selection.Objects();
   if( go )
   {
       Tree tr;
       tr.Root.States.nVal = bSet ? GOC_AUTOHIDE : 0;
       int iRet = go.UpdateThemeIDs(tr.Root, "Error", "Unknown tag");
       go.ApplyFormat(tr, true, true);
   }
} 




CP
Go to Top of Page

TreeNode

64 Posts

Posted - 05/12/2011 :  10:19:00 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
@Penn:
Thanks for the idea, but its much to complicated. I would have to check for example if the line I want to endup at
layer frame has arrows at the end. When true, I would have to remove the arrow at the side where it touches layer frame,
and later to add it again.
Why GraphObjects dont just behave like the data inside the layer? So that you can only see things lay in the frame?

@cpyang
Thanks for your idea. It works. Its not a complete satisfying solution, but it has to suffice for now...


|-- TreeNode
...|-- a??
...|-- ha!!

Edited by - TreeNode on 05/12/2011 12:22:47 PM
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000