Spaces:
Sleeping
Sleeping
Commit
•
db78e5a
1
Parent(s):
fa83549
Update app.py
Browse files
app.py
CHANGED
@@ -64,6 +64,10 @@ def get_user_annotations_dictionary(
|
|
64 |
|
65 |
|
66 |
|
|
|
|
|
|
|
|
|
67 |
import altair as alt
|
68 |
import pandas as pd
|
69 |
import os
|
@@ -83,7 +87,7 @@ def donut_chart() -> alt.Chart:
|
|
83 |
|
84 |
# Create the base of the donut chart
|
85 |
base = alt.Chart(source).encode(
|
86 |
-
theta=alt.Theta(field="values", type="quantitative"
|
87 |
color=alt.Color(field="color", type="nominal", legend=None), # Use the colors defined in the DataFrame
|
88 |
tooltip=["category", "values"]
|
89 |
)
|
@@ -91,10 +95,10 @@ def donut_chart() -> alt.Chart:
|
|
91 |
# Create the arcs for the donut chart
|
92 |
arcs = base.mark_arc(innerRadius=100, outerRadius=120, stroke="#fff")
|
93 |
|
94 |
-
# Add text labels
|
95 |
-
text = base.mark_text(
|
96 |
text=alt.Text("values:Q"),
|
97 |
-
|
98 |
)
|
99 |
|
100 |
# Combine the arcs and text
|
|
|
64 |
|
65 |
|
66 |
|
67 |
+
import altair as alt
|
68 |
+
import pandas as pd
|
69 |
+
import os
|
70 |
+
|
71 |
import altair as alt
|
72 |
import pandas as pd
|
73 |
import os
|
|
|
87 |
|
88 |
# Create the base of the donut chart
|
89 |
base = alt.Chart(source).encode(
|
90 |
+
theta=alt.Theta(field="values", type="quantitative"),
|
91 |
color=alt.Color(field="color", type="nominal", legend=None), # Use the colors defined in the DataFrame
|
92 |
tooltip=["category", "values"]
|
93 |
)
|
|
|
95 |
# Create the arcs for the donut chart
|
96 |
arcs = base.mark_arc(innerRadius=100, outerRadius=120, stroke="#fff")
|
97 |
|
98 |
+
# Add text labels
|
99 |
+
text = base.mark_text(radiusOffset=20, size=20).encode(
|
100 |
text=alt.Text("values:Q"),
|
101 |
+
color=alt.value('black') # Setting text color to black for better readability
|
102 |
)
|
103 |
|
104 |
# Combine the arcs and text
|