T O P I C R E V I E W |
eprlab |
Posted - 05/05/2003 : 5:39:29 PM Hello,
I want to display labels on a graph, the way the built-in functions display the "fit" values. My program generates some values and I want to be able to display them next to the graph.
I have tried a number of things without success.
EPR |
3 L A T E S T R E P L I E S (Newest First) |
Mike Buess |
Posted - 05/06/2003 : 4:44:29 PM I didn't realize you were doing this in Origin C. Try this...
int init=5; string ltm; ltm.Format("label -s -n MyLabel \"peak position: $(%d)\";",init);
Notice that two of the quotes are preceded by backslashes (\") to keep the string from ending prematurely.
...In fact you don't need the $() notation in Origin C. This should also work.
int init=5; string ltm; ltm.Format("label -s -n MyLabel \"peak position: %d\";",init); Mike Buess
Origin WebRing Member
Edited by - Mike Buess on 05/06/2003 4:49:46 PM |
eprlab |
Posted - 05/06/2003 : 3:29:47 PM Thank you for your response, but I am still not able to get correct the result. Here is what I am doing:
string ltm; int init; init = 5; ltm = "%S=peak position: $(init);" "label -s -n MyLabel %S;"; LT_execute(ltm);
The label is displayed on the graph as follows:
peak position: --
i.e. The value is not substituted, but instead 2 dashes are shown.
What am I doing wrong? |
Mike Buess |
Posted - 05/05/2003 : 7:40:57 PM Use the "label" command. Say your program generates the peak parameters "offset" and "fwhm", both of which are in units of Hz. To make your label you need the convert offset and fwhm to strings using $(offset) and $(fwhm) like this...
%S="peak position: $(offset) Hz peak width: $(fwhm) Hz"; // this defines a 2-line string variable label -s -n MyLabel %S; // create a label called MyLabel and fill it with the string
If offset=2.5 and fwhm=0.125 your label will look like this...
peak position: 2.5 Hz peak width: 0.125 Hz
There are also a number of "label" command arguments for positioning the label. See LabTalk help for details.
Mike Buess Origin WebRing Member |