DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

VIEW: Adjust YScaling Bug

Solved!
Go to solution

Hello,

 

I want to report a Bug which concerns the View-Module.

 

I've faced this bug in DIAdem 2021 as well as 2018.

 

If I want to adjust the Y-Axis in a Curve Chart manually, I can use the following Code provided from the DIAdem help:

 

View.Sheets(1).Areas(1).DisplayObjType = "CurveChart2D"
Dim oMyChart: Set oMyChart = View.Sheets(1).Areas(1).DisplayObj
Call oMyChart.Curves2D.Add("[1]/[1]","[1]/[2]")
oMyChart.YScaling = "1 system [phys.]"
oMyChart.YScalingMode = "manual"
oMyChart.YScalingBegin = 0
oMyChart.YScalingEnd = 10

however this only works if a new Chart is added 

Call oMyChart.Curved2d.Add(...)

if this line is outcommented and an already existing Curve should be scaled, the script does not work.

 

 

 

Here is another example to adjust the Y-Axis of an already existing Curve, which was Shift-copied from the View:

Dim oDisplayObj
Set oDisplayObj = View.Sheets("Blatt 1").Areas("Area : 1").DisplayObj
'------------------- 2DAxisSystem ------------------------------
oDisplayObj.AxisLabeling = true
oDisplayObj.DateTimeRepresentation = eDateTimeRepresentationLegacy
oDisplayObj.YScalingMode = "manual"
oDisplayObj.YScalingBegin = 0
oDisplayObj.YScalingEnd = 50
oDisplayObj.Abscissa = "X-Cursor"
oDisplayObj.Ordinate = "Y-Cursor"
Dim oCurves
'Set oDisplayObj = View.Sheets("Blatt 1").Areas("Area : 1").DisplayObj.Curves2D
Set oCurves = oDisplayObj.Curves2D
'------------------- Curves2D ------------------------------

oCurves.Item(1).ColorRGB = 3618785

 

this script adjusts the Y-Axis for an existing Curve but will only work consistently if the last line of Code

oCurves.Item(1).ColorRGB = ...

is executed.

 

Is there an easier and more cosistent way to adjust the Y-Axis of an already existing Curve (for the View Module)?

Thanks in advanced

0 Kudos
Message 1 of 5
(1,493 Views)

Hello, MaT_305.  I think this link will help you. 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000YHnwCAG&l=en-US

0 Kudos
Message 2 of 5
(1,422 Views)

Hi Vazgen_H and thank you for your reply.

 

This is helpful to adjust the View Y-Axis manually, but I wish to automate this by script.

 

The script above is working, if you adjust e.g. the color of one of your curves (and I'm wondering why)

Dim oDisplayObj
Set oDisplayObj = View.Sheets("Blatt 1").Areas("Area : 1").DisplayObj
'------------------- 2DAxisSystem ------------------------------
oDisplayObj.YScalingMode = "manual"
oDisplayObj.YScalingBegin = 0
oDisplayObj.YScalingEnd = 50


Dim oCurves
Set oCurves = oDisplayObj.Curves2D
'------------------- Curves2D ------------------------------

oCurves.Item(1).ColorRGB = oCurves.item(1).ColorRgb  '<-- adjust Color of Curve 1 - this must be added to change Y-Axis in View

 

0 Kudos
Message 3 of 5
(1,416 Views)
Solution
Accepted by topic author MaT_305

Hi Mat_305,

 

I tested the code you have provided by changing the YScalingEnd several times. I have only added View.Refresh in the end. – Works fine.

Tested with DIAdem 2021 SP1.

 

Greetings

Walter

0 Kudos
Message 4 of 5
(1,401 Views)

Hello Walter,

 

oh I didn't know about the View.Refresh()-Methode. Thank you very much!

0 Kudos
Message 5 of 5
(1,387 Views)