In this article a function is described which will simplify to addition of datasets to a UniPlot document (UniPlot template).
Function: An Excel sheet is created from a UniPlot document using the command export-dataset-table.
Example:
The Excel sheet can be edited and then assigned to a copy of the original Uniplot document.
This is a quick way to create documents with different data files with added or changed channels.
You need Microsoft-Excel 97 or higher.
Go to Tools=>Customize User Toolbar and add the following commands
To export a dataset table
A dataset table will be written to an Excel file. The Excel file will be saved under the name of the UniPlot document with the extension .xls. Example:
UniPlot document: c:\Programme\UniPlot\Template\dx.ipw
Excel-Dataset-Table: c:\Programme\UniPlot\Template\dx.xls
If the file could be created succesfully it will be opened with Excel. See The Data Source Table.
This command will try to open the Excel table of the active UniPlot document.
Example:
If the active document is c:\Programme\UniPlot\Template\dx.ipw the function will try to open the Excel file c:\Programme\UniPlot\Template\dx.xls.
After a Data Source Table has been created it can be applied to the active document:
If the document has not jet been saved a message box will be displayed. Click on the Yes button to save the document.
The following actions will be performed:
The Data Source Table has the following setup:
Column 1 to 4:
| #Page-Name | Diagram-Name | Datafile-Path | Datafile-Name |
|---|---|---|---|
| Page 1 | Diagram1 | D:/uniplotd/samples/ | Test1.xls{2} |
| Page 1 | Diagram1 | D:/uniplotd/samples/ | Test5.xls{2} |
Columns 5 bis 9:
| Dataset-Name | x-Channel | y-Channel | z-Channel | Functions |
|---|---|---|---|---|
| Data1 | EngSpd | SAEPwr | xy_akimaspline() | |
| Data2 | EngSpd | SAEPwr | xy_akimaspline() |
The first row is a comment line which starts with a # character. Comments will be ignorded. Every other row specifies one dataset.
The columns have the following meaning:
Is the page name into which the dataset is inserted.
Is the diagram name into which the dataset is inserted.
Is the complete path of the data file. UNC path names are valid, e.g. \\p1300\d\testdata\ao2230.
Is the data file name without the path. If the data file is an Excel file a sheet name in square brackets can follow the file name. The import options can follow in parenthesis. Example: test.xls [Tabelle 1] 2.
Is the dataset name.
Is the x-channel name.
Is the y-channel name.
Is the z-channel name. If this column is not empty a 3D dataset is created.
In this column functions can be inserted which will be called after the dataset is created. If you would like to call multiple functions add them to the folling columns (Col 10, 11, ..).
styleorder("default")
This function sets the dataset style of the current page.
The style order can be configured using the command toolsdatenset-style-order-configuration.
If a document page contains 4 channels (Speed, Torque, etc.) and the datasets are loaded from 5 different data files, you can specify the dataset styles to distingush the tests and channels. To to so, add a function call with the name of a style order name.
The function call should be added to the last dataset of the current page.
| #PageName | ... | Function |
|---|---|---|
| Page 1 | ... | |
| Page 1 | ... | |
| Page 1 | ... | styleorder(“default”) |
| Page 2 | ... | |
| Page 2 | ... | |
| Page 2 | ... | styleorder(“default”) |
style(ssStyleName)
style(ssStyleFile, ssStyleName)
Example: style(“3D-be”)
This function is used mainly for 3D datasets. For 2D datasets the styleorder() function is easier to use because you can set the style of all datasets with a single function call.
Creates an akima spline
xy_akimaspline()
xy_akimaspline(nPoints)
xy_akimaspline(nPoints, bIncludeOrgPoints)
Example: xy_akimaspline(100)
Creates a fit spline
xy_fitspline()
xy_fitsplinespline(nPoints)
xy_fitspline(nPoints, SmoothFactor)
Example: xy_fitspline(100)
This chapter is only intended for users who would like to write their own functions such as the function styleorder. The functions above can be found in the file dx-fkts.ic and can be used as examples for your own functions. User functions should be added to a separate file e.g. MyDataExchangeFunctions.ic and saved in the UniPlot/AutoLoad directory.
Example:
// styleorder(ssStyleOrderName)
def DXFUNC_styleorder(hInfo, nArgs, svArgs)
{
hPage = MapLookup(hInfo, "hPage");
auto_AssignStyleOrder(hPage, svArgs[1]);
}
The function starts with the name DXFUNC_ followed by a name used in the Data Source tabel.
The functions has three parameters: hInfo, nArgs und svArgs.
hInfo is the handle of a map with information about a row in the table which is currently processed. Here is a list of all data that is saved in the map:
hDoc = MapLookup(hInfo, "hDoc");
hPage = MapLookup(hInfo, "hPage");
hLayer = MapLookup(hInfo, "hLayer");
hData = MapLookup(hInfo, "hData");
nArgs is the number of arguments. Example: If the table contains the function call styleorder("default2") nArgs has the value 1.
svArgs contains the arguments as a string vector. Example: For the function call styleorder("default2") the paramete value is svArgs = ["default2"].
id-962442