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,178 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,168 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,123 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,119 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,088 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,064 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,062 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,034 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
(5,997 Views)