Skip to content

Commit 9f0f38a

Browse files
committed
Simplify legend column calculation and fix HTML typo
Refactored the legend column logic in chart_helper.js for clarity and consistency. Fixed a misplaced closing span tag in compare.html to correct the loading message markup.
1 parent 924b473 commit 9f0f38a

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

python/src/static/js/chart_helper.js

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,10 @@ function createLegendHTML(labels, colors) {
2828
const totalItems = labels.length;
2929
let numColumns = 1;
3030

31-
if (totalItems === 10 || totalItems === 20) {
32-
numColumns = 2;
33-
}
34-
else if ((totalItems >= 11 && totalItems <= 19) ||
35-
(totalItems >= 20 && totalItems <= 29) ||
36-
(totalItems >= 31 && totalItems <= 39)) {
37-
numColumns = Math.ceil(totalItems / 10); // تقريبًا عمود لكل 10 عناصر
38-
39-
} else if ((totalItems > 10 && totalItems < 20) || (totalItems > 20 && totalItems < 30)) {
31+
if (totalItems > 10) {
4032
numColumns = Math.ceil(totalItems / 10);
33+
} else if (totalItems === 10) {
34+
numColumns = 2;
4135
}
4236

4337
const itemsPerColumn = Math.ceil(totalItems / numColumns);

python/src/templates/compare.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
<div class="spinner-border spinner-border-sm" role="status">
4343
<span class="visually-hidden">Loading...</span>
4444
</div>
45-
<span class="ms-2"></span>جار التحميل...</span>
45+
<span class="ms-2">جار التحميل...</span>
4646
</div>
4747
<div id="tables_container"></div>
4848
</div>

0 commit comments

Comments
 (0)