DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Select time range (x-value range) programatically

When viewing data in a 2D graph it's possible to zoom in a certain area of the data based on the values of the x-axis. Is this possible to do programatically?

Say the user has selected two time values (in a SUD) dialog (start and end time), how would i convert these two values to relative values on the X-axis and then select and zoom in this area?

Even better, is it possible to select this range of data programatically and display curves in only this range without using the zoom feature? (So that the zoom feature can be used within the selected range) Is it possible without having to create new channels?
0 Kudos
Message 1 of 4
(3,872 Views)

Hi salte,

Everything you asked about is possible with a DIAdem VBScript.  You set the X axis start and stop values programmatically in the following manner:

  Call GraphObjOpen(AxisName)
      Call GraphObjOpen(D2AxisXObj(1))
        D2AXISXDIVMODE   = "linear"
        D2AXISXSCALETYPE = "begin/end manual"
        D2AXISXBEGIN     = Xmin
        D2AXISXEND       = Xmax
        D2AXISXORIGIN    = Xmin
      Call GraphObjClose(D2AxisXObj(1))
  Call GraphObjClose(AxisName)
  Call PicUpdate

If you want to programmatically set the tick positions, etc., then you can instead choose D2AXISXSCALETYPE = "manual" and set those additional variables.

You can convert back and forth between a date/time string and a date/time number with the TTR() and RTT() functions.

Ask as you have additional questions,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

0 Kudos
Message 2 of 4
(3,860 Views)
Thanks Brad, that was exactly what i needed for generating reports.

But is it also possible in the VIEW panel to select a rang of data (without using the "zoom" feature)?
0 Kudos
Message 3 of 4
(3,833 Views)

Hi salte,

You can select an absolute Y range in a VIEW graph, but on the X axis your only option is to use either the static or dynamic zooming functionality.  However, you can do this programmatically, and that results in effectively the same behavior that you sound like you're happy with in REPORT.

Try the below-attached example,
Brad Turpin
DIAdem Product Support Engineer
National Instruments

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