Attach Graph Object to Graph

 

 

Version Info

Minimum Origin Version Required: Origin 8 SR0

Example

GraphObject::Attach to set Graph Object connect to Layer Frame(0), Page(1) or Layer and Scales(2). This same as Attach To option in Programming Control dialog. Right click on Graph Object, choose Programming Control in popup menu to open this dialog.

void GraphObject_Attach_ex()
{
    GraphPage gp;
    gp.Create();
    GraphLayer gl = gp.Layers();
    if(gl)
    {
        // add a Text and name is MyText
        GraphObject     go = gl.CreateGraphObject(GROT_TEXT, "MyText");
        if( go )
        {
                go.Text = "New Label";
        }        
        go.Attach = 0; // 0 to Layer; 1 to Page; 2 to Axes
        gl.GetPage().Refresh();
    }
}