07-10-2024 10:55 AM
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!!
07-10-2024 02:10 PM
Hello!
Here's a reference I pulled from the DIAdem Help menu-
DIAdem REPORT > Objects > Object: AxisLabel
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!
07-10-2024 02:19 PM
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?
07-10-2024 02:26 PM
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!
07-19-2024 06:44 AM
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