shyft.dashboard.time_series.view_container.table
Classes
|
|
|
Table class is the view container for a table |
Exceptions
- class shyft.dashboard.time_series.view_container.table.Table(*, viewer: shyft.dashboard.time_series.ts_viewer.TsViewer, width: int = 600, height: int = 600, title: str = '', max_column_width: int | None = None, min_column_width: int = 120, visible: bool = True, time_formatter: ~typing.Callable[[~typing.Iterable, str], ~typing.List[str]] = <function basic_time_formatter>, tools: ~typing.List[TableTool] | TableTool = None, logger: logging.Logger | None = None, alternative_view_time_axis: ~shyft.dashboard.time_series.axes_handler.BaseViewTimeAxis = None)[source]
Bases:
BaseViewContainer
Table class is the view container for a table
Examples
# create the viewer appviewer = TsViewer(bokeh_document=doc, title=’Test Ts Viewer’)# create view containertable1 = Table(viewer=viewer, tools=[])# create a data sourcedata_source = DataSource(ts_adapter=A_time_series_adapter(unit_to_decorate=’MW’), unit=’MW’,request_time_axis_type=DsViewTimeAxisType.padded_view_time_axis,time_range=UtcPeriod(start_time, end_time))# create a view in where we put the view containertable_view = TableView(view_container_uid=table1.uid, columns={0: ‘column 1’, 1: ‘column 2’},label=’Generic Label’)# create a handle for the data source and list of views connected to the data sourceds_view_handle = DsViewHandle(data_source=data_source, views=[table_view, line_view, fill_in_between_view])# add views and data source to the viewerviewer.add_ds_view_handles(ds_view_handles=[ds_view_handle])- __init__(*, viewer: shyft.dashboard.time_series.ts_viewer.TsViewer, width: int = 600, height: int = 600, title: str = '', max_column_width: int | None = None, min_column_width: int = 120, visible: bool = True, time_formatter: ~typing.Callable[[~typing.Iterable, str], ~typing.List[str]] = <function basic_time_formatter>, tools: ~typing.List[TableTool] | TableTool = None, logger: logging.Logger | None = None, alternative_view_time_axis: ~shyft.dashboard.time_series.axes_handler.BaseViewTimeAxis = None) None [source]
- Parameters:
viewer – which TsViewer it is connected to
width – pixel width of the table
height – pixel height of the table
title – title of the table
max_column_width – sets an upper limit of the size of the columns, if None upper = infinite
min_column_width – sets a lower limit of the size of the columns
visible – switch for visibility
time_formatter – the time format of the time column
tools – optional table tools see table tools/table_tools.py
- property layout: Any
This property returns the preferred layout of the view_container
- property layout_components: Dict[str, List[Any]]
This property returns all layout components of the view_container
- property visible: bool
This property returns the visibility of the table
- update_stored_view_data()[source]
This function only updates the time series who are stored within the view container
- update_view_data(*, view_data: Dict[TableView, Quantity[TsVector]]) None [source]
This function updates the table with new data as sent in by view_data
- prepare_data_and_update_data_source(needs_data_source_update: bool = True)[source]
This function prepares all the view data and creates the bokeh data and table columns that should be updated and updates the data source
- reset_columns()[source]
This function uses the stored time series and sets all columns but the time column to nothing
- view_range_callback() None [source]
This callback is triggered whenever the view range changes view_range = self.view_time_axis.view_range
- estimate_view_range_indices() None [source]
Indices of aligned time, such that i0 <= view range <= i1.
If the overlap of view range and aligned time is zero, no indices are set for view_range_indices (empty list).
Examples:
1) aligned_time: |t_a0 |t_a1 |t_a2 |t_a3 view range: |---------------| # self.view_range_indices = [0, 2] 2) aligned_time: |t_a0 |t_a1 |t_a2 |t_a3 view range: |---------------| # self.view_range_indices = [2, 3] 3) aligned_time: |t_a0 |t_a1 |t_a2 |t_a3 view range: |---------| # self.view_range_indices = []
- clear() None [source]
This function removes all views from the view_container and resets the meta data
- clear_views(*, specific_views: List[TableView] | None = None) None [source]
This function removes all or specific views from the view container
- class shyft.dashboard.time_series.view_container.table.StatisticsTable(*, viewer: shyft.dashboard.time_series.ts_viewer.TsViewer, width: int = 600, height: int = 600, title: str = '', name_column_width: int = 300, max_column_width: int | None = None, min_column_width: int = 120, visible: bool = True, time_formatter: ~typing.Callable[[~numpy.ndarray, str], ~typing.List[str]] = <function basic_time_formatter>, tools: ~typing.List[TableTool] | TableTool = None, logger: logging.Logger | None = None, alternative_view_time_axis: ~shyft.dashboard.time_series.axes_handler.BaseViewTimeAxis = None)[source]
Bases:
Table
- __init__(*, viewer: shyft.dashboard.time_series.ts_viewer.TsViewer, width: int = 600, height: int = 600, title: str = '', name_column_width: int = 300, max_column_width: int | None = None, min_column_width: int = 120, visible: bool = True, time_formatter: ~typing.Callable[[~numpy.ndarray, str], ~typing.List[str]] = <function basic_time_formatter>, tools: ~typing.List[TableTool] | TableTool = None, logger: logging.Logger | None = None, alternative_view_time_axis: ~shyft.dashboard.time_series.axes_handler.BaseViewTimeAxis = None) None [source]
- Parameters:
viewer – which TsViewer it is connected to
width – pixel width of the table
height – pixel height of the table
title – title of the table
max_column_width – sets an upper limit of the size of the columns, if None upper = infinite
min_column_width – sets a lower limit of the size of the columns
visible – switch for visibility
time_formatter – the time format of the time column
tools – optional table tools see table tools/table_tools.py
- prepare_data_and_update_data_source(needs_data_source_update: bool = True)[source]
This function prepares all the view data and creates the bokeh data and table columns that should be updated and updates the data source