01-22-2018 06:27 AM
I'm trying this code to alter my axis' scaling based on a previous event search. I'm getting an error when I try "oMy2DAxisSystem.XAxis.Scaling.Begin" = <Date> saying "Numeric value necessary". So it seems that I'm not actually able to change the property "oMy2DAxisSystem.XAxis.Scaling.Type"
Set o2DAxisXScaling = oMy2DAxisSystem.XAxis.Scaling
oMy2DAxisSystem.XAxis.Scaling.AutoScalingType = eAxisAutoScalingBeginEndManual
o2DAxisXScaling.Type = e2DxScalingDateTime
oMy2DAxisSystem.XAxis.Scaling.Begin = CDate(Data.Root.ChannelGroups(1).Channels("DateTime").Values(indexbeginning))
oMy2DAxisSystem.XAxis.Scaling.End = CDate(Data.Root.ChannelGroups(1).Channels("DateTime").Values(indexend))
01-23-2018 03:04 PM
Mattrad,
Going by the Help documentation, it looks like that function is expecting a numeric value which signifies a certain type of scaling. Take a look at the link below, and see if that clears things up.
Property: Type for 2DAxisXScaling
Thanks,
aprillest
01-25-2018 02:10 PM
The error occurs on this line:
oMy2DAxisSystem.XAxis.Scaling.Begin = CDate(Data.Root.ChannelGroups(1).Channels("DateTime").Values(indexbeginning))
not when setting the type.
01-25-2018 02:12 PM
I tried to replace e2DxScalingDateTime with 0, but It changes nothing. I'm pretty sure they are both 0.
01-31-2018 11:22 AM
Hi mattrad,
You have to assign the corresponding DBL values to the X axis scaling that DIAdem displays as datetimes. Luckily, there's an easy "DValues" property you can use instead of the usual "Values" property to request the DBL representation of a datetime channel's value. I also added an explicit datetime format string, in case that's helpful:
indexbeginning = 25 indexend = 40 Set DateTimeChannel = Data.Root.ChannelGroups(1).Channels("DateTime") Set oMy2DAxisSystem = Report.ActiveSheet.Objects("2DAxis1") Set o2DAxisXScaling = oMy2DAxisSystem.XAxis.Scaling oMy2DAxisSystem.XAxis.Scaling.AutoScalingType = eAxisAutoScalingBeginEndManual o2DAxisXScaling.Type = e2DxScalingDateTime oMy2DAxisSystem.XAxis.Numbers.Format = "#mm/dd/yyyy" oMy2DAxisSystem.XAxis.Scaling.Begin = DateTimeChannel.DValues(indexbeginning) oMy2DAxisSystem.XAxis.Scaling.End = DateTimeChannel.DValues(indexend) Call Report.Refresh()
Brad Turpin
DIAdem Product Support Engineer
National Instruments