DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

2D X axis Scaling on Reports

Solved!
Go to solution

HI,

My time data comes in using the system time from the computer and does not start at zero.  It is often starting at 3000 sec or 6240 sec, etc..

When I run my report I am constantly having to change the beginning and end times in order to capture the data.  I came up with a partial solution to my problem, but am still running into one issue.  Some of the report pages have 2 2Dgraphs on them, and others only have 1 2Dgraph.  With the solution I have found, I can change all the report pages that have 2 graphs, but as soon as I hit one that only has 1 graph it throws an error.  I'm sure that there is an IF statement I can use, but have been unable to get one to really work.

I have tried using ObjectNoMax and I have tried using "2DAxis1" instead of ("Area : 1"), but I still can't figure it out.  Can someone please help?

 

Dim intSheetNo

Call GraphSheetInfos() 'Puts the number of sheets in GraphSheetCount

 For intSheetNo = 4 To GraphSheetCount

   CallGraphSheetNGet(intSheetNo) 'Puts the sheet name in GraphSheetName

   CallGraphSheetShow(GraphSheetName) 'Shows the sheet in DIAdem REPORT

   CallGraphObjOpen("Area : 1")

   CallGraphObjOpen("Area : 1_XAxis1")

    D2AxisXBegin = ChnValMin(35)

    D2AxisXEnd = ChnValMax(35)

    D2AxisXOrigin = ChnValMin(35)

   CallGraphObjClose("Area : 1_XAxis1")

   CallGraphObjClose("Area : 1")

 

   CallGraphObjOpen("Area : 2")

   CallGraphObjOpen("Area : 2_XAxis1")

    D2AxisXBegin = ChnValMin(35)

        D2AxisXEnd = ChnValMax(35)

        D2AxisXOrigin = ChnValMin(35)

      CallGraphObjClose("Area : 2_XAxis1")

      CallGraphObjClose("Area : 2")

Next

Call PicUpdate(0) '... PicDoubleBuffer

0 Kudos
Message 1 of 6
(6,477 Views)

Hi 2Pale,

 

Let's start by seeing if the object name is the problem.  Try this approach with ReportObj(n) to programmatically use the nth object's name with the rest of you existing code unchanged:

 

  FOR n = 1 TO ObjectNoMax
    IF ReportObj(n) = "" THEN Exit For ' n
    Call GraphObjOpen(ReportObj(n))
: : :
Call GraphObjClose(ReportObj(n))
NEXT ' n

 

Brad Turpin

DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 6
(6,458 Views)

Hi 2Pale,

 

I just noticed that you are looping through REPORT sheets.  Make sure you use the GraphSheetRefSet() command to set the currently visible sheet to be the one addressed by all the Graph...() commands.  It's possible that your commands have been operating on other REPORT sheets than you have intented.

 

  Call GraphSheetInfos()
  Call GraphSheetNGet(GraphSheetCount)
  Call GraphSheetShow(GraphSheetName)
  Call GraphSheetRefSet(GraphSheetName)

Note, this got MUCH easier in DIAdem 2012 with the new Report object.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 3 of 6
(6,457 Views)

With this method, how do I open the 2D-Axis so that I can adjust the D2AxisXBegin?

 

If I leave the GraphObjOpen("Area : 1_Xaxis1") it only adjusts one graph per page and not both.

If I leave it out there is an error.

Anything else I have tried as the GraphObjectName just doesn't seem to work.

0 Kudos
Message 4 of 6
(6,417 Views)

Tried the following - 

 99      Dim intSheetNo, n

100     Call GraphSheetInfos()                'Puts the number of sheets in GraphSheetCount

101     For intSheetNo = 4 To GraphSheetCount

102     Call GraphSheetNGet(intSheetNo)     'Puts the sheet name in GraphSheetName

103     Call GraphSheetShow(GraphSheetName) 'Shows the sheet in DIAdem REPORT

104     Call GraphSheetRefSet(GraphSheetName)

105

106      FOR n = 1 TO ObjectNoMax

107     IF ReportObj(n) = "" THEN Exit For'

108 

109    Call GraphObjOpen(ReportObj(n))

110    Call GraphObjOpen(D2AxisXObj(n))

111    D2AxisXBegin        = ChnValMin(35)

112    D2AxisXEnd          = ChnValMax(35)

113    D2AxisXOrigin       = ChnValMin(35)

114    Call GraphObjClose(D2AxisXObj(n))

115

116    Call GraphObjClose(ReportObj(n)) 

117    NEXT 'n

118    Next

119

120     Call PicUpdate(0)                       '... PicDoubleBuffer  

 

When I got to sheet 8 of my report there was an error.  (That is the first page with only 1 graph on it)  "Empty string not valid as object name" for line 110.

 

***Looked at this closer - it did not change any of my xaxis begin and end points either" ****

 

 

So I tried adding a line after 107:

 

108    If D2AxisXObj (n) = "" Then Exit For

 

and now error is "Invalid variable access (D2AxisObj), Parent Object open?"

 

0 Kudos
Message 5 of 6
(6,412 Views)
Solution
Accepted by topic author 2Pale4TX

Success!!!  I finally got it to work.

 

Dim intSheetNo, n, p

Call GraphSheetInfos()                'Puts the number of sheets in GraphSheetCount

For intSheetNo = 4 To GraphSheetCount

 Call GraphSheetNGet(intSheetNo)     'Puts the sheet name in GraphSheetName

  Call GraphSheetShow(GraphSheetName) 'Shows the sheet in DIAdem REPORT

  Call GraphSheetRefSet(GraphSheetName)

 

   FOR n = 1 TO ObjectNoMax

 

    IF ReportObj(n) = "" THEN Exit For'

p=reportobj(n)

    Call GraphObjOpen(p)

 

call graphobjopen(D2AxisXObj(1))

    D2AxisXBegin        = ChnValMin(35)

    D2AxisXEnd          = ChnValMax(35)

    D2AxisXOrigin       = ChnValMin(35)

call graphobjclose(D2AxisXObj(1))

 

    Call GraphObjClose(p) 

    

   NEXT 'n

Next

 

Call PicUpdate(0)                       '... PicDoubleBuffer     

0 Kudos
Message 6 of 6
(6,403 Views)