01-28-2014 05:06 PM
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?
01-29-2014 11:46 AM
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
01-29-2014 12:32 PM
Brad,
I am using 2012.
~Benjamin
01-31-2014 04:54 AM - edited 01-31-2014 04:55 AM
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@@"
01-31-2014 12:35 PM
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