Spaces:
Runtime error
Runtime error
map colors to categories
Browse files
app.py
CHANGED
@@ -108,7 +108,7 @@ def donut_chart_total() -> alt.Chart:
|
|
108 |
{
|
109 |
"values": [annotated_records, pending_records],
|
110 |
"category": [ANNOTATED, PENDING],
|
111 |
-
"colors": ["#27AE60", "#F1C40F"], # Green for Completed,
|
112 |
}
|
113 |
)
|
114 |
|
@@ -117,7 +117,11 @@ def donut_chart_total() -> alt.Chart:
|
|
117 |
radius=alt.Radius(
|
118 |
"values", scale=alt.Scale(type="sqrt", zero=True, rangeMin=20)
|
119 |
),
|
120 |
-
|
|
|
|
|
|
|
|
|
121 |
)
|
122 |
|
123 |
c1 = base.mark_arc(innerRadius=20, stroke="#fff")
|
|
|
108 |
{
|
109 |
"values": [annotated_records, pending_records],
|
110 |
"category": [ANNOTATED, PENDING],
|
111 |
+
"colors": ["#27AE60", "#F1C40F"], # Green for Completed, Yellow for Remaining
|
112 |
}
|
113 |
)
|
114 |
|
|
|
117 |
radius=alt.Radius(
|
118 |
"values", scale=alt.Scale(type="sqrt", zero=True, rangeMin=20)
|
119 |
),
|
120 |
+
|
121 |
+
color=alt.Color(
|
122 |
+
"category:N",
|
123 |
+
scale=alt.Scale(domain=source['category'], range=source['colors']), # Map colors to categories
|
124 |
+
legend=alt.Legend(title=CATEGORY)
|
125 |
)
|
126 |
|
127 |
c1 = base.mark_arc(innerRadius=20, stroke="#fff")
|