DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying x-channel name as curve label text

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

0 Kudos
Message 1 of 3
(3,730 Views)

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

0 Kudos
Message 2 of 3
(3,719 Views)
Actually, I have approximately 20 curves, all with the same y-channel, and 20 different x-channels.  It is a custom data file, so I am wondering if it would be better to just transpose the data upon loading, and display a typical 2D graph (one x-channel, many y's).  I might try this.
0 Kudos
Message 3 of 3
(3,715 Views)