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
 LabTalk Forum
 Inserting the title of a graph and other things
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

DrMorbid

United Kingdom
14 Posts

Posted - 08/26/2014 :  1:56:31 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,

I cannot find anywhere (incl. the Labtalk manual) any information about how to insert a title just above the curves on the graphs I generate. I would like to simply place a name that follows the graph's long name. If not possible, then maybe insert a textbox somehow?

Also, is there any way of applying a theme for a graph via Labtalk and removing the legend?

Thank you!

greg

USA
1378 Posts

Posted - 08/27/2014 :  11:45:53 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Text can be added anywhere on your graph using the Text tool or right-click context menu.

The right-click context menu also has an option to "Add/Modify Layer Title" which edits a text object that sits on the top-center of a layer.

I am not sure what you mean by "follows the graph's long name". If you are referring to the graph window, then text like this:
%(page.label$) with substitution level of 1 (See Programming Control) will show the page Long Name or nothing if there is none.

Themes can only add properties, they cannot remove objects.

It's unfortunate, but some of our code generates the legend even if you save a template with no legend. You have to actually modify our code to correct this.

For example:
Create a Symbol : Scatter plot
Delete the Legend
Save the Template as Scatter
Plot again
==> The legend is back

Now, go back to the worksheet, select a Y column, hold down the Shift and Ctrl key and choose Plot : Symbol : Scatter.
That will open our Code Builder to a line in PLOT.OGS:
run.section(,general,201 Scatter 0);
(or similar for other plot types.)
That executes a call to the [General] section whcih can be found several lines above.

You should see some code like:
worksheet -P %1 %2;
Legend;
return 0;
which you can change to:
worksheet -P %1 %2;
// Legend;
return 0;
Press Ctrl+S to save the file.
Now create another Scatter graph and no legend will be generated.
Go to Top of Page

DrMorbid

United Kingdom
14 Posts

Posted - 08/27/2014 :  6:13:26 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you Greg for replying, this is really helpful!

The "add/modify layer title" tool is exactly what I need to solve my first problem. Following your suggestions, I have found that I can use the label command to place text onto the graph:

page.longname$ = %(1,@WL);
page.longname$.TrimRight(". x l s");
label -j 1 -p 50 0 -s %(page.longname$)

However, I cannot use negative % values, would just need the label to be a bit higher from the centre of the graph. Also, the TrimRight function for some reason does not work for me, I would love to trim the file extension.

Thank you again! The advice with the legend is so simple!

Edited by - DrMorbid on 08/28/2014 06:26:01 AM
Go to Top of Page

greg

USA
1378 Posts

Posted - 08/28/2014 :  09:44:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
longname is a property, not an object so it does not support any dot methods.
You can use negative values, but since "-" is an option switch flag, you should protect your negative values with parentheses.

str$ = %(1,@WL);
str.trimright(".xls");
page.longname$ = str$;
label -j 1 -p 50 (-10) -s %(str$);

Go to Top of Page

DrMorbid

United Kingdom
14 Posts

Posted - 08/28/2014 :  09:47:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank you very much, this has worked! Much appreciated Greg.
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