Add helm chart
This commit is contained in:
@@ -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 %}
|
||||
Reference in New Issue
Block a user