DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

Drag and drop multiple groups to the VIEW 2D axis system

How to drag and drop multiple groups to the VIEW 2D axis system? I have an internal data with 80 groups, each has two channels: time (x-axis) and temperature (y-axis). I can drag and drop them one by one but can't in a batch 😕

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 1 of 4
(3,051 Views)

To determine how to do something in DIAdem use two steps

  • DIAdem Macro Recorder
  • Pressing Ctrl+Shift+C in a configuration dialog which will copy code to clipboard which will show how to fill objects

Based on your last forum entry I created this script

Option Explicit
Call View.NewLayout()
View.Sheets(1).Areas(1).DisplayObjType = "CurveChart2D"

Dim oDisplayObj
Set oDisplayObj = View.Sheets("Sheet 1").Areas("Area : 1").DisplayObj
oDisplayObj.AxisLabeling = true
oDisplayObj.YScalingMode  = "automatic"

' assume we have a group of x/y channels stored in a group one after another
dim grpO : set grpO = data.Root.ChannelGroups(1)

' There might be some leading channels that do not need to be plotted like an index
dim channelPairOffset : channelPairOffset = 0
if "Item" = grpO.Channels(1).name then
  channelPairOffset = 1
end if

dim i
for i = 0 to ((grpO.Channels.Count - channelPairOffset)/2) - 1
  ' add curves to view by using x and y channel
  dim xChannelRef : xChannelRef = grpO.Channels(channelPairOffset + i*2 + 1).GetReference(eRefTypeIndexName)
  dim yChannelRef : yChannelRef = grpO.Channels(channelPairOffset + i*2 + 2).GetReference(eRefTypeIndexName)
  call oDisplayObj.Curves2D.Add(xChannelRef, yChannelRef)
Next

which will add x/y channels pairs from a single group to view.

Its is easy to modify to multiple groups but I would still suggest to put the channels in one group to make handling easier because DIAdem has no explicit X channels.

Just drag and drop a bunch of channels into View will plot them using the first selected channel as x-Channel which will result into the same as dragging a group with two channels where the x-Channel must be the first channel.

 

After creating such a View Layout you can just save it and just press Refresh after loading a new data file.

Message 2 of 4
(3,016 Views)

I cannot use the first channel as x-axis since every data channel (y) has its own timestamps (x). In another word, x is not common for all y.

Michał Bieńkowski
CLA, CTA, CPI

  1. Did someone devote their time to help solve your problem? Appreciate it and give kudos.
  2. Problem solved? Accept as a solution so that others can find it faster in the future.
  3. Contribute to the development of TestStand by voting on the TestStand Idea Exchange.
0 Kudos
Message 3 of 4
(3,009 Views)

You do not have to use the first one.

oDisplayObj.Curves2D.Add(xChannelRef, yChannelRef)

always uses a pair of channels but it does not matter where they are stored.

You can even use x channel from another group.

Just try the script in combination of the plugin of the other thread.

DIAdem Content of CSV fileDIAdem Content of CSV file

0 Kudos
Message 4 of 4
(3,003 Views)