DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Diadem Display X Channel Maximum in Legend

Hello,

 

I am plotting multiple curves on a 2D Axis System in Report, and want to show the maximum of each X-channel in the legend.

 

For the Y-channel, I am able to accomplish this by assigning the following to the legend column text (it works):

"@@Str(Data.GetChannel(CurrChnNo).Properties(""maximum"").Value, ""AutoAdj"")@@"

 

However, for the X-channel, I try to get the same result with the following (it doesn't work):

"@@Str(Data.GetChannel(""[@@CurrGroupIdx@@]/[@@CurrXChnIdx@@]"").Properties(""maximum"").Value, ""AutoAdj"")@@"

 

The logfile outputs the following error:

gborton_0-1687305799820.png

 

If I run the expressions shown in the error on their own within the script, I get a result. Not sure why it won't work in Report.

 

Any help would be appreciated!

0 Kudos
Message 1 of 5
(1,579 Views)

To access properties of the X channel in the legend of the layout, the variable CurrXChnReference can be used in the expression. With the following line, I could display the maximum of X in my REPORT layout, where the X channel is a numeric channel.

 

@@Str(Data.GetChannel(CurrXChnReference).Properties("Maximum").Value, "AutoAdj")@@

0 Kudos
Message 2 of 5
(1,558 Views)

Using CurrXChnReference shows the maximum value of the X-channel for only the last curve that I plot (and is applied to all other curves). CurrYChnReference does the same for the Y-channel.

0 Kudos
Message 3 of 5
(1,533 Views)

OK, I only had two curves that both used the same X channel, so I didn't notice the issue. For multiple curves with different X channels, CurrXChnReference does indeed not return the matching channel reference from the X channel. I was able to reproduce the behavior in very old versions as well. The variable should work in the legend in REPORT. I will create a bug for this to be fixed.

0 Kudos
Message 4 of 5
(1,516 Views)

There is a workaround to display the maximum of the X channel of the curve. This requires a user command, that is entered as an expression in the legend.

 

Steps:

1) The user command looks as follows. Please adapt the name of the axis system accordingly.

function GetXChannelMaximum(CurveIndex)
  GetXChannelMaximum = str(Data.GetChannel(Report.ActiveSheet.Objects("2DAxis1").Curves2D(CurveIndex).Shape.XChannel.Reference).Maximum, "AutoAdj")
end function

2) Save the script and register it in the User Commands dialog.

3) Select curve-related text in the legend and enter it as follows:

@@GetXChannelMaximum(1)@@
@@GetXChannelMaximum(2)@@

AnJalpaka_0-1687421730102.png

 

The parameter is the index of the curve in the curve list.

0 Kudos
Message 5 of 5
(1,491 Views)