10-26-2016 09:16 AM
Hello,
i have a problem to change the scailing from the x axis in a 2D-axis.
I got the error messages "access to the REPORT-objects only if is open with GraphObjOpen".
I understand i need the opject "Xaxis" to change some parameter in it.
But i can not found the correct way to use the command "D2AxisXObj" for read out the possible xaxis objects.
Here my simple code:
**********************************************************************************
Call Data.Root.Clear()
Call DataFileLoad(MyFolders(0)&"Output.tdms","","")
'Load Report Template
Call Report.LoadLayout(MyFolders(1)&"Frequency_Response_V01.TDR")
Call PicDelete() 'Deletes all objects
Call GraphObjNew("2D-Axis","New_2DAxis1") 'Creates a new 2D axis system
Call GraphObjOpen("New_2DAxis1") 'Opens the axis object
D2AxisBackColor ="white" 'Sets the background color
D2AxisTop =5 'Sets the position
D2AxisBottom =10
D2AxisLeft =10
D2AxisRight =10
Call GraphObjNew("2D-Curve","New_Curve") 'Creates a new curve
Call GraphObjOpen("New_Curve") 'Opens the curve object
D2CCHNX ="[1]/[1]" 'Defines the x-channel
D2CCHNY ="[1]/[2]" 'Defines the y-channel
D2CurveColor ="red" 'Defines the curve color
D2CurveLineWidth ="0.5" 'Defines the curve line
Call GraphObjOpen(D2AxisXObj())
D2AxisXDivMode ="logarithmic"
Call GraphObjClose(D2AxisXObj())
Call GraphObjClose("New_Curve") 'Closes the curve object
Call GraphObjClose("New_2DAxis1") 'Closes the axis object
Call PicUpdate() 'Updates the report
*****************************************************************************************
I hope you can give me a tip for my problem.
Regards
Wolf41242
10-27-2016 03:50 AM - edited 10-27-2016 03:51 AM
Hi!
You must open the XAxis object in the 2dAxis object, you're currently trying to open it in the curve object. Also, the D2AxisXObj() is incomplete, you need to give it the axis number.
In your code, change this:
Call GraphObjOpen(D2AxisXObj()) D2AxisXDivMode ="logarithmic" Call GraphObjClose(D2AxisXObj()) Call GraphObjClose("New_Curve") 'Closes the curve object
with this:
**************************************************************************************************************
Call GraphObjClose("New_Curve") 'Closes the curve object Call GraphObjOpen(D2AxisXObj(1)) D2AxisXDivMode ="logarithmic" Call GraphObjClose(D2AxisXObj(1))
**************************************************************************************************************
and it should work.
If you have a recent DIAdem version (>= 2012, I think), I'd suggest using the object aproax, though. IMHO it's waaay easier to work that way (and autocomplete helps quite a lot):
dim xyaxis set xyaxis = report.ActiveSheet.Objects.Add(eReportObject2DAxisSystem, "") dim curve set curve = xyaxis.Curves2D.Add(e2DShapeLine, "") curve.Shape.XChannel.Reference = "[1]/[1]" curve.Shape.YChannel.Reference = "[1]/[2]" xyaxis.XAxis.Scaling.Type=e2DXScalingLogarithmic
11-03-2016 04:06 AM
Hi,
thanks.
I it works with the last sample well.
Regards
Bernhard