Table display

dash_fcast.Table

class dash_fcast.Table(id, bins=[0, 0.25, 0.5, 0.75, 1], datatable={}, row_addable=False) [source]

Parameters and attributes: id : str

Table identifier.

bins : list, default=[0, .25, .5, .75, 1]

List of bin 'breakpoints'. Bins are contiguous. The first bin starts at bins[0]. The last bin ends at bins[-1].

datatable : dict, default={}

Keyword arguments passed to the datatable in which table data are displayed.

row_addable : bool, default=False

Indicates that users can add rows to the table.

Methods

get_id(id, type='state') [source]

Parameters: id : str

type : str, default='state'

Type of object associated with the table.

Returns: id dictionary : dict

Dictionary identifier.

get_table(self, **kwargs) [source]

Parameters: **kwargs :

Keyword arguments for dash_table.DataTable.

Returns: data table : dash_table.DataTable

get_columns(self) [source]

Returns: columns : list of dicts

List of column dictionaries in dash_table columns format.

get_data(self, bins=None, distributions=[], data=[]) [source]

Parameters: bins : list of scalars or None, default=None

If None this method uses self.bins.

distributions : list, default=[]

List of distributions like those specified in dash_fcast.distributions.

data : list of dicts, default=[]

Existing data in records format. If a bin matches existing data, that record is returned without updating the distribution pdfs.

Returns: records : list

List of records (dictionaries) mapping column ids to data entry.

register_callbacks(app) [source]

Register dash callbacks for table display.

Parameters: app : dash.Dash

App with which to register the callbacks.

dump(self) [source]

Returns: state_dict : JSON dict

Dictionary representing the table state.

load(cls, state_dict) [source]

Parameters: state_dict : JSON dict

Table state dictionary; output from dash_fcast.Table.dump.

Returns: table : dash_fcast.Table

Table specified by the table state.

bar_plot(self, col, **kwargs) [source]

Parameters: col : str

ID of the column (distribution) to plot.

**kwargs :

Keyword arguments passed to go.Bar.

Returns: bar plot : go.Bar