Author |
Topic |
|
michaelbraun
USA
21 Posts |
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. |
|
michaelbraun
USA
21 Posts |
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). |
|
|
SeanMao
China
288 Posts |
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
USA
21 Posts |
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
|
|
|
Castiel
343 Posts |
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;
妾+ 午旦 妹罕妾 妾伊 用仇 妾/ 岫ㄞ
妾京用 仍巨 件 侈 件戶' 甘岫平 /欠 白岫妹
併 艮 岫 奈 白 岫
岫 |
|
|
michaelbraun
USA
21 Posts |
Posted - 07/09/2015 : 10:50:27 AM
|
Worked great, thank you! |
|
|
|
Topic |
|
|
|