10-02-2008 03:35 PM
Hi,
I would like to display the x-channel name on a line-and-symbol type curve. I can't seem to figure out the freetext expression to use. @@ChnName(CCN)@@ gives me the y-channel name....
Thanks!
Julia
10-03-2008 12:19 PM
Hi Julia,
This is not built-in functionality in DIAdem 11.0 or earlier. The "CCN" variable refers solely to the Y channel, and the Y channel does not usually have any idea which X channel is the right match for it. The simplest solution would be to add a property to each Y channel or perhaps to the parent Group of that Y channel which stores the correct X channel information. The information about which X channel is being used in that particular curve is stored in that curve's global variables, but you have to reference the curve by it's curve index, and the Y channel doesn't know that either.
The process of adding the X channel infomation could be done in a VBScript that loops over all the curves of one or more graphs, looks up the X channel information stored in each curve, then adds that X channel information to a new property. So you can programmatically go get the X channel information in the graph, but there's no fool-proof way I know of to do it on-demand from an embedded @@Function(CCN)@@ expression, because the CCN variable doesn't help you find the X channel info. If by chance you happen to know in this specific application how to infer the X channel information from the Y channel name/index, then you could create a UserCommand that looks up the X channel information using this inference method, which would be then available from an embedded @@Function(CCN)@@ expression. But this is not always the case.
Here are other variables you could pass to a UserCommand that might help with your inferring:
@@CurrObjName@@ gives you the programming name of the Axis System (graph)
@@CurrAxisNo@@ gives you the Y Axis index that this curve is plotted on
@@CurrGroupIdx@@ gives you the Group index for that channel in the Data Portal
@@CurrChnIdx@@ gives you the Channel index within that Group in the Data Portal
So you could do something like this in your UserCommand: Loop through all the curves in the CurrObjName graph, check which ones match the Y Axis assignment from CurrAxisNo and which have a Y channel reference equal to CCN or CGI/CCI, then somehow break the tie if more than one curve satisfies all these criteria. Typically, though, the same Y channel will not be plotted against two different X channels in the same graph, so this is likely to be sufficient, though convoluted.
I can help with the curve looping if you need it,
Brad Turpin
DIAdem Product Support Engineer
National Instruments
10-03-2008 01:05 PM