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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 set axis tick labels from dataset programmatically

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
adickson Posted - 08/30/2011 : 4:36:57 PM
OriginPro 8.5.1 SR2
Mac OSX 10.6.8

I would like to be able to programmatically use a dataset for my axis tick labels.

It looks like I should be able to use this to select the "text from dataset" option for the x axis:
tr.Root.Labels.BottomLabels.Type.nVal = 1;

but where/how do I specify the actual dataset to use?

thanks,
andrea
3   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 09/06/2011 : 10:27:51 PM
Hi andrea,

Yes, you can use the format bookname_colname@sheetnum. There is no detail document on this because this usage is old, and you can refer to this example. I am very sorry showing you this. Actually, you can use the range directly. For example:

range rr = [Book2]risetime!C;
layer.x.label.dataset$ = rr;


Penn
adickson Posted - 09/06/2011 : 10:29:08 AM
that worked great! thanks.

for others that are trying this - i couldn't find much documentation on the "internal name" that you need to use when specifying the dataset (especially if you have multiple sheets in the book). i was able to access it using a labtalk script:
range rr = "[Book2]risetime!C";
nameof(rr)$=

Book2_C@12

and the format it uses is: bookname_colname@sheetnum
in originc you can get the sheet number to use by calling
wks.GetIndex() + 1

if someone knows of a link with more info about internal names, can you please post it?

thanks!
andrea
Penn Posted - 08/30/2011 : 11:35:11 PM
Hi andrea,

It seems that such option for Origin C is not exposed yet. For now, you can use the LT_execute to call some LabTalk to do that. For example:

void testTicks() {
	GraphLayer gl = Project.ActiveLayer();  // the active graph layer
	string strLTCmd;
	strLTCmd = "layer.x.label.Type = 2;";  // set tick labels from dataset
	strLTCmd += "layer.x.label.dataset$ = Book1_C;";  // set column C in Book1 as tick labels
	gl.LT_execute(strLTCmd);  // execute LabTalk script
}

You can get more information here about layer.axis.label object.

Penn

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000