File size: 789 Bytes
266f4c7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
from __future__ import annotations

import pandas as pd
import plotly.express as px
import plotly.graph_objects as go


def create_exit_velocity_chart(df: pd.DataFrame) -> go.Figure:
    if df.empty or "launch_speed" not in df.columns:
        return go.Figure()

    fig = px.histogram(
        df,
        x="launch_speed",
        nbins=30,
        title="Exit Velocity Distribution",
    )
    fig.update_layout(template="plotly_dark")
    return fig


def create_launch_angle_chart(df: pd.DataFrame) -> go.Figure:
    if df.empty or "launch_angle" not in df.columns:
        return go.Figure()

    fig = px.histogram(
        df,
        x="launch_angle",
        nbins=30,
        title="Launch Angle Distribution",
    )
    fig.update_layout(template="plotly_dark")
    return fig