DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Display the channels in a user dialog into the View

Hello everyone,

 

i have a user dialog with a channel list. Now i want select some channels and display them in "View". I would also like to be able to enter the start value of the x-axis and the end value of the x-axis in the user dialog via two editboxes. This x-axis section should then be displayed in "View".

 

Thanks a lot.

 

Greetings

Alexander 

0 Kudos
Message 1 of 2
(811 Views)

I posted the solution here:

http://www.savvydiademsolutions.com/view.php?topic=view-2D-chart-by-script

 

Spoiler

'-- Author: Mechatronic Solutions LLC
' Mark W Kiehl
' www.SavvyDiademSolutions.com
' www.SavvyDIAdemPySolutions.com/
' www.MechatronicSolutionsLLC.com

Dim oElementList, oSheet, oAreaTop, oAreaBottom, o2DCurve, o2Dtbl

'Load a DIAdem sample data file
Call Data.Root.Clear
If Not FileExist(ProgramDrv & "Libr\Data\Example.tdm") Then Call Err.Raise(65535,,"ERROR: File not found " & ProgramDrv & "Libr\Data\Example.tdm")
Call DataFileLoadSel(ProgramDrv & "Libr\Data\Example.tdm","TDM","[1]/*","Load|ChnXYRelation")

'Create an ElementList with the channels to plot
Set oElementList = Data.CreateElementList()
Call oElementList.Add(Data.GetChannel("Example/Time"))
Call oElementList.Add(Data.GetChannel("Example/Speed"))
Call oElementList.Add(Data.GetChannel("Example/RPM"))
Call LogFileWrite("Channel '" & oElementList.Item(1).GetReference(eReferenceIndexName) & "' starts at " & Str(oElementList.Item(1).Values(1),"AutoAdj") & " and ends at " & Str(oElementList.Item(1).Values(oElementList.Item(1).Size),"AutoAdj") & " " & oElementList.Item(1).UnitSymbol)

'Create View sheet with 2D curve
Call View.NewLayout()
Set oSheet = View.ActiveSheet()
Set oAreaTop = oSheet.ActiveArea: oAreaTop.Name = "Top": Set oAreaBottom = oAreaTop.SplitBottom("Bottom",-1)
oAreaTop.DisplayObjType = "CurveChart2D"
' "1 system [phys.]" "n systems [phys.]" "n axes [phys.]"
oAreaTop.DisplayObj.YScaling = "n systems [phys.]"
oAreaTop.DisplayObj.XScalingMode = "RangeFull"
Set o2DCurve = oAreaTop.DisplayObj.Curves2D.Add(oElementList.Item(1).GetReference(eReferenceNameName),oElementList.Item(2).GetReference(eReferenceNameName))
Set o2DCurve = oAreaTop.DisplayObj.Curves2D.Add(oElementList.Item(1).GetReference(eReferenceNameName),oElementList.Item(3).GetReference(eReferenceNameName))
'oAreaBottom.DisplayObjType = "ChannelTable": oAreaBottom.DisplayObj.IndexColumnWidth = 60
'Set o2Dtbl = oAreaBottom.DisplayObj.Columns.Add(Data.GetChannel("grp/chnY").GetReference(eReferenceNameName)): o2Dtbl.Width = 60

'Set the scaling of the 2D curve to X = 25% and 75% of full scale.
oSheet.Cursor.X1 = oElementList.Item(1).Values(oElementList.Item(1).Size) * 0.25
oSheet.Cursor.X2 = oElementList.Item(1).Values(oElementList.Item(1).Size) * 0.75
Call LogFileWrite("Scaling 2D plot from X = " & Str(oSheet.Cursor.X1,"AutoAdj") & " to " & Str(oSheet.Cursor.X2,"AutoAdj") & " " & oElementList.Item(1).UnitSymbol)
oAreaTop.DisplayObj.XScalingMode = "RangeZoom"
oSheet.Cursor.Type="Band"

Call View.Refresh()
Call WndShow("VIEW")

0 Kudos
Message 2 of 2
(632 Views)