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
 customizing NLSF parameter output
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

houwelingen

Switzerland
Posts

Posted - 03/17/2005 :  10:25:31 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5SR0
Operating System:winXP
Hi,

I`m trying to automate the generation of a fitcurve for an experiment. I want to show the parameters I get from a fit, however the text this creates is extremely inconvenient (NLSF.PasteParams("p")) I would like to make my own textbox on in the graph and write the most important variables to this textbox, however I can`t figure out how to make/control a textbox. Any suggestions?

Thx,
Jeroen

easwar

USA
1965 Posts

Posted - 03/17/2005 :  2:07:36 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Jeroen,

You can create a new label and format the text property of that label and put in your desired values from the NLSF object, using NLSF properties such as NLSF.p1, NLSF.ChiSqr etc once your fit is done.

The code pasted below shows how to create and set properties of a text label in a graph.

Easwar
OriginLab


void add_edit_text_label_in_graph()
{
// Declare graph layer using active layer
GraphLayer gly = Project.ActiveLayer();
if( !gly )
{
out_str("Active layer is not a graph!");
return;
}
// Note: Labels can exist in pages such as worksheet as well
// This example just works with graph layer

// Create a new label object
string strLabelName = "MyTextLabel";
// Need to use LabTalk to add a new label object
// Place some dummy text in label to begin with
string strCMD;
strCMD.Format("label -n %s dummy", strLabelName);
LT_execute(strCMD);
// Note: If label by that name already exists, the above just changes existing
// text value to "dummy"


// Declare graph object in OC using name of the label
GraphObject grobj;
grobj = gly.GraphObjects(strLabelName);

// Can now assign text value to label such as:
grobj.Text = "This is my text";
// Can use formatting in text string such as to make multiline label:
string strLabelText;
double dVal1 = 10.3, dVal2 = 0.035;
strLabelText.Format("Value 1 = \t%f\nValue 2 = \t%f", dVal1, dVal2);
grobj.Text = strLabelText;

// Can change other properties of label as well.
// To see properties, can get into tree and dump to script window
Tree tr;
tr = grobj.Label;
out_str("Label Properties:");
out_tree(tr);

// Once you know what properties are available, can set them:
grobj.Label.Font.Size.nVal = 30;
grobj.Label.Color.nVal = 1;
grobj.Label.Angle.nVal = 45;
grobj.Label.Dimension.Left.dVal = 0;
grobj.Label.Dimension.Top.dVal = 5;
}


Go to Top of Page

houwelingen

Switzerland
Posts

Posted - 03/23/2005 :  05:46:33 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Worked like a charm.....thanks
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