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.

  • data (pd.DataFrame) – [description]

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

  • help_uri (str) – [description]

  • plot_type (str) – [description]


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: str | None, color: str) Tuple[DataFrame, DataFrame, Set[str], int]

Group input data and add indexes and tooltips.

  • 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


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: str | None = 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: 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) Tuple[bokeh.palettes.Palette, int]

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[Any | None, 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: DataFrame | None = None, ref_col: str | None = None, ref_times: List[Tuple[datetime, str]] | None = 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.