msticpy.vis.timeline_common module

Module for common timeline functions.

msticpy.vis.timeline_common.calc_auto_plot_height(group_count: int) int

Dynamic calculation of plot height.

msticpy.vis.timeline_common.check_df_columns(data: DataFrame, req_columns: List[str], help_uri: str, plot_type: str)

Check that specified columns are in the DataFrame.

Parameters
  • data (pd.DataFrame) – [description]

  • req_columns (List[str]) – [description]

  • help_uri (str) – [description]

  • plot_type (str) – [description]

Raises

MsticpyParameterError – If one or more columns not found in data

msticpy.vis.timeline_common.create_data_grouping(data: DataFrame, source_columns: List[str], time_column: str, group_by: Optional[str], color: str) Tuple[DataFrame, DataFrame, Set[str], int]

Group input data and add indexes and tooltips.

Parameters
  • data (pd.DataFrame) – Input dataframe

  • source_columns (List[str]) – Tooltip columns

  • time_column (str) – Name of the time column

  • group_by (str) – Name of the group_by column

  • color (str) – Plot color

Returns

Tuple of grouped dataframe, group color dataframe, set of tooltip columns, the number of groups created.

Return type

Tuple[pd.DataFrame, pd.DataFrame, Set[str], int]

msticpy.vis.timeline_common.create_range_tool(data: DataFrame, min_time: Timestamp, max_time: Timestamp, plot_range: bokeh.models.Range, width: int, height: int, time_column: Optional[str] = None, y: str = 'y_index') bokeh.plotting.Figure

Create plot bar to act as as range selector.

msticpy.vis.timeline_common.create_tool_tips(data: Union[DataFrame, Dict[str, DataFrame]], columns: Iterable[str]) Dict[str, Any]

Create formatting for tool tip columns.

msticpy.vis.timeline_common.get_color_palette(series_count: int) bokeh.palettes.Palette

Return palette based on series size.

msticpy.vis.timeline_common.get_def_source_cols(data: DataFrame, source_columns: Iterable[str]) Set[str]

Get default set of columns (backward compat).

msticpy.vis.timeline_common.get_ref_event_time(**kwargs) Tuple[Optional[Any], Union[Any, str]]

Extract the reference time from kwargs.

msticpy.vis.timeline_common.get_tick_formatter() bokeh.models.DatetimeTickFormatter

Return tick formatting for different zoom levels.

msticpy.vis.timeline_common.get_time_bounds(min_time: Timestamp, max_time: Timestamp) Tuple[Timestamp, Timestamp, Timestamp, Timestamp]

Return start and end range, coping with out-of-bounds error.

msticpy.vis.timeline_common.plot_ref_events(plot: bokeh.plotting.Figure, time_col: str, group_count: int, ref_events: Optional[DataFrame] = None, ref_col: Optional[str] = None, ref_times: Optional[List[Tuple[datetime, str]]] = None)

Plot reference lines/labels.

msticpy.vis.timeline_common.plot_ref_line(plot: bokeh.models.LayoutDOM, ref_time: datetime, ref_text: str = 'Ref time', series_count: int = 1, index: int = 0)

Add a reference marker line and label at ref_time.

msticpy.vis.timeline_common.set_axes_and_grids(data: DataFrame, plot: bokeh.plotting.Figure, show_yaxis: bool, ygrid: bool, xgrid: bool)

Set the axes visibility and grids according to parameters.