Compare commits

...

1 Commits

Author SHA1 Message Date
58def0c006 Filter zero-win entries and apply pastel palette 2026-02-22 22:02:51 +01:00
2 changed files with 48 additions and 13 deletions

View File

@@ -57,6 +57,38 @@ function statsManager() {
if (this.charts.colorWinRate) this.charts.colorWinRate.destroy()
if (this.charts.playerCount) this.charts.playerCount.destroy()
// Pastel color palette (15 colors) - mixed to avoid similar colors adjacent
const pastelColors = [
'#FFD93D', // Pastel Yellow
'#D4A5FF', // Pastel Violet
'#FF9E9E', // Pastel Rose
'#B4E7FF', // Pastel Cyan
'#FFA94D', // Pastel Orange
'#9D84B7', // Pastel Purple
'#FF85B3', // Pastel Pink
'#4D96FF', // Pastel Blue
'#FFCB69', // Pastel Peach
'#56AB91', // Pastel Teal
'#FF6B6B', // Pastel Red
'#FFB3D9', // Pastel Magenta
'#A8E6CF', // Pastel Mint
'#6BCB77', // Pastel Green
'#C7CEEA' // Pastel Lavender
]
// Filter out color combinations with no win rate
const colorLabels = chartData?.colors?.labels || []
const colorData = chartData?.colors?.data || []
const filteredIndices = colorData
.map((value, index) => (value > 0 ? index : -1))
.filter((index) => index !== -1)
const filteredLabels = filteredIndices.map((i) => colorLabels[i])
const filteredData = filteredIndices.map((i) => colorData[i])
const filteredColors = filteredIndices.map(
(_, index) => pastelColors[index % pastelColors.length]
)
// Color Identity Win Rate Chart
const colorCtx = document
.getElementById('colorWinRateChart')
@@ -64,17 +96,11 @@ function statsManager() {
this.charts.colorWinRate = new Chart(colorCtx, {
type: 'doughnut',
data: {
labels: chartData?.colors?.labels || [],
labels: filteredLabels,
datasets: [
{
data: chartData?.colors?.data || [],
backgroundColor: [
'#F0E6D2', // White
'#0E68AB', // Blue
'#2C2B2D', // Black
'#C44536', // Red
'#5A7A3B' // Green
],
data: filteredData,
backgroundColor: filteredColors,
borderWidth: 1
}
]
@@ -88,18 +114,27 @@ function statsManager() {
}
})
// Player Count Win Rate Chart
// Player Count Win Rate Chart - filter out player counts with no wins
const playerLabels = chartData?.playerCounts?.labels || []
const playerData = chartData?.playerCounts?.data || []
const playerFilteredIndices = playerData
.map((value, index) => (value > 0 ? index : -1))
.filter((index) => index !== -1)
const playerFilteredLabels = playerFilteredIndices.map((i) => playerLabels[i])
const playerFilteredData = playerFilteredIndices.map((i) => playerData[i])
const playerCtx = document
.getElementById('playerCountChart')
.getContext('2d')
this.charts.playerCount = new Chart(playerCtx, {
type: 'bar',
data: {
labels: chartData?.playerCounts?.labels || [],
labels: playerFilteredLabels,
datasets: [
{
label: 'Win Rate (%)',
data: chartData?.playerCounts?.data || [],
data: playerFilteredData,
backgroundColor: '#6366f1',
borderRadius: 4
}

View File

@@ -1 +1 @@
2.1.8
2.1.10