Author |
Topic |
|
Force
Denmark
9 Posts |
Posted - 06/13/2014 : 10:30:06 AM
|
Origin Ver. and Service Release (Select Help-->About Origin): Operating System: win7 OriginPro 9.1
Hi,
I have 2 questions that I hope someone can help me with: 1) I have some problems generating a XY-graph and a multi-curve stack graph when I run my script. I import several data files into one workbook - each data file in separate sheets. Then I want to plot data from all sheets on one graph. I can make my XY-graph work but when I try to generate a second graph - a multi-curve stack graph I get one graph per set of data. I want to plot them all on one multi-curve stack graph. But how?
2) How do I set the color on each individual curve in my two graphs and get the "layer.axis.label.timeFormat" to work?
I have made the following script:
dlgfile gr:=*.txt mu:=1; //select files to import string file$; newbook; %A = %H; //remember book loop(ii,1,fname.GetNumTokens(CRLF)) {
file$ = fname.GetToken(ii,CRLF)$; //find file
impasc fname:=file$ //import file options.ImpMode:=4 //new sheet for each import options.Names.FNameToBk:=0; //dont rename book window -a %A; wks.col2.type= 4; //set col(2) to X
wks.nCols = wks.nCols + 3; //Add 3 more columns wks.col2.format = 3; //Time = 3 wks.col2.subformat = 3; //hh:mm:ss wks.col14.format = 1; //Numeric = 1 wks.col15.format = 1; //Numeric = 1 wks.col16.format = 1; //Numeric = 1 wks.col14.subformat = 4; //Display as Decimal: 1,000 wks.col15.subformat = 4; //Display as Decimal: 1,000 wks.col16.subformat = 4; //Display as Decimal: 1,000 col(14)=col(11)-col(12); col(15)=col(9)*10; %A!wks.col14.label$= "delta NOx"; //Naming col14
range rWb = %A!; %B = page.active$; plotxy [%A]%B!(2,14) plot:=200 //plot as line ogl:=[%K]1! //plot to the same graph layer 1 legend:=0 //don't plot the legend color:=color(255,0,255); //define RGB color plotstack [%A]%B!((2,3), (2,4)) plottype:=line portrait:=landscape; // ogl:=[%K]1! // plot to the same graph layer 1 // layer.axis.label.timeFormat=3,3;
} save %yMovia-vv
/Frantz
|
|
lkb0221
China
497 Posts |
Posted - 06/16/2014 : 1:58:33 PM
|
Hi, Force
1). You want a multi-panel stacked graph or a multi-curve graph with offset? You may want try to use this X-Function: http://www.originlab.com/doc/X-Function/ref/plotstack
2). For example: layer.x.label.type = 3; // Set X axis label display as Time layer.x.label.timeFormat = 3; // Set label as the 3rd in the drag-down list, which is HH:mm:ss
Zheng OriginLab |
|
|
Force
Denmark
9 Posts |
Posted - 06/17/2014 : 03:47:00 AM
|
Hi Ikb0221,
Thank you for responding so fast. I would like to a plot stack graph with data from ex. 3 different worksheets (without specifying the name of each worksheet as they will change next time I run the script).
I have used the following:
plotstack [%A]%B!((2,3), (2,4)) plottype:=line ogl:=[%K]1! portrait:=landscape; layer.x.label.type = 3; layer.x.label.timeFormat = 3;
It seems like I cant make the ogl:=[%K]1! work the same way as I can when I try plotxy (see below).
plotxy [%A]%B!(2,14) plot:=200 ogl:=[%K]1! legend:=0; layer.x.label.type = 3; layer.x.label.timeFormat = 3;
Actually When I try to add both type of graphs in the same script suddenly the plotxy will not generate a single graph with data from the different worksheets. Instead a number of graphs are generated corresponding to the number of different worksheets. I will really appreciate if you or someone show me how to solve this.
/Frantz
|
|
|
|
Topic |
|
|
|