VisualizationOutput#

class openstef_beam.analysis.VisualizationOutput(name: str, figure: Figure | None = None, html: str | None = None)[source]#

Bases: object

A generated visualization from evaluation data.

Represents a single chart, plot, or visual analysis that can be saved as HTML. Contains either a Plotly figure object for interactive visualizations or raw HTML content for static displays.

Example

Creating a visualization from a Plotly figure:

>>> import plotly.graph_objects as go
>>> fig = go.Figure(data=go.Scatter(x=[1, 2, 3], y=[4, 5, 6]))
>>> viz = VisualizationOutput("my_chart", figure=fig)
>>> viz.get_file_name()
'my_chart.html'
Parameters:
  • name (str)

  • figure (Figure | None)

  • html (str | None)

__init__(name: str, figure: Figure | None = None, html: str | None = None)[source]#

Initialize visualization output with either a figure or HTML content.

Parameters:
  • name (str) – Name identifier for the visualization.

  • figure (Figure | None) – Plotly figure object, if available.

  • html (str | None) – Raw HTML string content, if available.

  • name

  • figure

  • html

Raises:

ValueError – If neither figure nor html is provided.

write_html(file_path: Path, **kwargs: dict[str, Any]) None[source]#

Write the plotly figure or HTML string to an HTML file.

Raises:

ValueError – If neither figure nor HTML content is available.

Parameters:
  • file_path (Path)

  • kwargs (dict[str, Any])

Return type:

None

get_file_name() str[source]#

Return the file name for the visualization.

Return type:

str