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
 Origin Forum
 How to copy wks label onto plot?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

gutts

USA
Posts

Posted - 01/09/2005 :  05:33:05 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi there

Does anybody know how to copy the relevant worksheet label onto a plot and some how have it automated so that it does it everytime you plot? I tried using the %Z=page.label$ in my curve fitting after script so that all this text inlcuding the worksheet label name shows up everytime I do a fit. So far it doesn't work. Any suggestion would be greatly appreciated.

Thanks

Mike Buess

USA
3037 Posts

Posted - 01/09/2005 :  10:52:43 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You're probably getting the label of the graph rather than worksheet window. Try this...

%W=nlsf.fitdata$;
%W=%[%W,'_']; // name of wks containing the fitted dataset
%Z=%W!page.label$;
// if the last statement doesn't work try next statement instead...
// win -o %W {%Z=page.label$};

...If you are creating a text label in which to display %Z don't forget to use the -s (and possibly -sa) options that allow the use of string variables in text labels.

label -s -sa %Z;

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/09/2005 11:01:47 AM
Go to Top of Page

gutts

USA
Posts

Posted - 01/12/2005 :  02:18:54 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Mike. That seemed to do it.
Go to Top of Page

gutts

USA
Posts

Posted - 01/15/2005 :  04:16:55 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Mike

What's the easiest way to add the worksheet label to your plot everytime you plot without having to go to type %Z=page.label$ then %Z on the plot then link variables?

I tried to run the %Z=page.label$ command everytime I import data so in theory if I simply type %Z and link variables on my plot it should work right? Well, it does work except instead of my worksheet label, it shows me the graph label. I can't seem to get around this problem no matter what I try. Please help...

And thanks again for all your help last time.
Go to Top of Page

gutts

USA
Posts

Posted - 01/15/2005 :  04:31:08 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I also noticed that the sequence at which I run the command %Z=page.label$; determines whether the plot will display the worksheet label or graph label.

This works:

1) Plot data
2) click back to worksheet and run the script %Z=page.label$
3) add text %Z on plot and link variable

Any other sequence doesn't work. And when I save the above as a template, it resorts back to the plot label when I graph using a template. Why?
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 01/15/2005 :  08:43:30 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
page.label$ gives the label of the active window... when the graph is active that's the graph label. My original answer ensured that you were getting the worksheet label in a fitting session. You still haven't said what version of Origin you're using so I'll give you an easy method for labelling your graphs that works in all versions.

1. Select your custom text label and choose Format->Label Control...
2. Check "Link to variables" (sounds like you've already done that).
3. From the Script, Run After drop-down list select "Redrawn".
4. In the Script edit box type this...

if(%C=="") %Z="no data";
else win -o %[%C,'_'] {%Z=page.label$};

5. Close the Label Control dialog with OK and save the template.

The variable %C always names the active dataset/dataplot (e.g. Data1_B) so %[%C,'_'] gives the name of the worksheet (Data1) that contains that dataset. The command

win -o WindowName { script };

activates the named window just long enough to run the bracketed script. When a dataset is plotted your text label will display the worksheet label. When nothing is plotted it will display "no data". The text label should refresh automatically but you can force it with Origin's Refresh button.

...The string variable %Z is used by many operations so your label text might change spontaneously. For example, set up your graph with the worksheet name properly displayed, enter the command lay -c in the script window and notice the change in the label text when you click the Refresh button. You can avoid such spontaneous changes by using a less common string variable, such as %L, instead of %Z.

...Here's an even better way to avoid spontaneous relabelling. Change the label control script to the following:

if(%C=="") %L="no data";
else win -o %[%C,'_'] {%L=page.label$};
this.text$=%L;

Then uncheck the "Link to variables" option and close with OK. Finally, click Refresh and save the template.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 01/15/2005 09:09:06 AM

Edited by - Mike Buess on 01/15/2005 10:09:18 AM
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