ZennyKenny commited on
Commit
4d03e57
·
verified ·
1 Parent(s): 3168e20

map colors to categories

Browse files
Files changed (1) hide show
  1. app.py +6 -2
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, Grey for Remaining
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
- color=alt.Color("category:N", range=source['colors'], legend=alt.Legend(title=CATEGORY)),
 
 
 
 
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")