From a0d7df4fcd0f24f7583114414f1fb02653f1af28 Mon Sep 17 00:00:00 2001 From: Amir Date: Tue, 12 Aug 2025 19:57:49 +0200 Subject: [PATCH] Residual risk matrix graph je sada predstavljen na tabeli --- backend/core/utils.py | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/backend/core/utils.py b/backend/core/utils.py index 77c3e52..b511f59 100644 --- a/backend/core/utils.py +++ b/backend/core/utils.py @@ -449,16 +449,13 @@ def generate_residual_risk_graph(risks_with_controls): likelihoods = [risk.get('residual_likelihood', 0) for risk in risks_with_controls] risk_ids = [risk['risk']['id'] for risk in risks_with_controls] - bg_img_path = find('img/graph_matrix.png') - bg_img = mpimg.imread(bg_img_path) - fig, ax = plt.subplots(figsize=(10, 8)) - ax.imshow(bg_img, extent=[0.0, 5.4, 0.0, 5.4], aspect='auto') + _draw_risk_matrix_background(ax) scatter = ax.scatter( - likelihoods, impacts, - c="blue", edgecolors="white", s=500, alpha=0.9 + likelihoods, impacts, + c="#000000", edgecolors="white", linewidths=1.5, s=420, alpha=0.95, zorder=3 ) for i, risk_id in enumerate(risk_ids): @@ -470,20 +467,11 @@ def generate_residual_risk_graph(risks_with_controls): ha="center", va="center", weight="bold", + zorder=4, ) - ax.set_xticks([]) - ax.set_yticks([]) - ax.set_xticklabels([]) - ax.set_yticklabels([]) - - ax.spines['top'].set_visible(False) - ax.spines['right'].set_visible(False) - ax.spines['left'].set_visible(False) - ax.spines['bottom'].set_visible(False) - buffer = io.BytesIO() - plt.savefig(buffer, format="png", transparent=True, bbox_inches='tight', pad_inches=0) + plt.savefig(buffer, format="png", transparent=True, bbox_inches='tight', pad_inches=0.1) buffer.seek(0) image_png = buffer.getvalue() buffer.close()