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
 OriginC change axis tick label style

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
michaelbraun Posted - 07/08/2015 : 12:11:39 PM
Origin Ver. and Service Release (Select Help-->About Origin): Origin 2015 sr2
Operating System: Windows 7 and 10

I am trying to use the code builder to import data and graph on a log-linear graph. However, I cannot find how to programmatically change the y-axis (log) tick label display type. By default it is decimal, which gives y-axis values of 100, 1000, 10000, 100000, 1000000, 1E7, however I would like to switch it to scientific to get nicer labels. Thank you.
5   L A T E S T    R E P L I E S    (Newest First)
michaelbraun Posted - 07/09/2015 : 10:50:27 AM
Worked great, thank you!
Castiel Posted - 07/09/2015 : 10:39:21 AM
quote:
Originally posted by michaelbraun

Worked well, I have another question though. I am trying to use OC code to get rid of the legend, looking at the output of the tree, it looks like just adding the line

trFormat.Root.Legend.Show.nVal = 0;

should get rid of the legend. However when I add this line (to otherwise working code) I get a number of compiling errors:
:Error, General Error ( ) contact TD.
:Error, Variable "tr.Root.Legend.Show.nVal" not declared
:Error, general compile error
:Error, general compile error
:Error, error(s) found in compiling function ImportWAXRD



Show is a treenode attribute. Have a try of the following:
trFormat.Root.Legend.GetNode("Show").nVal = 0;


©c¡Ï   ¤È¥¹  ©f¨u©c  ©c¥ì    ¥Î¤³  ©c/     ©¦£¯
 ©c¨Ê¥Î ¤´¥¨  ¥ó ¨×   ¥ó¤á' ¥Ì©¦¥­   /¤í  ¥Õ©¦©f
   ¨Ö             ¦á          ©¦£þ  ©` ¥Õ   ©¦
                              ©¦
michaelbraun Posted - 07/09/2015 : 09:46:09 AM
Worked well, I have another question though. I am trying to use OC code to get rid of the legend, looking at the output of the tree, it looks like just adding the line

trFormat.Root.Legend.Show.nVal = 0;

should get rid of the legend. However when I add this line (to otherwise working code) I get a number of compiling errors:
:Error, General Error ( ) contact TD.
:Error, Variable "tr.Root.Legend.Show.nVal" not declared
:Error, general compile error
:Error, general compile error
:Error, error(s) found in compiling function ImportWAXRD
SeanMao Posted - 07/08/2015 : 10:04:11 PM
Hi,

The OC code to realize it is as following:

void OriginObject_SetFormat_Ex1()
{
GraphLayer gl = Project.ActiveLayer();

// Get all objects' all properties of GraphLayer into Tree
Tree trFormat;
trFormat = gl.GetFormat(FPB_ALL , FOB_ALL, TRUE, TRUE);
out_tree(trFormat); // output format tree

trFormat.Root.Axes.Y.Scale.Type.nVal = 1; // Set Y Axis Type to be Log10
trFormat.Root.Axes.Y.Scale.Rescale.nVal = 2; // Set Rescale to be Auto
trFormat.Root.Axes.Y.Labels.LeftLabels.NumericFormat.nVal = 1; // Scientific Notation

// Apply all format
int nErr = gl.UpdateThemeIDs( trFormat.Root ) ;
if(0 != nErr)
out_str("Fail to Update Theme IDs, theme tree has wrong structure");
gl.ApplyFormat( trFormat, true, true, true );
}

Give it a try and see how it goes!

Regards!

Sean

OriginLab Tech. Service
michaelbraun Posted - 07/08/2015 : 12:54:44 PM
A simple solution (may not be the best practice, as it plugs in a labtalk script):

LT_execute("layer.y.labelSubtype=2");

where the 2 is for scientific, which can be replaced with 1 for decimal, 3 for engineering (1K), and 4 for decimal (1,000).

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