Data Table Component
•
|
The data table component defines a one or two-dimensional data table in a Standard Maple worksheet or document. This component performs an action or a series of actions to communicate with other embedded components when the data table is updated, although assigning an action to a component is not required.
|
•
|
The data structure used to store the data is an rtable.
|
•
|
You can insert this embedded component from the Components palette.
|
•
|
There are two ways to populate the data table with entries:
|
1.
|
By referencing the name of an existing Matrix, Array, Vector, or other rtable
|
2.
|
By filling in the initial values interactively
|
Associating the data table with an existing Matrix
If you have already defined a Matrix, Array, Vector, or other rtable in your document, you can associate the data table with that rtable. The rtable must be assigned to a name.
To associate the data table with an existing Matrix:
1.
|
Insert the Data Table Component from the Components palette
|
2.
|
Select Use existing Matrix and
|
3.
|
Select the name of the rtable from the drop-down list.
|
Filling in data table values interactively
To fill the initial values interactively:
1.
|
Insert a Data Table Component.
|
2.
|
Select Create new Matrix and specify a variable name for the rtable.
|
3.
|
Specify the total number of rows and columns of the rtable.
|
4.
|
Set other properties, as desired, and click OK. The component is inserted in the document with initial values of 0.
|
5.
|
Double-click each table cell to edit the value.
|
•
|
To perform an action when the data table is updated, enter the commands you want to perform in the Action When Values Change dialog that displays from the DataTable Properties. To display DataTable Properties, right-click (for Macintosh, Control-click) the data table and select Component Properties.
|
•
|
The Component Name property is used to reference the list box when using the routines from the DocumentTools package.
|
•
|
To force an update of the data table, use DocumentTools[SetProperty]("DataTable0",update), where DataTable0 is the name of your data table.
|
•
|
The data table component is customized by setting options in the DataTable Properties. Actions are associated with components using routines in the DocumentTools package.
|
|
Component Palette Image
|
|
|
|
DataTable Properties
|
|
•
|
The following table describes the control and use of the data table component options.
|
|
An x in the G column indicates that the option can be read, that is, retrieved by using the DocumentTools[GetProperty] tool.
|
|
An x in the S column indicates that the option can be written, that is, set by using the DocumentTools[SetProperty] tool.
|
Option G S Option Type
tooltip x x string
variableName x x name
visibleRows x x positive integer
visibleColumns x x positive integer
enabled x x true or false
visible x x true or false
editable x x true or false
columnNames x x list of strings
rowNames x x list of strings
|
The text that appears when the user hovers the mouse over the data table.
|
|
The variable that the data table is associated with. This may be a previously defined variable that has a Matrix, Vector, or Array assigned to it, or it may be a new variable that was created when the data table was created.
|
|
The number of visible rows in the data table.
|
|
The number of visible columns in the data table.
|
|
Indicates whether the data table component is enabled. If enabled is set to false, it will not receive updates when the Matrix, Vector, or Array assigned to the variable changes. In other words, it will be a snapshot in time that will not be updated. By default, the value is true.
|
|
Specifies if the data table is visible. By default, the value is true.
|
|
Indicates whether the table cells are editable. By default, the value is true.
|
|
Specify names for the columns of the table.
|
|
Specify names for the rows of the table.
|
|
|
Data Table Examples
|
|
Note: Follow the steps below to create an interactive data table example. A screenshot of this example is shown below.
Display a list of functions in an embedded List Box component. Select a function from the list to view the plot and the table of values Maple uses to plot the selected function.
1.
|
Insert a List Box component and a Plot component using the Components palette. For information on displaying the Maple palettes, see the Show Palettes help page.
|
2.
|
Insert a Data Table component using the Components palette.
|
3.
|
In the Create Data Table dialog, select Create new Matrix. Modify the size of the data table by setting the Total Columns and Visible Columns to 2.
|
4.
|
Right-click the list box component and select Component Properties.
|
Add items to the list box:
5.
|
Click the Edit button of the Item List field. Click the Add button to add two more fields.
|
6.
|
Double-click the first row, and replace the entry with x^2.
|
7.
|
Repeat step 6 twice to add two more expressions: x^2-4*x+3 and x^2-4*x+8. Click OK.
|
Define the action to be taken for a selected function from the list box:
8.
|
Click the Edit button of Action When Selection Changes. This launches a dialog with preset statements and additional information on how to program actions between embedded components.
|
|
end use; statement in the dialog, enter
|
SelectedPlot := Do(plot(%ListBox0, x = -5 .. 5)); Do(%Plot0 = SelectedPlot);
DataTable0 := plottools[getdata](SelectedPlot)[3];
Do(%DataTable0(columnNames) = ["x", "y"]);
SetProperty("DataTable0",update);
|
Ensure the names of the components are correct.
|
10.
|
Click OK to accept these changes.
|
|
|
|
|
|
You can verify the syntax of the embedded component action by executing these commands in the worksheet in which you have defined the embedded components.
|
>
|
SelectedPlot := Do(plot(%ListBox0, x = -5 .. 5)); Do(%Plot0 = SelectedPlot);
|
>
|
DataTable0 := plottools[getdata](SelectedPlot)[3];DocumentTools:-Do(%DataTable0(columnNames) = ["x", "y"]);
|
>
|
SetProperty("DataTable0",update);
|
|
|
See Also
|
|
ButtonComponent, CheckBoxComponent, ComboBoxComponent, DialComponent, DocumentTools, DocumentTools[Do], DocumentTools[GetProperty], DocumentTools[SetProperty], EmbeddedComponents, LabelComponent, ListBoxComponent, MathExpressionComponent, MeterComponent, PlotComponent, RadioButtonComponent, RotaryGaugeComponent, SliderComponent, TextAreaComponent, ToggleButtonComponent, VolumeGaugeComponent
|
|