Skip to content

edsteva.viz.dashboards.probe.probe

probe_only_dashboard

probe_only_dashboard(
    predictor: pd.DataFrame,
    x_axis_title: str,
    y_axis_title: str,
    main_chart_config: Dict[str, float],
    vertical_bar_charts_config: Dict[str, str],
    horizontal_bar_charts_config: Dict[str, str],
    time_line_config: Dict[str, str],
    chart_style: Dict[str, float],
)

Script to be used by predictor_dashboard()

PARAMETER DESCRIPTION
predictor

\(c(t)\) computed in the Probe.

TYPE: pd.DataFrame

x_axis_title

Label name for the x axis.

TYPE: str

y_axis_title

Label name for the y axis.

TYPE: str

main_chart_config

If not None, configuration used to construct the top main chart.

TYPE: Dict[str, float]

vertical_bar_charts_config

If not None, configuration used to construct the vertical bar charts.

TYPE: Dict[str, str]

horizontal_bar_charts_config

If not None, configuration used to construct the horizontal bar charts.

TYPE: Dict[str, str]

time_line_config

If not None, configuration used to construct the time line.

TYPE: Dict[str, str]

chart_style

If not None, configuration used to configure the chart style. EXAMPLE: {"labelFontSize": 13, "titleFontSize": 14}

TYPE: Dict[str, float]

Source code in edsteva/viz/dashboards/probe/probe.py
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
def probe_only_dashboard(
    predictor: pd.DataFrame,
    x_axis_title: str,
    y_axis_title: str,
    main_chart_config: Dict[str, float],
    vertical_bar_charts_config: Dict[str, str],
    horizontal_bar_charts_config: Dict[str, str],
    time_line_config: Dict[str, str],
    chart_style: Dict[str, float],
):
    """Script to be used by [``predictor_dashboard()``][edsteva.viz.dashboards.probe.wrapper]

    Parameters
    ----------
    predictor : pd.DataFrame
        $c(t)$ computed in the Probe.
    x_axis_title: str, optional,
        Label name for the x axis.
    y_axis_title: str, optional,
        Label name for the y axis.
    main_chart_config: Dict[str, str], optional
        If not None, configuration used to construct the top main chart.
    vertical_bar_charts_config: Dict[str, str], optional
        If not None, configuration used to construct the vertical bar charts.
    horizontal_bar_charts_config: Dict[str, str], optional
        If not None, configuration used to construct the horizontal bar charts.
    time_line_config: Dict[str, str], optional
        If not None, configuration used to construct the time line.
    chart_style: Dict[str, float], optional
        If not None, configuration used to configure the chart style.
        **EXAMPLE**: `{"labelFontSize": 13, "titleFontSize": 14}`
    """

    base = alt.Chart(predictor)
    time_line, time_selection = generate_time_line(
        base=base,
        time_line_config=time_line_config,
    )
    horizontal_bar_charts, y_variables_selections = generate_horizontal_bar_charts(
        base=base,
        horizontal_bar_charts_config=horizontal_bar_charts_config,
        predictor=predictor,
    )
    vertical_bar_charts, x_variables_selections = generate_vertical_bar_charts(
        base=base,
        vertical_bar_charts_config=vertical_bar_charts_config,
        predictor=predictor,
    )
    selections = dict(
        date=time_selection,
        **y_variables_selections,
        **x_variables_selections,
    )
    selection_charts = dict(
        horizontal_bar_charts,
        **vertical_bar_charts,
    )
    base = add_interactive_selection(
        base=base, selection_charts=selection_charts, selections=selections
    )

    index_selection, index_fields = create_groupby_selection(
        indexes=vertical_bar_charts_config["x"] + horizontal_bar_charts_config["y"],
        predictor=predictor,
    )
    main_chart = generate_main_chart(
        base=base,
        main_chart_config=main_chart_config,
        index_selection=index_selection,
        index_fields=index_fields,
        x_axis_title=x_axis_title,
        y_axis_title=y_axis_title,
    )

    main_chart = main_chart.mark_line()
    main_chart = add_selection_on_legend(main_chart)
    if index_selection:
        main_chart = main_chart.add_params(index_selection)
    chart = concatenate_charts(
        main_chart=main_chart,
        time_line=time_line,
        horizontal_bar_charts=horizontal_bar_charts,
        vertical_bar_charts=vertical_bar_charts,
    )
    return configure_style(chart=chart, chart_style=chart_style)