Sarvamangalak commited on
Commit
623b383
·
verified ·
1 Parent(s): f85e605

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -3
app.py CHANGED
@@ -66,6 +66,37 @@ def generate_bar_chart():
66
  max_count = max([c for _, c in data], default=1)
67
  x = 70
68
 
69
- for vtype, count in data:
70
- bar_height = int((count / max_count) * 180)
71
- cv2.rectangle(chart, (x,2))
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  max_count = max([c for _, c in data], default=1)
67
  x = 70
68
 
69
+ for vtype, count in data:
70
+ bar_height = int((count / max_count) * 180)
71
+
72
+ cv2.rectangle(
73
+ chart,
74
+ (x, 250 - bar_height),
75
+ (x + 50, 250),
76
+ (255, 0, 0),
77
+ -1
78
+ )
79
+
80
+ cv2.putText(
81
+ chart,
82
+ vtype,
83
+ (x - 10, 270),
84
+ cv2.FONT_HERSHEY_SIMPLEX,
85
+ 0.4,
86
+ (0, 0, 0),
87
+ 1
88
+ )
89
+
90
+ cv2.putText(
91
+ chart,
92
+ str(count),
93
+ (x + 10, 240 - bar_height),
94
+ cv2.FONT_HERSHEY_SIMPLEX,
95
+ 0.4,
96
+ (0, 0, 255),
97
+ 1
98
+ )
99
+
100
+ x += 80
101
+
102
+ return chart