fix: Fixed division by zero error that may occur when drawing ranking
This commit is contained in:
@@ -158,6 +158,7 @@ class RankingGenerator:
|
|||||||
chart.set_row_space(row_space)
|
chart.set_row_space(row_space)
|
||||||
for i in range(count):
|
for i in range(count):
|
||||||
bar_width = int(abs(counts[i]) / top_count * top_bar_width)
|
bar_width = int(abs(counts[i]) / top_count * top_bar_width)
|
||||||
|
if bar_width != 0:
|
||||||
if counts[i] > 0:
|
if counts[i] > 0:
|
||||||
bar = cls.__get_rank_bar_pic(bar_width, bar_height, start_color, end_color)
|
bar = cls.__get_rank_bar_pic(bar_width, bar_height, start_color, end_color)
|
||||||
chart.draw_img_alpha(bar, (bar_x, chart.y + int((face_size - bar_height) / 2)))
|
chart.draw_img_alpha(bar, (bar_x, chart.y + int((face_size - bar_height) / 2)))
|
||||||
|
|||||||
Reference in New Issue
Block a user