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;
}