Learn how to approach your second ticket in the Labs project and understand the development workflow.
View your second ticket details and requirements on GitHub:
Second Ticket DocumentationLearn how to create dynamic visualizations using Altair and integrate them with your monster database.
# Example Visualization Implementation from altair import Chart, Tooltip from pandas import DataFrame def chart(df: DataFrame, x: str, y: str, target: str) -> Chart: """Create an interactive scatter plot visualization. Args: df: DataFrame containing monster data x: Column name for x-axis y: Column name for y-axis target: Column name for color encoding Returns: Altair Chart object """ # Configure chart properties for dark theme properties = { "width": 600, "height": 400, "background": "#2a303c", "padding": 20 } # Create base chart with dark theme configuration graph = Chart( df, title=f"{y} by {x} for {target}", ).mark_circle(size=100).encode( x=x, y=y, color=target, tooltip=Tooltip(df.columns.to_list()) ).properties( **properties ).configure( axis={'labelColor': '#ffffff', 'titleColor': '#ffffff'}, title={'color': '#ffffff'}, view={'stroke': 'transparent'}, background='#2a303c' ) return graph # Example usage in FastAPI endpoint @app.get("/view") async def get_visualization(): df = monster_db.dataframe() if df is not None: chart_obj = chart(df, "strength", "agility", "monster_type") return JSONResponse(content=chart_obj.to_dict())