Spaces:
Sleeping
Sleeping
File size: 1,387 Bytes
06eed18 |
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
import streamlit as st
import matplotlib.pyplot as plt
def display_dashboard(df):
"""
Display system-wide summary metrics on the dashboard.
:param df: DataFrame containing the pole data.
"""
st.subheader("📊 System Summary")
# Columns to display different metrics
col1, col2, col3 = st.columns(3)
# Total Poles
col1.metric("Total Poles", df.shape[0])
# Red Alerts
col2.metric("🚨 Red Alerts", df[df['Alert Level'] == "Red"].shape[0])
# Power Insufficiency Issues
col3.metric("⚡ Power Issues", df[df['Power Sufficient'] == "No"].shape[0])
def display_charts(df):
"""
Display charts for energy generation and tilt vs vibration.
:param df: DataFrame containing the pole data.
"""
st.subheader("⚙️ Energy Generation Trends")
# Plot bar chart for Solar and Wind Generation
fig, ax = plt.subplots(figsize=(10, 6))
df.set_index("Pole ID")[["Solar Gen (kWh)", "Wind Gen (kWh)"]].plot(kind="bar", ax=ax)
ax.set_ylabel("Energy Generation (kWh)")
ax.set_xlabel("Pole ID")
st.pyplot(fig)
st.subheader("📉 Tilt vs Vibration")
# Plot scatter chart for Tilt vs Vibration
fig, ax = plt.subplots(figsize=(10, 6))
ax.scatter(df["Tilt (°)"], df["Vibration (g)"], color='blue')
ax.set_xlabel("Tilt (°)")
ax.set_ylabel("Vibration (g)")
st.pyplot(fig)
|