Documentation Index Fetch the complete documentation index at: https://docs.pysquirrels.com/llms.txt
Use this file to discover all available pages before exploring further.
Instantiate a dashboard from an HTML string inside a Python dashboard file.
This class can be imported from the squirrels.dashboards or the squirrels module.
Constructor
Creates a HtmlDashboard object.
def __init__ ( self , content : io.StringIO | str ) -> None :
content
io.StringIO | str
required
The content of the dashboard as an HTML string.
Example
Here’s an example of creating an HTML dashboard with Plotly:
from squirrels.dashboards import HtmlDashboard
from squirrels.arguments import DashboardArgs
import plotly.express as px
async def main ( sqrl : DashboardArgs) -> HtmlDashboard:
# Get dataset
df = await sqrl.dataset( "sales_data" )
# Create interactive plotly chart
fig = px.line(
df.to_pandas(),
x = 'date' ,
y = 'revenue' ,
title = 'Sales Revenue Over Time'
)
# Convert to HTML
html_content = fig.to_html( include_plotlyjs = 'cdn' )
# Return as HtmlDashboard
return HtmlDashboard( content = html_content)