Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -61,19 +61,42 @@ If I had more time, I would have enhanced the visualisation by adding interactiv
|
|
| 61 |
|
| 62 |
|
| 63 |
# Visualization 2: Line chart showing licenses issued over time
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 64 |
st.subheader("Licenses Over Time")
|
|
|
|
| 65 |
time_data = df.groupby('Original Issue Year').size().reset_index(name='License Count')
|
| 66 |
|
| 67 |
if not time_data.empty:
|
| 68 |
-
chart2 = alt.Chart(time_data).mark_line().encode(
|
| 69 |
-
x=alt.X('Original Issue Year', title='Year'),
|
| 70 |
-
y=alt.Y('License Count', title='Number of Licenses'),
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
color=alt.value('blue')
|
| 72 |
).properties(
|
| 73 |
width=600,
|
| 74 |
height=400,
|
| 75 |
title="Number of Licenses Issued Over Time"
|
| 76 |
-
)
|
|
|
|
| 77 |
st.altair_chart(chart2)
|
| 78 |
else:
|
| 79 |
st.write("No data available for the 'Licenses Over Time' plot.")
|
|
|
|
| 61 |
|
| 62 |
|
| 63 |
# Visualization 2: Line chart showing licenses issued over time
|
| 64 |
+
# st.subheader("Licenses Over Time")
|
| 65 |
+
# time_data = df.groupby('Original Issue Year').size().reset_index(name='License Count')
|
| 66 |
+
|
| 67 |
+
# if not time_data.empty:
|
| 68 |
+
# chart2 = alt.Chart(time_data).mark_line().encode(
|
| 69 |
+
# x=alt.X('Original Issue Year', title='Year'),
|
| 70 |
+
# y=alt.Y('License Count', title='Number of Licenses'),
|
| 71 |
+
# color=alt.value('blue')
|
| 72 |
+
# ).properties(
|
| 73 |
+
# width=600,
|
| 74 |
+
# height=400,
|
| 75 |
+
# title="Number of Licenses Issued Over Time"
|
| 76 |
+
# )
|
| 77 |
+
# st.altair_chart(chart2)
|
| 78 |
+
# else:
|
| 79 |
+
# st.write("No data available for the 'Licenses Over Time' plot.")
|
| 80 |
+
|
| 81 |
st.subheader("Licenses Over Time")
|
| 82 |
+
|
| 83 |
time_data = df.groupby('Original Issue Year').size().reset_index(name='License Count')
|
| 84 |
|
| 85 |
if not time_data.empty:
|
| 86 |
+
chart2 = alt.Chart(time_data).mark_line(point=True).encode(
|
| 87 |
+
x=alt.X('Original Issue Year:O', title='Year'), # Ordinal scale for better control
|
| 88 |
+
y=alt.Y('License Count:Q', title='Number of Licenses'),
|
| 89 |
+
tooltip=[
|
| 90 |
+
alt.Tooltip('Original Issue Year:O', title='Year'),
|
| 91 |
+
alt.Tooltip('License Count:Q', title='Number of Licenses')
|
| 92 |
+
],
|
| 93 |
color=alt.value('blue')
|
| 94 |
).properties(
|
| 95 |
width=600,
|
| 96 |
height=400,
|
| 97 |
title="Number of Licenses Issued Over Time"
|
| 98 |
+
).interactive() # Enables zooming and panning
|
| 99 |
+
|
| 100 |
st.altair_chart(chart2)
|
| 101 |
else:
|
| 102 |
st.write("No data available for the 'Licenses Over Time' plot.")
|