3.0.3: Cant fix team avg. removed.
This commit is contained in:
@@ -869,6 +869,7 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
// Prepare Distribution Data
|
||||
const dist = data.radar_dist || {};
|
||||
const hasDist = Object.keys(dist).length > 0;
|
||||
const getDist = (key) => dist[key] || { rank: '?', avg: 0 };
|
||||
|
||||
// Map friendly names to keys
|
||||
@@ -877,41 +878,49 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
const rawLabels = ['枪法 (Aim)', '生存 (Defense)', '道具 (Utility)', '残局 (Clutch)', '经济 (Economy)', '节奏 (Pace)', '手枪 (Pistol)', '稳定 (Stability)'];
|
||||
|
||||
const labels = rawLabels.map((l, i) => {
|
||||
if (!hasDist) return l;
|
||||
const k = keys[i];
|
||||
const d = getDist(k);
|
||||
return `${l} #${d.rank}`;
|
||||
});
|
||||
|
||||
const teamAvgs = keys.map(k => getDist(k).avg);
|
||||
let teamAvgs;
|
||||
if (data.team_avg_radar) {
|
||||
teamAvgs = keys.map(k => data.team_avg_radar[k] || 0);
|
||||
}
|
||||
|
||||
const datasets = [{
|
||||
label: 'Player',
|
||||
data: [
|
||||
data.radar.AIM, data.radar.DEFENSE, data.radar.UTILITY,
|
||||
data.radar.CLUTCH, data.radar.ECONOMY, data.radar.PACE,
|
||||
data.radar.PISTOL, data.radar.STABILITY
|
||||
],
|
||||
backgroundColor: 'rgba(124, 58, 237, 0.2)',
|
||||
borderColor: '#7c3aed',
|
||||
borderWidth: 2,
|
||||
pointBackgroundColor: '#7c3aed',
|
||||
pointBorderColor: '#fff',
|
||||
pointHoverBackgroundColor: '#fff',
|
||||
pointHoverBorderColor: '#7c3aed'
|
||||
}];
|
||||
if (teamAvgs) {
|
||||
datasets.push({
|
||||
label: 'Team Avg',
|
||||
data: teamAvgs,
|
||||
backgroundColor: 'rgba(148, 163, 184, 0.2)',
|
||||
borderColor: '#94a3b8',
|
||||
borderWidth: 2,
|
||||
pointRadius: 0,
|
||||
borderDash: [5, 5]
|
||||
});
|
||||
}
|
||||
|
||||
new Chart(ctxRadar, {
|
||||
type: 'radar',
|
||||
data: {
|
||||
labels: labels,
|
||||
datasets: [{
|
||||
label: 'Player',
|
||||
data: [
|
||||
data.radar.AIM, data.radar.DEFENSE, data.radar.UTILITY,
|
||||
data.radar.CLUTCH, data.radar.ECONOMY, data.radar.PACE,
|
||||
data.radar.PISTOL, data.radar.STABILITY
|
||||
],
|
||||
backgroundColor: 'rgba(124, 58, 237, 0.2)',
|
||||
borderColor: '#7c3aed',
|
||||
borderWidth: 2,
|
||||
pointBackgroundColor: '#7c3aed',
|
||||
pointBorderColor: '#fff',
|
||||
pointHoverBackgroundColor: '#fff',
|
||||
pointHoverBorderColor: '#7c3aed'
|
||||
},
|
||||
{
|
||||
label: 'Team Avg',
|
||||
data: teamAvgs,
|
||||
backgroundColor: 'rgba(148, 163, 184, 0.2)', // Slate-400
|
||||
borderColor: '#94a3b8',
|
||||
borderWidth: 2,
|
||||
pointRadius: 0,
|
||||
borderDash: [5, 5]
|
||||
}]
|
||||
datasets: datasets
|
||||
},
|
||||
options: {
|
||||
plugins: {
|
||||
|
||||
Reference in New Issue
Block a user