DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

change report legend label waveform name

I am automatically generating a report using VBScript. Everything works OK, except the legend label for one of my waveforms. For one waveform I want to use the channel group name instead of the channel name. For the other one, I want the channel name, which is what it seems to use by default.

 

How do I change the waveform name displayed in the legend using VBScript?

0 Kudos
Message 1 of 5
(6,902 Views)

Hi Jo-Jo,

 

If you know beforehand which channel should show the Group name and which channel should show a different property, you can configure that manually in the legend dialog and save the result to the *.TDR file.  It is also possible to make those tweaks after loading the *.TDR file with VBScript commands.  These VBScript commands changed (improved) dramatically in DIAdem 2012, so let me first ask you what version of DIAdem you're using.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 2 of 5
(6,871 Views)

Brad,

 

I am using 2012.

 

~Benjamin

0 Kudos
Message 3 of 5
(6,869 Views)

Use the related text option for the column legend (eLegendTextCurveRelatedText), and then you can customize the name in the legend for each of the ploted curves curve.

 

' Add the plot 
Set Plot = Report.ActiveSheet.Objects.Add(eReportObject2DAxisSystem,"Plot2d")
' Set the ithColumn of the of the legend to -> related curve text
Plot.CurveLegend.Columns(ithColumn).Type=eLegendTextCurveRelatedText
' Set the related text in each of the curves for the ithColumn
Plot.Curves2D.Item(1).RelatedLegendText(ithColumn) = "@@Data.GetChannel(CurrChnNo).Name@@"
Plot.Curves2D.Item(2).RelatedLegendText(ithColumn) = "@@Data.GetChannel(CurrChnNo).ChannelGroup.Name@@"

 

0 Kudos
Message 4 of 5
(6,845 Views)

Hi Benjamin,

 

The curve-related legend expressions are not stored in the Legend object, they're stored in each of the curves, like this:

 

Set Sheet = Report.ActiveSheet
Set Graph = Sheet.Objects("2DAxis1")
Set Legend = Graph.CurveLegend
Legend.Columns(1).Type = eLegendTextCurveRelatedText
Graph.Curves2D(1).RelatedLegendText(1) = "@@ChnName(CCN)@@"
Graph.Curves2D(2).RelatedLegendText(1) = "@@GroupName(CGI)@@"
Graph.Curves2D(3).RelatedLegendText(1) = "@@ChnComment(CCN)@@"
Call Report.Refresh

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 5 of 5
(6,833 Views)