06-08-2016 09:34 AM
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!
Solved! Go to Solution.
06-09-2016 02:26 AM
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 ?
06-13-2016 09:35 AM
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
06-13-2016 02:36 PM
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.
06-15-2016 04:19 PM
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
06-16-2016 12:18 PM
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
06-16-2016 12:21 PM
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
06-17-2016 04:12 PM
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
06-20-2016 01:23 PM
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