DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Formatting a Report Graph that References Two Y Axis's with Axis Labels via script

Hello,

I am currently trying to write a script that does calculations based on data i pull from a file. After doing my calculations I have a graph appear in the report tab. The graph references multiple Y-axis. How do I get the report to show the channels/axis that the graph is referencing? I attached two files of what the report tab looks like.

Thank you guys in advance for your help!!

Lifecaster03_0-1720626806048.png

Lifecaster03_1-1720626840147.png

 

 



0 Kudos
Message 1 of 5
(453 Views)

Hello!

 

Here's a reference I pulled from the DIAdem Help menu-

DIAdem REPORT > Objects > Object: AxisLabel

 

Couchman_0-1720638494353.png

 

And here's a copy-pasta of it, you should be able to directly paste this in to get a labeling example.

Dim oMy2DAxisSystem, oMyPos, oMyYLabel, oMyXLabel
Call Report.NewLayout()
Set oMy2DAxisSystem = Report.ActiveSheet.Objects.Add(eReportObject2DAxisSystem, "My2DAxisSystem")
Set oMyPos = oMy2DAxisSystem.Position.ByCoordinate
oMyPos.X1 = 20
oMyPos.X2 = 80
oMyPos.Y1 = 20
oMyPos.Y2 = 80
Set oMyYLabel = oMy2DAxisSystem.YAxis.Label
oMyYLabel.Text = "This is the y-axis"
oMyYLabel.Angle = 90
oMyYLabel.Font.Name = "Tahoma"
oMyYLabel.Font.Size = 7
oMyYLabel.OffsetX = 100
oMyYLabel.OffsetY = -10
oMyYLabel.RelativePosition = eAxisLabelRelativePositionRight
Set oMyXLabel = oMy2DAxisSystem.XAxis.Label
oMyXLabel.UseCurveColor = True
oMyXLabel.Text = "This is the x-axis"
oMyXLabel.Angle = 0
oMyXLabel.Font.Name = "Tahoma"
oMyXLabel.Font.Size = 7
oMyXLabel.OffsetX = -7
oMyXLabel.OffsetX = 100
oMyXLabel.RelativePosition = eAxisLabelRelativePositionRight
oMyXLabel.UseCurveColor = True
Call Report.Refresh()

 

Hope this helps!

 

0 Kudos
Message 2 of 5
(428 Views)

Thanks Couchman!

This could work!
But it looks like this hardcodes the axis names. Is there a way for it to recognize what channel it is referencing in case the inputs are changed?

0 Kudos
Message 3 of 5
(423 Views)

Ok so- without seeing your code I can not give an exact example. In my application though, I am able to just put in a line like this:

oMyXLabel.Text = data.Root.ChannelGroups(1).Channels(Input(5)).Name

instead of 

oMyXLabel.Text = "Hard Coded Label"

So whatever you are using to pull that reference data out of your channel, you should be able to directly put in a line like that to reference whatever channel data you are pulling from, automatically, dynamically. 😎

 

Hope that helps!

0 Kudos
Message 4 of 5
(415 Views)

Hey.

 

What I mostly use is a legend for the curves with corresponding line color, and the description of the Y-axis.

For example, my second Y-axis is labeled "pressures", and the channels on this axis are labeled with their name (e.g. "FP047-12-2") and description (e.g. "pressure hydraulic actuator, supply line").

 

If the colors are difficult to distinguish, use markers...

 

Greetings,

Vassili

0 Kudos
Message 5 of 5
(362 Views)