DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Manually setting the y-axis scaling from a script file for two or more y-axes

Solved!
Go to solution

Hello everyone,

 

I have been using Diadem for only a few days now so I appologize if this is something really easy to do, but I just cannot figure it out. I am trying to manually set the 'End' value for the y-axis scaling of a plot in a 'Report'. I figured out how to set this value for one of the y-axes using the following commands:

 

Dim oMy2DYAxis

 

Set oMy2DYAxis = Report.ActiveSheet.Objects.Item("2DAxis1").YAxis

oMy2DYAxis.Scaling.End = <Desired Value>

 

However, I cannot figure out how to do the same thing but for the second y-axis that I have on the right side of the plot. I am sure it must be possible to do this for each y-axis, but how can it be done?

 

And for extra credit! How would I be able to do this for a sheet in the report other than the 'ActiveSheet'? Is there something similar to 'Report.Sheet("Page 1"). ...' which could be used as opposed to 'Report.ActiveSheet. ...'?

 

Thank you!

-Simeon

0 Kudos
Message 1 of 4
(4,378 Views)
Solution
Accepted by Siliev

Hi  Siliev,

 

Here is an example:

 

dim oCurrSheet, iLoop
set oCurrSheet = Report.ActiveSheet.Objects("2D-Axis1")

for iLoop = 1 to oCurrSheet.YAxisList.Count
  msgbox "Axis Y" & iLoop & vbCRLF & _
         "Begin: " & oCurrSheet.YAxisList(iLoop).Scaling.Begin & vbCRLF & _
         "End: " & oCurrSheet.YAxisList(iLoop).Scaling.End
next

Greetings

Walter

Message 2 of 4
(4,367 Views)
Solution
Accepted by Siliev

Hi Siliev,

 

Here's an example I created for a customer yesterday that does something very similar, using the extrema of channels in a particular group to scale each Y axis.

 

j = 1
GraphName = "2DAxis1"
Set Group = Data.Root.ChannelGroups(1)
Set Sheet = Report.Sheets(1)
IF Sheet.Objects.Exists(GraphName) THEN
  Set Graph = Sheet.Objects(GraphName)
  FOR Each Yaxis In Graph.YAxisList
    j = j + 1
    Set YChannel = Group.Channels(j)
    Yaxis.Scaling.Origin = CMin(YChannel)
    Yaxis.Scaling.Begin  = CMin(YChannel)
    Yaxis.Scaling.End    = CMax(YChannel)
  NEXT ' Yaxis
ELSE
  MsgBox "Could not find the graph named """ & GraphName & """"
END IF
Call Report.Refresh

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 3 of 4
(4,352 Views)

Walter -

Thank you very much for sharing this example with me. It was very helpful and I am now able to acomplish exactly what I was trying to do.

 

Brad -

Thank you for your input as well. I am actually the customer you are referring to :). I posted the question on here before you had gotten back to me. Hopefully this discussion would be helpful to other people as well.

 

I ended up taking parts from both examples and got exactly what I needed.

 

- Simeon

0 Kudos
Message 4 of 4
(4,348 Views)