diff options
| author | Davi Antônio <30875784+DaviAntonio@users.noreply.github.com> | 2023-03-30 11:48:17 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-30 11:48:17 +0000 |
| commit | 991cb0ed962f348761ad473aa5ce5c0da12333ae (patch) | |
| tree | e1d2ac42db99106c5ba107d60f255c551f19d48e /src/admin/report/piechart.py | |
| parent | a9bb286113e9e8267a6cc45f5b401bdd448a9f8a (diff) | |
| download | boca-991cb0ed962f348761ad473aa5ce5c0da12333ae.tar.gz boca-991cb0ed962f348761ad473aa5ce5c0da12333ae.zip | |
Release 1.5.18-1 (#28)
* Update version info and year
The following files were updated to the next version to be released and
the current year:
- src/version
- src/versionnum.php
* Release 1.5.17-1
Update changelog with all the changes made since its last update on
commit 818abd88.
* Format code with black 23.1.0
* Release 1.5.18-1
Update changelog with all the changes made since its last update on
commit 194f6764.
Diffstat (limited to 'src/admin/report/piechart.py')
| -rw-r--r-- | src/admin/report/piechart.py | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/src/admin/report/piechart.py b/src/admin/report/piechart.py index 75e5a9d..70904bb 100644 --- a/src/admin/report/piechart.py +++ b/src/admin/report/piechart.py @@ -4,37 +4,52 @@ import sys filename = sys.argv[1] title = sys.argv[2] -label=[] -value=[] +label = [] +value = [] color = [] -with open(filename,'r') as f: +with open(filename, "r") as f: for line in f: tokens = line.split() c = tokens[-1] - problem_data = ' '.join(tokens[0:-1]) - l,v = problem_data.split(':') - if(int(v)>0): - label.append(l+'('+v+')') + problem_data = " ".join(tokens[0:-1]) + l, v = problem_data.split(":") + if int(v) > 0: + label.append(l + "(" + v + ")") value.append(v) color.append(c) -wedges, texts, autotexts = plt.pie(value, colors=color,autopct=lambda p: '{:.1f}%'.format(round(p)) if p > 0 else '',pctdistance=1.2,wedgeprops= {"edgecolor":"black", - 'linewidth': 1, - 'antialiased': False}) +wedges, texts, autotexts = plt.pie( + value, + colors=color, + autopct=lambda p: "{:.1f}%".format(round(p)) if p > 0 else "", + pctdistance=1.2, + wedgeprops={"edgecolor": "black", "linewidth": 1, "antialiased": False}, +) -plt.legend(wedges, label, - loc="center left", - bbox_to_anchor=(1.1, 0, 0.5,1)) +plt.legend(wedges, label, loc="center left", bbox_to_anchor=(1.1, 0, 0.5, 1)) # Add title -plt.title(title,pad=20) -if(len(sys.argv)<=3): - plt.legend(label, bbox_to_anchor=(1.1,0.5), loc="center right", fontsize=10, - bbox_transform=plt.gcf().transFigure,shadow=True) +plt.title(title, pad=20) +if len(sys.argv) <= 3: + plt.legend( + label, + bbox_to_anchor=(1.1, 0.5), + loc="center right", + fontsize=10, + bbox_transform=plt.gcf().transFigure, + shadow=True, + ) else: - plt.legend(label,loc="lower center", bbox_to_anchor=(0.5,-0.1), fontsize=10, - bbox_transform=plt.gcf().transFigure,shadow=True) + plt.legend( + label, + loc="lower center", + bbox_to_anchor=(0.5, -0.1), + fontsize=10, + bbox_transform=plt.gcf().transFigure, + shadow=True, + ) # Show plot # plt.tight_layout() -plt.savefig(filename.replace('.txt','.png'),dpi=600,transparent=True, bbox_inches="tight") - +plt.savefig( + filename.replace(".txt", ".png"), dpi=600, transparent=True, bbox_inches="tight" +) |