PlotlyOutput
Plotly figure output widget for displaying interactive charts.
Examples
Basic Usage
This example runs a form with a single page containing the widget
Example Code
import plotly.graph_objects as go
from abstra.forms import PlotlyOutput, run
figure = go.Figure(
data=[go.Bar(x=[1, 2, 3], y=[1, 3, 2])],
layout=go.Layout(title=go.layout.Title(text="Bar chart example")),
)
# Create a page with the widget
example_page = [
PlotlyOutput(
fig=figure,
label="Bar chart example",
key="my-plotly-output",
full_width=True,
)
]
# Run the form
result = run([example_page])
# Print the result
print(result)
Parameters
Name | Description | Type | Default |
---|---|---|---|
fig | The Plotly figure to display. | Any | None |
label | Text label displayed above the chart. | str | '' |
key | Identifier for the widget. | str | '' |
full_width | Whether the chart should take up the full width of its container. | bool | False |