ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Controlling Report Legend with Script

Solved!
Go to solution

I've using the curve related text option of the Legend in my report. Is there a way to modify this with a script?

0 Kudos
Message 1 of 4
(3,300 Views)
Solution
Accepted by topic author TamerZero

Hi TammerDTS,

 

These properties are part of the curve settings:

dim oCurves
set oCurves = Report.Sheets(1).Objects("2D-Axis1").Curves2D
oCurves(1).RelatedLegendText(1)  = "atest"
oCurves(2).RelatedLegendText(1)  = "btest"

Greetings

Walter

 

0 Kudos
Message 2 of 4
(3,271 Views)

Thanks again Walter, works great. I had a little trouble trying to figure out what the 2D axis system was named, but I figured it out by deleting it, then the confirmation message told me the name.

0 Kudos
Message 3 of 4
(3,263 Views)

In case it helps anyone, I created a loop to modify multiple channels on all my sheets.

Option Explicit
Dim oCurves, iLoop

For iLoop = 2 to 27
	Set oCurves = Report.Sheets(iLoop).Objects(1).Curves2D
	oCurves(1).RelatedLegendText(1)  = "Channel 1"
	oCurves(4).RelatedLegendText(1)  = "Channel 4"
	oCurves(7).RelatedLegendText(1)  = "Channel 7"
	oCurves(10).RelatedLegendText(1)  = "Channel 10"
Next
0 Kudos
Message 4 of 4
(3,258 Views)