06-11-2021 08:45 AM
Hi All,
I'm currently working on a report generation for my project(Amplifier Testing). I want to plot multiple channels in a single plot in a Diadem Report by vb scripting. ie, I have actual voltage channel data, Upper tolerance, lower tolerance etc. I want all these channels to be plotted in a single graph in Diadem Report. I have used below statements.
Set oMy2DCurve1 = oMy2DaxisSystem.Curves2D.Add(e2DShapeLine, "MyNew2DCurve")
oMy2DCurve1.Shape.XChannel.Reference = "[1]/[30]"
oMy2DCurve1.Shape.YChannel.Reference = "[1]/[11]"
In VIEW tab, I'm able to do this by repeating below statements.
Set oMyChart = View.ActiveSheet.ActiveArea.DisplayObj
Set oMyCurve = oMyChart.Curves2D.Add("[1]/[28]","[1]/[13]")
Set oMyCurve = oMyChart.Curves2D.Add("[1]/[28]","[1]/[15]")
Set oMyCurve = oMyChart.Curves2D.Add("[1]/[28]","[1]/[17]")
I believe, we can add only one Y channel reference in Graph in Diadem Report. Is there any workaround for this?
06-17-2021 01:41 PM - edited 06-17-2021 01:42 PM
Hi Rishi,
You can programmatically add up to 250 curves in a REPORT graph (last I checked), and each curve can have an Xchannel and a Ychannel or just a Ychannel, as you wish. Here's an example of what I think you're describing.
' Loading data set and REPORT layout to match your scenario
DataFilePath = "C:\Users\Public\Documents\National Instruments\DIAdem 2020\Data\Example.tdm"
Call Data.Root.Clear()
Call DataFileLoad(DataFilePath, "TDM")
LayoutFilePath = "C:\Program Files\National Instruments\DIAdem 2021\Libr\Documents\EXAMPLE.TDR"
Call Report.LoadLayout(LayoutFilePath)
' Adding all the channels in the 1st Group as curves
Set Channels = Data.Root.ChannelGroups(1).Channels
Set Sheet = Report.ActiveSheet
Set Graph = Sheet.Objects("2DAxis1")
Call Graph.Curves2D.RemoveAll()
jMax = Channels.Count
ReDim Curves(jMax-1)
FOR j = 1 TO jMax-1
Set Curves(j) = Graph.Curves2D.Add(e2DShapeLine, "Curve" & j)
Curves(j).Shape.XChannel.Reference = Channels(1).GetReference(eReferenceIndexName)
Curves(j).Shape.YChannel.Reference = Channels(j+1).GetReference(eReferenceIndexName)
NEXT ' j
Call Report.Refresh()
Brad Turpin
Principal Technical Support Engineer
NI