‎05-02-2012 07:51 AM
Hi
A few years ago I created a user dialog box for selecting and displaying channels in DIAdem view.
It worked fine for all DIAdem 10.X releases, but for DIAdem 11.X there is a problem with the y-axis scaling.
The channels are displayd as [n Systems (Linear)]
In DIAdem 10.X the y-axis for each separate graph would be scaled automatically accoring to the min. and max. values of the displayed channel.
In DIAdem 11.X the y-axis for each graph is scaled from 55.0397 to 133.7655.... for all channels, no matter what the values are for the displayed channel.
When I click the "Zoom Off" button the scaling becomes correct.
What do I need to put in to my script to make the y-axis scale correctly?
Below is the code that is used to set the scaling (no scaling for Y axis is set):
R1 = SelectedStartTime 'this is a variable defined earlier in the code
R2 = SelectedEndTime 'this is a variable defined earlier in the code
View.ActiveSheet.Cursor.X1 = R1
View.ActiveSheet.Cursor.X2 = R2
View.ActiveSheet.Areas(1).DisplayObj.XScaling = "RangeZoom"
I've tried adding this code, to no effect:
View.ActiveSheet.Areas(1).DisplayObj.YScaling = "n systems [phys.]"
View.ActiveSheet.Areas(1).DisplayObj.YScalingMode = "automatic"
Solved! Go to Solution.
‎05-02-2012 08:14 AM - edited ‎05-02-2012 08:16 AM
I might also add, if I remove this line from the original code:
View.ActiveSheet.Areas(1).DisplayObj.XScaling = "RangeZoom"
The code works fine also in DIAdem 11.X (except that the X-scaling of course isn't assigned)
In other words, when the XScalin property is set it also affects the Y-axis scaling somehow.
‎05-03-2012 01:45 AM
I tried with Macro recording and Ctrl+A and the result was
Option Explicit 'Forces the explicit declaration of all the variables in a script.
R1 = 30
R2 = 52
Call View.NewLayout()
View.Sheets("Sheet 1").Areas("Area : 1").DisplayObjType = "CurveChart2D"
Dim oMyDisplayObj
Set oMyDisplayObj = View.Sheets("Sheet 1").Areas("Area : 1").DisplayObj
oMyDisplayObj.Curves.Add "[1]/Time", "[1]/Speed"
oMyDisplayObj.YScalingMode ="automatic"
oMyDisplayObj.Abscissa ="X-Cursor"
oMyDisplayObj.Ordinate ="Y-Cursor"
View.ActiveSheet.Cursor.X1 = R1
View.ActiveSheet.Cursor.X2 = R2
View.Sheets("Sheet 1").Areas("Area : 1").DisplayObj.XScalingMode = "RangeZoom"
WndShow "VIEW", ""
which seems to work fine. So there is only one difference to your code which is
.XScalingMode
instead of XScaling. Does changing this work with your code?
‎05-04-2012 01:06 AM
Thanks for you reply Andreas.
Your suggestion probably works well for DIAdem11.X, however I (preferrably) need solutions that work for both DIAdem 10.X and 11.X (so that the same script may be used for both versions).
In DIAdem 10.2 (which is the developer version I have) there doesn't appear to be any property called XScalingMode for CurveChart2D (only YScalingMode).
However, I did find something that worked for both versions, namely:
View.ActiveSheet.Areas(1).DisplayObj.ZoomCursor = "BandZoomCursor"
After setting this property (in addition to the code in my initial post) the graphs are scaled correctly (on both 10.X and 11.X).