Add helm chart

This commit is contained in:
2025-10-09 22:59:26 +08:00
parent 09d5c79e8d
commit 6886f94888
19 changed files with 1836 additions and 12 deletions
+11 -7
View File
@@ -136,14 +136,15 @@
margin-bottom: 4px;
position: relative;
overflow: hidden;
background-color: #e9ecef; /* Light gray background for empty bars */
}
.poty-bar-motm {
background: linear-gradient(90deg, #28a745, #20c997);
background-color: rgba(40, 167, 69, 0.1); /* Very light green background */
}
.poty-bar-dotd {
background: linear-gradient(90deg, #dc3545, #fd7e14);
background-color: rgba(220, 53, 69, 0.1); /* Very light red background */
}
.poty-bar-fill {
@@ -238,7 +239,7 @@ function renderPOTYChart(data) {
return a.dotdTotal - b.dotdTotal;
});
// Find max values for scaling - each bar scales independently
// Find max values for independent scaling - each bar type scales to its own maximum
const maxMotm = Math.max(...data.map(p => p.motmTotal || 0));
const maxDotd = Math.max(...data.map(p => p.dotdTotal || 0));
@@ -249,6 +250,9 @@ function renderPOTYChart(data) {
const ranking = index + 1;
const rankingClass = ranking === 1 ? 'gold' : ranking === 2 ? 'silver' : ranking === 3 ? 'bronze' : '';
const motmVotes = player.motmTotal || 0;
const dotdVotes = player.dotdTotal || 0;
html += '<div class="poty-player-card">';
html += '<div class="d-flex align-items-center">';
html += '<div class="poty-ranking ' + rankingClass + '">' + ranking + '</div>';
@@ -256,19 +260,19 @@ function renderPOTYChart(data) {
html += '<div class="poty-player-name">' + (player.playerName || 'Unknown Player') + '</div>';
html += '<div class="poty-stats">';
html += '<div class="poty-stat">';
html += '<div class="poty-stat-value text-success">' + (player.motmTotal || 0) + '</div>';
html += '<div class="poty-stat-value text-success">' + motmVotes + '</div>';
html += '<div class="poty-stat-label">MOTM</div>';
html += '</div>';
html += '<div class="poty-stat">';
html += '<div class="poty-stat-value text-danger">' + (player.dotdTotal || 0) + '</div>';
html += '<div class="poty-stat-value text-danger">' + dotdVotes + '</div>';
html += '<div class="poty-stat-label">DotD</div>';
html += '</div>';
html += '<div class="poty-bar-container">';
html += '<div class="poty-bar poty-bar-motm">';
html += '<div class="poty-bar-fill" style="width: ' + (maxMotm > 0 ? ((player.motmTotal || 0) / maxMotm * 100) : 0) + '%"></div>';
html += '<div class="poty-bar-fill" style="width: ' + (maxMotm > 0 ? (motmVotes / maxMotm * 100) : 0) + '%"></div>';
html += '</div>';
html += '<div class="poty-bar poty-bar-dotd">';
html += '<div class="poty-bar-fill" style="width: ' + (maxDotd > 0 ? ((player.dotdTotal || 0) / maxDotd * 100) : 0) + '%"></div>';
html += '<div class="poty-bar-fill" style="width: ' + (maxDotd > 0 ? (dotdVotes / maxDotd * 100) : 0) + '%"></div>';
html += '</div>';
html += '</div>';
html += '</div>';
+31 -5
View File
@@ -136,14 +136,15 @@
margin-bottom: 4px;
position: relative;
overflow: hidden;
background-color: #e9ecef; /* Light gray background for empty bars */
}
.vote-bar-motm {
background: linear-gradient(90deg, #28a745, #20c997);
background-color: rgba(40, 167, 69, 0.1); /* Very light green background */
}
.vote-bar-dotd {
background: linear-gradient(90deg, #dc3545, #fd7e14);
background-color: rgba(220, 53, 69, 0.1); /* Very light red background */
}
.vote-bar-fill {
@@ -250,12 +251,14 @@ function renderVoteChart(data) {
return aDotd - bDotd;
});
// Find max values for scaling - each bar scales independently
// Find max values for independent scaling - each bar type scales to its own maximum
const maxMotm = Math.max(...data.map(p => p[motmKey] || 0));
const maxDotd = Math.max(...data.map(p => p[dotdKey] || 0));
let html = '';
console.log('Max values calculated:', {maxMotm, maxDotd});
data.forEach((player, index) => {
console.log('Processing vote player:', player);
const ranking = index + 1;
@@ -264,6 +267,8 @@ function renderVoteChart(data) {
const motmVotes = player[motmKey] || 0;
const dotdVotes = player[dotdKey] || 0;
console.log(`${player.playerName}: MOTM=${motmVotes}, DotD=${dotdVotes}`);
html += '<div class="vote-player-card">';
html += '<div class="d-flex align-items-center">';
html += '<div class="vote-ranking ' + rankingClass + '">' + ranking + '</div>';
@@ -278,12 +283,18 @@ function renderVoteChart(data) {
html += '<div class="vote-stat-value text-danger">' + dotdVotes + '</div>';
html += '<div class="vote-stat-label">DotD</div>';
html += '</div>';
// Calculate percentages with debugging
const motmPercent = maxMotm > 0 ? (motmVotes / maxMotm * 100) : 0;
const dotdPercent = maxDotd > 0 ? (dotdVotes / maxDotd * 100) : 0;
console.log(`${player.playerName} percentages: MOTM=${motmPercent.toFixed(1)}%, DotD=${dotdPercent.toFixed(1)}%`);
html += '<div class="vote-bar-container">';
html += '<div class="vote-bar vote-bar-motm">';
html += '<div class="vote-bar-fill" style="width: ' + (maxMotm > 0 ? (motmVotes / maxMotm * 100) : 0) + '%"></div>';
html += '<div class="vote-bar-fill" style="width: ' + motmPercent + '%"></div>';
html += '</div>';
html += '<div class="vote-bar vote-bar-dotd">';
html += '<div class="vote-bar-fill" style="width: ' + (maxDotd > 0 ? (dotdVotes / maxDotd * 100) : 0) + '%"></div>';
html += '<div class="vote-bar-fill" style="width: ' + dotdPercent + '%"></div>';
html += '</div>';
html += '</div>';
html += '</div>';
@@ -294,6 +305,11 @@ function renderVoteChart(data) {
container.innerHTML = html;
// Verify bar widths are set correctly
setTimeout(() => {
verifyBarWidths();
}, 100);
// Animate bars after a short delay
setTimeout(() => {
const bars = container.querySelectorAll('.vote-bar-fill');
@@ -326,5 +342,15 @@ function testVoteChart() {
console.log('Testing with sample vote data:', testData);
renderVoteChart(testData);
}
// Add a simple test to verify bar widths are being set
function verifyBarWidths() {
const bars = document.querySelectorAll('.vote-bar-fill');
console.log('Found bars:', bars.length);
bars.forEach((bar, index) => {
const width = bar.style.width;
console.log(`Bar ${index}: width = ${width}`);
});
}
</script>
{% endblock %}