dvilasuero HF staff commited on
Commit
43e8ee5
1 Parent(s): 78802f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -18
app.py CHANGED
@@ -62,6 +62,7 @@ def get_user_annotations_dictionary(
62
 
63
  return output
64
 
 
65
  def donut_chart2() -> alt.Chart:
66
  # Load your data
67
  source_dataset, results = obtain_source_target_datasets()
@@ -85,26 +86,13 @@ def donut_chart2() -> alt.Chart:
85
  # Arc marks for donut segments
86
  arcs = base.mark_arc(innerRadius=100, outerRadius=150, stroke="#fff") # Increased inner radius for a thicker donut
87
 
88
- # Calculate the midpoints of the arc segments for label placement
89
- text_df = pd.DataFrame({
90
- 'start_angle': [0],
91
- 'end_angle': [360 * annotated_records / (annotated_records + pending_records)]
92
- })
93
- text_df = text_df.append({
94
- 'start_angle': text_df.iloc[0]['end_angle'],
95
- 'end_angle': 360
96
- }, ignore_index=True)
97
- text_df['mid_angle'] = (text_df['start_angle'] + text_df['end_angle']) / 2
98
-
99
- # Create labels based on the mid_angle for better placement
100
- text = alt.Chart(text_df).mark_text(radius=120, size=20, color='black').encode(
101
- text=alt.Text('mid_angle:O', format='.1f'),
102
- angle=alt.Angle('mid_angle:Q')
103
  )
104
 
105
- # Combine the arcs and text
106
- chart = arcs + text
107
-
108
  # Configure the view to have a transparent background
109
  chart = chart.configure_view(
110
  strokeWidth=0, # Remove border around chart
@@ -114,6 +102,7 @@ def donut_chart2() -> alt.Chart:
114
  return chart
115
 
116
 
 
117
  def donut_chart() -> alt.Chart:
118
  # Load your data
119
  source_dataset, results = obtain_source_target_datasets()
 
62
 
63
  return output
64
 
65
+
66
  def donut_chart2() -> alt.Chart:
67
  # Load your data
68
  source_dataset, results = obtain_source_target_datasets()
 
86
  # Arc marks for donut segments
87
  arcs = base.mark_arc(innerRadius=100, outerRadius=150, stroke="#fff") # Increased inner radius for a thicker donut
88
 
89
+ # Combine the arcs
90
+ chart = arcs.properties(
91
+ # Set the size of the chart
92
+ width=400,
93
+ height=400
 
 
 
 
 
 
 
 
 
 
94
  )
95
 
 
 
 
96
  # Configure the view to have a transparent background
97
  chart = chart.configure_view(
98
  strokeWidth=0, # Remove border around chart
 
102
  return chart
103
 
104
 
105
+
106
  def donut_chart() -> alt.Chart:
107
  # Load your data
108
  source_dataset, results = obtain_source_target_datasets()