mirror of
https://github.com/amineo/t2-stat-parser.git
synced 2026-07-15 16:24:36 +00:00
Setup weapon chart
This commit is contained in:
parent
47c6017ea1
commit
31d927bbe2
1 changed files with 34 additions and 0 deletions
|
|
@ -3,6 +3,33 @@ import React from 'react'
|
||||||
import Layout from '@/Shared/Layout'
|
import Layout from '@/Shared/Layout'
|
||||||
import GameTypesPlayedBoxes from '@/Components/GameTypesPlayedBoxes'
|
import GameTypesPlayedBoxes from '@/Components/GameTypesPlayedBoxes'
|
||||||
|
|
||||||
|
import {Radar, RadarChart, PolarGrid, PolarAngleAxis, PolarRadiusAxis} from 'recharts'
|
||||||
|
|
||||||
|
|
||||||
|
const returnWeaponTotals = (statTotals) => {
|
||||||
|
let totals = [
|
||||||
|
{ weapon: 'Chaingun', val: statTotals["chainKills"]},
|
||||||
|
{ weapon: 'Disc', val: statTotals["discKills"] },
|
||||||
|
{ weapon: 'Grenade Launcher', val: statTotals["grenadeKills"]},
|
||||||
|
{ weapon: 'Shocklance', val: statTotals["shockLanceKills"]},
|
||||||
|
{ weapon: 'Laser Rifle', val: statTotals["laserKills"]},
|
||||||
|
{ weapon: 'Blaster', val: statTotals["blasterKills"]},
|
||||||
|
{ weapon: 'Plasma Rifle', val: statTotals["plasmaKills"]},
|
||||||
|
{ weapon: 'Mortar Launcher', val: statTotals["mortarKills"]},
|
||||||
|
{ weapon: 'Missile Launcher', val: statTotals["missileKills"]},
|
||||||
|
{ weapon: 'Hand Grenade', val: statTotals["hGrenadeKills"]},
|
||||||
|
{ weapon: 'Mine', val: statTotals["mineKills"]},
|
||||||
|
{ weapon: 'Satchel', val: statTotals["satchelChargeKills"]},
|
||||||
|
];
|
||||||
|
|
||||||
|
// dont return if the val is 0
|
||||||
|
return totals.filter(function (el) {
|
||||||
|
return el.val > 0;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -16,6 +43,13 @@ export default function Player(props) {
|
||||||
spawnctf={props.playerData.player.total_games_sctfgame}
|
spawnctf={props.playerData.player.total_games_sctfgame}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<RadarChart cx={300} cy={250} outerRadius={150} width={600} height={500} data={returnWeaponTotals(props.playerData.totals)} className="text-sm">
|
||||||
|
<PolarGrid />
|
||||||
|
<PolarAngleAxis dataKey="weapon" />
|
||||||
|
<PolarRadiusAxis/>
|
||||||
|
<Radar name={props.playerData.player.player_name} dataKey="val" stroke="#8884d8" fill="#8884d8" fillOpacity={0.6}/>
|
||||||
|
</RadarChart>
|
||||||
|
|
||||||
<div className="bg-white shadow overflow-hidden sm:rounded-md">
|
<div className="bg-white shadow overflow-hidden sm:rounded-md">
|
||||||
<div className="py-10 px-10">{JSON.stringify(props.playerData.totals)}</div>
|
<div className="py-10 px-10">{JSON.stringify(props.playerData.totals)}</div>
|
||||||
<div className="py-10 px-10"><code> {JSON.stringify(props.playerData.stats)}</code></div>
|
<div className="py-10 px-10"><code> {JSON.stringify(props.playerData.stats)}</code></div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue