Spaces:
Sleeping
Sleeping
import dash | |
from dash import dcc, html | |
import plotly.express as px | |
import pandas as pd | |
import numpy as np | |
# Define sites and poles | |
sites = ['Hyderabad', 'Karnrol', 'Bangalore', 'Ongol'] | |
num_poles_per_site = 12 | |
# Generate random data | |
data = [] | |
for site in sites: | |
for pole_id in range(1, num_poles_per_site + 1): | |
data.append({ | |
'Site': site, | |
'Pole ID': f'Pole {pole_id}', | |
'Status': np.random.randint(0, 100) # Simulated metric | |
}) | |
df = pd.DataFrame(data) | |
# Pivot for heatmap | |
heatmap_data = df.pivot(index='Site', columns='Pole ID', values='Status') | |
# Create heatmap | |
fig = px.imshow( | |
heatmap_data, | |
labels=dict(x="Pole ID", y="Site", color="Status"), | |
color_continuous_scale="Viridis" | |
) | |
# Dash App | |
app = dash.Dash(__name__) | |
app.title = "Pole Management Heatmap" | |
app.layout = html.Div([ | |
html.H1("Pole Management Heatmap", style={'textAlign': 'center'}), | |
dcc.Graph(figure=fig) | |
]) | |
if __name__ == '__main__': | |
app.run_server(debug=True, host='0.0.0.0', port=7860) | |