Author |
Topic |
|
LIMHP
France
Posts |
Posted - 11/22/2005 : 11:45:17 AM
|
Origin Version (Select Help-->About Origin): 7.5 Operating System: Windows XP
Hello, I am trying to create moveable labels to attach to axes (both X and Y) for a set of graphs. This set of graphs is controlled by one worksheet, and the graphs depend on some parameters (alpha, beta, gamma). These parameters are available in the worksheet. What I would like to achieve are specific labels added to several places along the X- and Y- axes, according to some functions of (alpha, beta, gamma). The Custom label menu only provides the possibility for one label, defined by the user at a specified location, but I cannot get this location to be a function of worksheet data. Another idea was to create text or graphic boxes and to add those to the graphs, using the 'Scale' function to have them at a particular location, but once again I could not get this location to be dependent on worksheet data. Lastly, maybe a script could do the trick, but I have no experience in such scripting and would thus be looking for example of scripts either adding labels to axes or positioning text boxes onto a graph. Thanks for any help anybody could provide, AM. |
|
Mike Buess
USA
3037 Posts |
Posted - 11/22/2005 : 2:58:25 PM
|
I'll go with your last approach. Assume your alpha, beta and gamma values are in column C and you want to add a label along the left Y axis at Y=alpha (row 1). Run this script while the graph is active...
%W = %[%C,'_']; // get wks name from active dataset name yy = %W_C[1]; // value in col C, row 1 %Z = $(yy); // label text (yy as string) %B = label1; // label name label -s -n %B %Z; // create text label %B.y = yy; // center label at Y=yy %B.x = X1; // center label at left Y axis (X=X1) %B.x -= %B.dx/2; // offset by half the label width %B.x -= (X2-X1)/100; // offset by additional 1% of X range (adjust to suit)
You can create and position multiple text labels by giving each a unique name. For example, this will create labels from rows 1, 2 and 3 of column C.
%W = %[%C,'_']; loop (i,1,3) { yy = %W_C[i]; %B = label$(i); label -s -n %B $(yy); %B.y = yy; %B.x = X1; %B.x -= %B.dx/2; %B.x -= (X2-X1)/100; };
Once you know a label's name you can adjust other properties such as font size and color. See your programming guide for details...
LabTalk Language Reference > Object Reference > Internal Object Overview > User-created Visual Objects
Mike Buess Origin WebRing Member |
|
|
|
Topic |
|
|
|