T O P I C R E V I E W |
Bladilu |
Posted - 10/27/2010 : 10:54:54 AM Origin Ver.8.1 and Service Release SR 1 Operating System:Win XP
Hi , iam having a problem plotting a second y graph into layer 2 . My script looks like that : plotxy iy:=[Book2]Sheet1!(1,12) plot:=202 ogl:=2; But iam always getting this one : Failed to resolve range string, VarName = iy, VarValue = [Book2]Sheet1!(1,12)
Dont know whats wrong with the Range?
Column 1 is my X-Axis with time and Col 12 is my Temperature ,which one i want to have in the same Graph ,but with a different scale.
My Intention is to execute a Script at the end of the Importassistant which plots a double YY Graph into a Graphtemplate after the Import.
Hope you can undertand my bad english ;)
Regards Bladilu |
5 L A T E S T R E P L I E S (Newest First) |
greg |
Posted - 10/28/2010 : 4:07:15 PM Before you create your graph, you can grab the book and or sheet name in a string:
// a Book is a page object and a sheet is a layer object string str$ = %(page.name$)-%(layer.name$);
After you create your graph, you can rename it: window -rename %H %(str$);
The layer -a command only rescales the active layer. You could issue the command twice as in: // BEGIN SCRIPT plotxy (?,10:11) plot:=192 ogl:=[<new template:=shmgraphkor>]; rescale; plotxy iy:=ry plot:=192 ogl:=2; rescale; // END SCRIPT or, you could modify the graph template to auto scale: Select Format : Axes : X Axis to open Axis dialog On the Scale tab, set Rescale to 'Auto' Repeat for the Y scale Repeat both with the second layer Resave the template and 'layer -a' will not be needed. |
Bladilu |
Posted - 10/28/2010 : 06:03:39 AM EDIT :
Thats you both !The Problem was the Hard Coding of the Bookname . I used the script of easwar and now the script works . This is how it looks like:
col(a) = col(a)*30*21,93; range ry=[%(page.name$)](%(layer.name$))!(1,12); plotxy (?,10:11) plot:=192 ogl:=[<new template:=shmgraphkor>]; plotxy iy:=ry plot:=192 ogl:=2; rescale;
Now it would be nice to rename the plotted graphs by the name of the appertaining Book or Worksheet .How to do that?
And another question : My rescale only works for the last printed Graph . When iam importing 5 Datasets+Graphs with this filter ,only the last Graph is scaled.
Thanks Bladilu |
Bladilu |
Posted - 10/28/2010 : 05:35:12 AM Hi Guys ,
thanks for the quick answers! Ill try this out and give you feedback soon.
Bladilu |
easwar |
Posted - 10/27/2010 : 2:38:55 PM Hi Bladilu,
If you are indeed importing a new file using Import Wizard (assistant) with a graph page active, and want to refer to the book/sheet/columns where the newly imported data goes into, then in your script section on the last page of the assistant, you can use this syntax:range ry=[%(page.name$)](%(layer.name$))!(1,12);
This will then define the range properly and does not have the risk of hard coding the book name, which can fail if other books exist in project with same name etc.
When the script runs, even though the graph is active, the active page at that point is the data book into which the data was just imported.
If this is not you want, then provide more details, or send your opj and your filter to tech support.
Easwar OriginLab [/quote] |
greg |
Posted - 10/27/2010 : 11:26:40 AM Your code worked fine here when I had a two layer graph active and I had a book named Book2 with at least 12 columns. By hard coding Book2 you have to make sure your import does not rename it. It isn't at all clear what the real sequence of events is, but here is an example of a script which imporst a file then plots a double-y plot: dlgfile gr:=*.dat; // Prompt for file impasc; // Import range r1 = 2; // Column 2 range r2 = 3; // Column 3 win -t plot doubley; // Load DoubleY template plotxy iy:=r1 ogl:=1 plot:=200; // Plot column 2 into layer1 (Line) plotxy iy:=r2 ogl:=2 plot:=202; // and col 3 into layer2 (line+symbol)
|
|
|