Dashboard in PNG format
squirrels.dashboards
squirrels
PngDashboard
def __init__( self, content: matplotlib.figure.Figure | io.BytesIO | bytes ) -> None:
Hide arguments
from squirrels.dashboards import PngDashboard from squirrels.arguments import DashboardArgs import matplotlib.pyplot as plt import polars as pl async def main(sqrl: DashboardArgs) -> PngDashboard: # Get dataset df = await sqrl.dataset("sales_data") # Create matplotlib figure fig, ax = plt.subplots(figsize=(10, 6)) # Plot data pandas_df = df.to_pandas() pandas_df.plot(x='date', y='revenue', ax=ax) ax.set_title('Sales Revenue Over Time') ax.set_xlabel('Date') ax.set_ylabel('Revenue ($)') # Return as PngDashboard return PngDashboard(content=fig)
Was this page helpful?