ralate2 commited on
Commit
78d34ff
·
verified ·
1 Parent(s): a811bf0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -4
app.py CHANGED
@@ -62,13 +62,35 @@ df['Original Issue Year'] = df['Original Issue Date'].dt.year
62
  # else:
63
  # st.write("No data available for the 'License Status' plot.")
64
 
65
- # Visualization 1: Pie chart of licenses by Status with distinct colors and legend
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  st.subheader("Licenses by Status")
67
  category_counts = df['License Status'].value_counts().reset_index()
68
  category_counts.columns = ['License Status', 'Count']
69
 
70
- if not category_counts.empty:
71
- chart1 = alt.Chart(category_counts).mark_arc().encode(
 
 
 
72
  theta=alt.Theta(field="Count", type="quantitative", title="Number of Licenses"),
73
  color=alt.Color(field="License Status", type="nominal", legend=alt.Legend(title="License Status"),
74
  scale=alt.Scale(scheme='pastel1')), # Distinct color scheme
@@ -76,13 +98,14 @@ if not category_counts.empty:
76
  ).properties(
77
  width=400,
78
  height=400,
79
- title="Licenses by Status"
80
  )
81
  st.altair_chart(chart1)
82
  else:
83
  st.write("No data available for the 'License Status' plot.")
84
 
85
 
 
86
  # Write-up for Visualization 1
87
  st.write("""
88
  **Licenses by Status**: This visualization highlights the distribution of licenses across different statuses.
 
62
  # else:
63
  # st.write("No data available for the 'License Status' plot.")
64
 
65
+ # # Visualization 1: Pie chart of licenses by Status with distinct colors and legend
66
+ # st.subheader("Licenses by Status")
67
+ # category_counts = df['License Status'].value_counts().reset_index()
68
+ # category_counts.columns = ['License Status', 'Count']
69
+
70
+ # if not category_counts.empty:
71
+ # chart1 = alt.Chart(category_counts).mark_arc().encode(
72
+ # theta=alt.Theta(field="Count", type="quantitative", title="Number of Licenses"),
73
+ # color=alt.Color(field="License Status", type="nominal", legend=alt.Legend(title="License Status"),
74
+ # scale=alt.Scale(scheme='pastel1')), # Distinct color scheme
75
+ # tooltip=['License Status', 'Count']
76
+ # ).properties(
77
+ # width=400,
78
+ # height=400,
79
+ # title="Licenses by Status"
80
+ # )
81
+ # st.altair_chart(chart1)
82
+ # else:
83
+ # st.write("No data available for the 'License Status' plot.")
84
+
85
  st.subheader("Licenses by Status")
86
  category_counts = df['License Status'].value_counts().reset_index()
87
  category_counts.columns = ['License Status', 'Count']
88
 
89
+ # Select top 5 categories
90
+ category_counts_top5 = category_counts.head(5)
91
+
92
+ if not category_counts_top5.empty:
93
+ chart1 = alt.Chart(category_counts_top5).mark_arc().encode(
94
  theta=alt.Theta(field="Count", type="quantitative", title="Number of Licenses"),
95
  color=alt.Color(field="License Status", type="nominal", legend=alt.Legend(title="License Status"),
96
  scale=alt.Scale(scheme='pastel1')), # Distinct color scheme
 
98
  ).properties(
99
  width=400,
100
  height=400,
101
+ title="Licenses by Status (Top 5)"
102
  )
103
  st.altair_chart(chart1)
104
  else:
105
  st.write("No data available for the 'License Status' plot.")
106
 
107
 
108
+
109
  # Write-up for Visualization 1
110
  st.write("""
111
  **Licenses by Status**: This visualization highlights the distribution of licenses across different statuses.