DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Control report x axis length with script

Solved!
Go to solution

Hello, Can someone please provide a script example that will check the length of a channel and use that length value to set the open report x axis length equal to that value? I can't quite seem to get it all working....Many thanks!

0 Kudos
Message 1 of 9
(6,195 Views)

Hello KarenD,

this sounds like you want to display the channel versus its index. If you simply assign that channel to the y-axis entry in REPORT and leave scaling as "automatic" there is nothing else you need. Am I missing something ?

0 Kudos
Message 2 of 9
(6,185 Views)

Andreas has a valid question.  Couldn't just leaving the scaling as automatic do this for you?

If not you can simply right click on any report template object and select "Copy as Script" and then past it into script editor.  

 

Or perhaps set the X axis like so.

 

Dim oCtrl, o2DAxisSystem, o2DAxisX

Set o2DAxisSystem = oCtrl
Set o2DAxisX = o2DAxisSystem.XAxis

O2DAxisX.Scaling.Begin = 0     'Use this as your origin
O2DAxisX.Scaling.End = 1000  'Use this as you end point  

 

 

 

Tim
0 Kudos
Message 3 of 9
(6,140 Views)

Thank you for your response. When I leave it to automatic I get some gap at the end (curve ends before axis ends). Sometimes that doesn't look to bad other times it is rather large; I would like to have the curves extend to the end of the axis with no gap. Hopefully that makes sense. I am setting up custom report templates and sripting that allows non-DIAdem users to open a data file and the report is automatically generated for them; data set lengths are always different for each file.

0 Kudos
Message 4 of 9
(6,136 Views)

Hi Karen,

 

If you can't get Smopth's code to run, please post a data set and TDR file, and I can send you VBScript code that will adjust the X axis of your graph to the length of the channels in the graph configuration.

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

0 Kudos
Message 5 of 9
(6,105 Views)

Hi Brad,

 

The smoothdurban code doesn't work because it defines a specific end point. I'm looking to set the x-axis end length to the channel length which is differnet on every file. Due to confidentiality I can't load a whole data set but I attached a one channel data set and a sample simplified report. 

 

Thank you,

Karen

Download All
0 Kudos
Message 6 of 9
(6,081 Views)

You can access the channel length via a property

 

Below I am accessing the length property of the "Smoothed" channel.

 

Data.Root.ChannelGroups(2).Channels("Smoothed").Properties("length").Value
Tim
0 Kudos
Message 7 of 9
(6,079 Views)
Solution
Accepted by topic author KarenD

Hi Karen,

 

You actually need to send the corresponding TDX file as well before I can do anything with the TDM file.  No matter, though, the TDR file was enough in this case.  I believe this is what you're after:

 

Set Sheet = Report.Sheets(1)
Set Graph = Sheet.Objects("2DAxis1")
Set Curve = Graph.Curves2D(1)
ChanRef = Curve.Shape.YChannel.Reference
Set Channel = Data.GetChannel(ChanRef)
Graph.XAxis.Scaling.AutoScalingType = eAxisAutoScalingBeginEndManual
Graph.XAxis.Scaling.Begin = 1
Graph.XAxis.Scaling.End = Channel.Size
Report.Refresh

 

Brad Turpin

DIAdem Product Support Engineer

National Instruments

Message 8 of 9
(6,051 Views)

Brad,

 

Many thanks for this. I'm new to scripting and I had it close but not quite right. This is exactly what I was looking for!

 

Karen

0 Kudos
Message 9 of 9
(6,014 Views)