chartbook.plotting._output#

Output file management for chartbook.plotting.

Module Contents#

Functions#

create_chart_result

Create a ChartResult with the Plotly figure.

create_dual_chart_result

Create a ChartResult for a dual-axis chart.

save_chart_from_result

Save a ChartResult to multiple formats.

API#

chartbook.plotting._output.create_chart_result(df: pandas.DataFrame, config: chartbook.plotting._types.ChartConfig, overlay: chartbook.plotting._types.OverlayConfig) chartbook.plotting._types.ChartResult[source]#

Create a ChartResult with the Plotly figure.

This is the main entry point for creating charts. It builds the Plotly figure and returns a ChartResult that can be displayed or saved.

Parameters

df : DataFrame Data to plot. config : ChartConfig Chart configuration. overlay : OverlayConfig Overlay configuration.

Returns

ChartResult Object containing the figure and methods to display/save.

chartbook.plotting._output.create_dual_chart_result(df: pandas.DataFrame, config: chartbook.plotting._types.DualAxisConfig, overlay: chartbook.plotting._types.OverlayConfig) chartbook.plotting._types.ChartResult[source]#

Create a ChartResult for a dual-axis chart.

Parameters

df : DataFrame Data to plot. config : DualAxisConfig Dual-axis chart configuration. overlay : OverlayConfig Overlay configuration.

Returns

ChartResult Object containing the figure and methods to display/save.

chartbook.plotting._output.save_chart_from_result(result: chartbook.plotting._types.ChartResult, output_dir: str | pathlib.Path | None = None, interactive: bool = True) None[source]#

Save a ChartResult to multiple formats.

This is called by ChartResult.save() to do the actual file generation. It modifies the result in-place, populating the path attributes.

Parameters

result : ChartResult The chart result to save. Must have chart_id set. output_dir : str | Path, optional Directory to save files. Default: global config default_output_dir. interactive : bool Whether to generate interactive HTML.