Skip to main content

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

NameDescriptionTypeDefault
figThe Plotly figure to display.AnyNone
labelText label displayed above the chart.str''
keyIdentifier for the widget.str''
full_widthWhether the chart should take up the full width of its container.boolFalse