2.5.2 add_table_to_graph
Contents
Menu Information
Insert: Table
Brief Information
Add a linked table to a graph or a layout
Command Line Usage
1. add_table_to_graph cols:=3 row:=3; 2. add_table_to_graph cols:=5 rows:=4 title:=mytable; 3. add_table_to_graph igl:=[graph1]layer1 cols:=5 rows:=4 title:=mytable col:=1;
X-Function Execution Options
Please refer to the page for additional option switches when accessing the x-function from script
Variables
| Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
|---|---|---|---|---|
| Layer | igl |
Input Layer |
|
Specifies the graph layer to which the table should be added. |
| Number of Columns | cols |
Input int |
|
Specifies the number of columns in the table. |
| Number of Rows | rows |
Input int |
|
Specifies the number of rows in the table. |
| Table Title | title |
Input string |
|
Specifies the title of the table. |
| Show Column Labels | col |
Input int |
|
Specifies whether to show the column label row. |
| Table Name | tabname |
Output string |
|
Specifies the string name used to store the name of the created table. |
Description
This function adds a linked table to a graph or a layout. This is usually for displaying additional information on the graph/layout.
The table is editable. To edit it, you can double-click on the table. Then it is opened and you can edit it as in the Origin Worksheet. When the editing is done, you can click the Update Table button to update the changes to the graph/layout.
Examples
In this example, we do simple statistics on sample data and then add the result to a table on graph.
- Import a sample data.
- Perform simple statistics.
- Plot the data.
- Add a table to the graph and fill it with the statistics result.
//Create a new workbook newbook; //Import a file path$ = system.path.program$ + "Samples\Statistics\"; fname$ = path$ + "diameter.dat"; impasc; wks.col1.type=1; //Statisitcs and plot stats 1 mean:=mymean sd:=mysd n:=myn min:=mymin max:=mymax sum:=mysum; plotxy 1; add_table_to_graph cols:=2 rows:=5 tabname:=TableName$ title:="Basic Statistics"; //Fill table content range rr=[TableName$]1!col(1); rr[1]$=Mean; rr[2]$=SD; rr[3]$=N; rr[4]$=Min; rr[5]$=Max; range ss=[TableName$]1!col(2); ss = {mymean, mysd, myn, mymin, mymax}; doc -uw; //Refresh