To overlay multiple Axis Systems in DIAdem and configure the x-axes to appear as though they are linked, follow the steps below.
Note: This tutorial works with the example data that is loaded into DIAdem's Data Portal by default.
- Launch DIAdem.
- If using the default example data, click the Save icon in the Data Portal to save it on disk.
- If using your own data file, load it into the Data Portal.
- Select the REPORT tab and create a new layout.
- On the new sheet, place a 2D Axis System by clicking Insert >> 2D Axis System.
- Double-click the 2D Axis System to open the Add Curves dialog.
- From the Data Portal, drag your X and Y channels into the X-channel and Y-channels fields.
- In this example, the default Speed and Time channels are used for the Y axis and X-axis respectively.
- Click OK twice to save changes.
- Double-click the Axis System to open the Curve and Axis Definition dialog.
- Select the Position tab and make a note of all of the fields under Position as % of worksheet.
- Click Cancel to close the dialog.
- Place another 2D Axis System on the same sheet.
- Double-click the new 2D Axis System to open the Add Curves dialog.
- Click OK. It doesn't matter which channel is plotted since this will be changed in a later step.
- Select the Position tab.
- Ensure that all fields under Position as % of worksheet have the same values as the first 2D Axis System.
- This will place the objects on top of each other.
- Select the Curve list tab.
- Click the drop-down arrow next to the Color column and select No Color.
- This will ensure that any channels plotted on the second 2D Axis System are invisible.
- Select the Axis Parameters tab.
- Click the Y1-Axis >> Scaling tab and ensure that Tick style is set to No ticks.
- Click the Y1-Axis >> Numbers tab and ensure that Font Colors is set to No Color.
- Click the Y1-Axis >> Labels tab and ensure that the Text field is empty.
- Click the X-Axis >> Scaling tab and ensure that the following settings are configured:
- Tick style is No ticks.
- Tick size in % is set to 6.
- Number of miniticks is set to 0.
- Click OK to save changes.
- Select the Legend that appears for the second 2D Axis Systems and press Delete to delete it.
- Navigate to File >> Save As... to save the report layout.
- Note: Ensure to save it in the same location as the data file.
- Select the SCRIPT tab.
- Select File >> New VBS... to create a new Visual Basic Script.
- Click File >> Save As... to save the script in the same location as your data file and Report layout.
- Enter the following code to load your data file programmatically, where:
- Dim numSamples declares a variable that will be used later.
- Call Data.Root.Clear() clears the Data Portal of any current data.
- Call LogFileDel() clears the Logfile output.
- Call DataFileLoad(CurrentScriptPath & "<file name>", "<DataPlugin>", "Load|ChnXYRelation") loads a file saved in the same location as your script with the name <file name>.
- The code below loads a file called "Data.tdm" with the TDM DataPlugin:
Dim numSamples
'--- Clear log and load data file into the Data Portal
Call Data.Root.Clear()
Call LogFileDel()
'--- To load a file called Data with the TDM DataPlugin, the below line should resemble:
Call DataFileLoad(CurrentScriptPath & "Data.tdm", "TDM", "Load|ChnXYRelation")
- Load the report with Call Report.LoadLayout(CurrentScriptPath & "<Report file>") where:
- The report file should be saved in the same folder as your current script.
- <Report file> is the name of your report.
- The code below loads a report file called "Multiple X Axes.tdr":
Call Report.LoadLayout(CurrentScriptPath & "Multiple X Axes.tdr")
- Create a new channel that will be used as the x-axis data for the second 2D Axis System. This example assumes that the x-axis will be the number of samples in the Y channels.
- Set the variable numSamples to the number of samples in the Y Channel.
- Use the ChnLinGetImp command to generate a numeric channel of equidistant values from 1 to the value of numSamples.
- The code example below sets numSamples to the length of a channel called Speed and then generates a numeric channel called NumberSamples.
numSamples = data.Root.ChannelGroups(1).Channels("Speed").Size
Call ChnLinGenImp("NumberSamples", numSamples, 1, 1, "")
- Refresh the report layout with Call Report.Refresh().
Call Report.Refresh()
- Run the script so that the NumberSamples channel appears in the Data Portal.
- The second 2D Axis System must now be configured to plot the new NumberSamples channel:
- Select the REPORT tab.
- Double-click the x-axis on the second 2D Axis System.
- Select the Curve List tab.
- Delete the channel in Y-Channel and drag the NumberSamples into the X-Channel field.
- Click OK to close the dialog.
- Save the report layout.
- Now when the script executes:
- The first 2D Axis System will plot the Y channel Speed against time.
- The second 2D Axis System will automatically plot the number of samples as a secondary x-axis.