From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

2D Plot Channel Names

Solved!
Go to solution

Oups sorry, I missed that info... My bad !

I'll try to figure out something else then 🙂

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 11 of 17
(846 Views)

I'm still struggling with this, can anyone help?

0 Kudos
Message 12 of 17
(826 Views)

Have you explored using the GraphObjChnNameGet command? It looks like this should return the name of an object in a report, being a curve in your case.You may be able to loop through the curves in your report to see if the specific one you're looking for already exists, then add the channel maximum from there

Alex C.
Applications Engineering
National Instruments
0 Kudos
Message 13 of 17
(813 Views)

Some editing is still needed but that should be a good starting point.

CLAMaxime -- Kudos are a great way to say thank you
0 Kudos
Message 14 of 17
(809 Views)

Can you paste the code into a reply?

0 Kudos
Message 15 of 17
(801 Views)
Solution
Accepted by topic author BrianCT

Sorry, forgot you could not download anything...

 

'-------------------------------------------------------------------------------
'-- VBS script file
'-- Created on 05/09/2018 13:37:04
'-- Author: 
'-- Comment: 
'-------------------------------------------------------------------------------
Option Explicit  'Forces the explicit declaration of all the variables in a script.

Data.Root.Clear
Call DataFileLoad(CurrentScriptPath & "EXAMPLE.TDM")

Call REPORT.LoadLayout(CurrentScriptPath & "EXAMPLE.TDR")

Dim oSheet : Set oSheet = REPORT.Sheets("Test")
Dim oChart : Set oChart = oSheet.Objects("Chart")
Dim oCurves : Set oCurves = oChart.Curves2D
Dim oChannels : Set oChannels = Data.Root.ActiveChannelGroup.Channels

Dim channel, oMyCurve, count, curve, name

count = 1
For Each channel In oChannels

  For Each curve In oCurves
    name = split(curve.Shape.YChannel.Reference, "/")
    If(name(1) = channel.Name) Then
      Set oMyCurve = oCurves.Add(e2DShapeLine, "New" & count)
      oMyCurve.Shape.XChannel.Reference = "[1]/Time"
      oMyCurve.Shape.YChannel.Reference = "[1]/" & channel.Name & "_Mean"
    End If
  Next

  count = count + 1
Next
CLAMaxime -- Kudos are a great way to say thank you
Message 16 of 17
(798 Views)

Thanks for your help, works great!

0 Kudos
Message 17 of 17
(770 Views)