Tables
Tables allow you to view data in a vertical scrolling window that shows the ordinates, the dates and times and the values for the selected data sets.
Tabulate Class
Tabulate.newTable()
Tabulate.newTable(string title)
The Tabulate class in the hec.dssgui.script module is used to create a new Table dialog. It contains two functions to create a Table dialog, each of which returns as a HecDataTableFrame object.
Creation of a table is illustrated in Example 32.
Example 32: Creating a Table
from hec.dssgui.script import Tabulate
myTable = Tabulate.newTable()
#or
myTable = Tabulate.newTable("Elevation vs Flow")
HecDataTableFrame Class
HecDataTableFrame methods are described below:
HecDataTableFrame Methods
HecDataTableFrame Method | Returns | Description |
---|---|---|
addData(DataContainer dc) | integer | Adds Data Set to the table. |
close() | None | Closes the table |
export() | None | Brings up the Table Export Options dialog. |
export(string fileName, TableExportOptions options) | None | Exports table to specified file with specified options |
exportAsHTML(string fileName) | None | Exports table in HTML format to specified file with no title and elements indented with tabs |
exportAsHTML(string fileName, string title, string indent) | None | Exports table in HTML format to specified file with specified title and indentation string |
exportAsXML(string fileName) | None | Exports table in XML format to specified file with no title and elements indented with tabs |
exportAsXML(string fileName, string title, string indent) | None | Exports table in XML format to specified file with specified title and indentation string |
getCellBackground(integer row, integer column) | Color | Returns the background color of the specified cell as a Color |
getCellBackgroundString(integer row, integer column) | string | Returns the background color of the specified cell as a string |
getCellForeground(integer row, integer column) | Color | Returns the foreground color of the specified cell as a Color |
getCellForegroundString(integer row, integer column) | string | Returns the foreground color of the specified cell as a string |
Method | Returns | Description |
getColumn(DataContainer dc) | integer | Returns the number of the column that contains the specified data, if the parameter is time series data, or the number of the column that contains the x-ordinates if the parameter is paired data |
getColumn(string header) | integer | Returns the number of the column that has the specified header text. Line breaks in the header text are specified as "\n" |
getColumnBackground(integer column) | Color | Returns the background color of the specified column as a Color |
getColumnBackgroundString(integer column) | string | Returns the background color of the specified column as a string |
getColumnForeground(integer column) | Color | Returns the foreground color of the specified column as a Color |
getColumnForegroundString(integer column) | string | Returns the foreground color of the specified column as a string |
getColumnHeaderBackgroung( integer column) | Color | Returns the background color of the header of the specified column as a Color |
getColumnHeaderBackgroungString( integer column) | string | Returns the background color of the header of the specified column as a string |
getColumnHeaderFontString( integer column) | string | Returns the font of the header of the specified column as a string.1 |
getColumnHeaderForegroung( integer column) | Color | Returns the foreground color of the header of the specified column as a Color |
getColumnHeaderForegroungString( integer column) | string | Returns the foreground color of the header of the specified column as a string |
getColumnLabel(integer colNum) | string | Returns the column header text for the specified column |
getColumnLabels() | list of strings | Returns the column header text for all columns |
getColumnWidth(integer colNum) | integer | Returns the width of the specified column in pixels |
getColumnWidths() | list of integers | Returns a list of all the column widths in pixels |
getCommasState() | Boolean | Get whether the commas are shown |
getDateTimeAsTwoColumnsState() | Boolean | Get whether date/time columns are shown as 1 or 2 columns in the table |
Method | Returns | Description |
getExportString(TableExportOptions options) | string | Returns a string representation of the table exported according to the specified options |
getHeight() | integer | Return the height of the table in screen coordinates. |
getHTMLExportString() | string | Returns a string representation of the table exported in HTML format with no title and elements indented with tabs |
getHTMLExportString(string title, string indent) | string | Returns a string representation of the table exported in HTML format with the specified title and indentation string |
getLocation() | Point | Returns the location of the table in screen coordinates2. |
getRowBackground(integer row) | Color | Returns the background color of the specified row as a Color |
getRowBackgroundString(integer row) | string | Returns the row background color of the specified column as a string |
getRowForeground(integer row) | Color | Returns the foreground color of the specified row as a Color |
getRowForegroundString(integer row) | string | Returns the row foreground color of the specified column as a string |
getSize() | Dimension | Return the dimensions of the table in screen coordinates. |
getTableTitle() | G2dTitle | Returns the title of the HecDataTableFrame object as a G2dTitle object. |
getTableTitleText() | string | Returns the title of the HecDataTableFrame object as a string. |
getWidth() | integer | Return the width of the table in screen coordinates. |
GetXMLExportString() | string | Returns a string representation of the table exported in XML format with no title and elements indented with tabs |
getXMLExportString(string title, string indent) | string | Returns a string representation of the table exported in XML format with the specified title and indentation string |
hide() | None | Hide the table |
iconify() | None | Minimize (iconify) the table |
maximize() | None | Maximize the table |
minimize() | None | Minimize (iconify) the table |
Method | Returns | Description |
newTable() | HecDataTableFrame | Static, same as Tabulate.newTable() |
newTable(string title) | HecDataTableFrame | Static, same as Tabulate.newTable(title) |
print() | None | Display the print table |
restore() | None | Restore the table from a minimized or maximized state |
setCellBackgound(integer row, integer column, string color) | None | Sets the background color of the specified cell to the specified color |
setCellForeground(integer row, integer column, string color) | None | Sets the foreground color of the specified cell to the specified color |
setColumnBackgound(integer column, string color) | None | Sets the background color of the specified column to the specified color |
setColumnForeground(integer column, string color) | None | Sets the foreground color of the specified column to the specified color |
setColumnHeaderBackgound(integer column, string color) | None | Sets the background color of the header of the specified column to the specified color |
setColumnHeaderFont(integer column, string font) | None | Sets the font of the header of the specified column to the specified font.1 |
setColumnHeaderForeground( integer column, string color) | None | Sets the foreground color of the header of the specified column to the specified color. |
setColumnLabel(integer column, string label) | None | Sets the column header text of the specified column to the specified label. |
setColumnLabels(list labels) | None | Sets the column header text of all columns to the labels specified in the list of strings |
setColumnPrecision(integer colNum, integer precision) | None | Sets the number of decimal places to display for the specified column |
setColumnWidth(integer colNum, integer width) | None | Sets the width of the specified column in pixels |
setColumnWidths(list widths) | None | Sets the width in pixels of all the columns to those specified in the parameter (list of integers) |
setCommasState(Boolean showCommas) | None | Set state to show commas or not |
setDateTimeAsTwoColumnsState( integer showDateTimeAs2Columns) | None | Set whether date/time columns should show as 1 or 2 columns in the table |
Method | Returns | Description |
setLocation(integer x, integer y) | None | Sets the location of the table in screen coordinates2. |
setSize(int width, int height) | None | Sets the size of the table in screen coordinates. |
setRowBackgound(integer row, string color) | None | Sets the background color of the specified row to the specified color |
setRowForeground(integer row, string color) | None | Sets the foreground color of the specified row to the specified color |
setTableTitleText(string title) | None | Sets the title of the HecDataTableFrame object. |
showTable() | None | Show the table |
1 Fonts are specified as name[,style[,size]] where style is Plain, Bold, Italic, or Bold Italic (e.g. "Arial,BoldItalic,12", "Lucida Console,Plain,10").
2 The coordinate system used is a graphics coordinate system, where X increases to the right and Y increases downward from the origin (0,0) which is located in the top left corner of the display. Locations set or retrieved refer to the top left corner of the plot in reference to this coordinate system.