Sirivennela commited on
Commit
37e00b8
Β·
verified Β·
1 Parent(s): a1559d1

Create Visualization Code

Browse files
Files changed (1) hide show
  1. Visualization Code +55 -0
Visualization Code ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # πŸ“‹ Show Filtered Data Table
2
+ st.subheader("πŸ“‹ Pole Data Table")
3
+ st.dataframe(filtered_df)
4
+
5
+ # πŸ”‹ Bar Chart - Power Generation
6
+ st.subheader("πŸ”‹ Power Generation per Pole")
7
+ fig_bar = px.bar(
8
+ filtered_df,
9
+ x='Name',
10
+ y='Power_Generation__c',
11
+ color='Status__c',
12
+ labels={'Power_Generation__c': 'Power Generated (kWh)'},
13
+ title="Power Output by Pole",
14
+ height=400
15
+ )
16
+ st.plotly_chart(fig_bar, use_container_width=True)
17
+
18
+ # ⚠️ Pie Chart - Fault Status Distribution
19
+ st.subheader("⚠️ Fault Status Distribution")
20
+ fault_data = filtered_df['Fault_Status__c'].value_counts().reset_index()
21
+ fault_data.columns = ['Fault Status', 'Count']
22
+ fig_pie = px.pie(
23
+ fault_data,
24
+ names='Fault Status',
25
+ values='Count',
26
+ title="Fault Breakdown",
27
+ height=400
28
+ )
29
+ st.plotly_chart(fig_pie, use_container_width=True)
30
+
31
+ # πŸ•’ Line Chart - Pole Installations Over Time
32
+ st.subheader("πŸ•’ Installation Trend")
33
+ install_trend = filtered_df.groupby(filtered_df['Installed_Date__c'].dt.to_period('M')).size()
34
+ install_trend.index = install_trend.index.to_timestamp()
35
+ fig_line_install = px.line(
36
+ x=install_trend.index,
37
+ y=install_trend.values,
38
+ labels={"x": "Month", "y": "Poles Installed"},
39
+ title="Pole Installations Over Time",
40
+ markers=True
41
+ )
42
+ st.plotly_chart(fig_line_install, use_container_width=True)
43
+
44
+ # πŸ› οΈ Line Chart - Maintenance Activity
45
+ st.subheader("πŸ› οΈ Maintenance Trend")
46
+ maintenance_trend = filtered_df.groupby(filtered_df['Last_Maintenance_Date__c'].dt.to_period('M')).size()
47
+ maintenance_trend.index = maintenance_trend.index.to_timestamp()
48
+ fig_line_maint = px.line(
49
+ x=maintenance_trend.index,
50
+ y=maintenance_trend.values,
51
+ labels={"x": "Month", "y": "Maintenance Events"},
52
+ title="Maintenance Activities Over Time",
53
+ markers=True
54
+ )
55
+ st.plotly_chart(fig_line_maint, use_container_width=True)