Skip to content

Commit

Permalink
Pie Chart Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Vercin-G committed Sep 11, 2023
1 parent e9ed677 commit 92fab35
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
31 changes: 31 additions & 0 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"react": "^17.0.2",
"react-collapsible": "^2.8.4",
"react-dom": "^17.0.2",
"react-minimal-pie-chart": "^8.4.0",
"react-scripts": "5.0.0",
"web-vitals": "^2.1.4"
},
Expand Down
31 changes: 30 additions & 1 deletion client/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import lists from "./modules/Generic/BilletBank";
import MilpacParse from "./modules/Generic/MilpacParse";
import StrengthCount from "./modules/Generic/StrengthCount";
import ErrorMessage from "./errorMessage";
import { PieChart } from 'react-minimal-pie-chart';
const CLIENT_TOKEN = process.env.REACT_APP_CLIENT_TOKEN;
const combatApiUrl = process.env.REACT_APP_COMBAT_API_URL;
const reserveApiUrl = process.env.REACT_APP_RESERVE_API_URL;
Expand Down Expand Up @@ -74,6 +75,10 @@ function MilpacRequest() {
});
}, []);

var piechartArray = [];

var testnumber = 500

var milpacArray = [];
milpacArray.push({
combat: milpacList,
Expand Down Expand Up @@ -464,9 +469,9 @@ function MilpacRequest() {
triggerOpenedClassName="Title"
open={true}
>
{/* We need to do a count for combined, 1-7, 2-7 and acd in that order*/}
<div className="OneSevenStrength">
<StrengthCount
piechartArray={piechartArray}
milpacArray={milpacArray}
billetIDs={[
lists.oneSevenCommand,
Expand All @@ -477,32 +482,46 @@ function MilpacRequest() {
subtitle={"First Battalion"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.oneSevenCommand]}
subSubtitle={"Headquarters"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.alpha1]}
subSubtitle={"Alpha Co"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.bravo1]}
subSubtitle={"Bravo Co"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.charlie1]}
subSubtitle={"Charlie Co"}
/>
</div>
<div className="OneSevenBreakdown">
<PieChart
data={[
{ title: 'One', value: 2, color: '#E38627' },
{ title: 'Two', value: 3, color: '#C13C37' },
{ title: 'Three', value: 3, color: '#6A2135' },
]}
/>
</div>
<div className="TwoSevenStrength">
<StrengthCount
piechartArray={piechartArray}
milpacArray={milpacArray}
billetIDs={[
lists.twoSevenCommand,
Expand All @@ -513,24 +532,28 @@ function MilpacRequest() {
subtitle={"Second Battalion"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.twoSevenCommand]}
subSubtitle={"Headquarters"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.alpha2]}
subSubtitle={"Alpha Co"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.bravo2]}
subSubtitle={"Bravo Co"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.charlie2]}
Expand All @@ -539,6 +562,7 @@ function MilpacRequest() {
</div>
<div className="ACDStrength">
<StrengthCount
piechartArray={piechartArray}
milpacArray={milpacArray}
billetIDs={[
lists.acdCommand,
Expand All @@ -550,24 +574,28 @@ function MilpacRequest() {
subtitle={"ACD"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.acdCommand]}
subSubtitle={"Headquarters"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.alpha3]}
subSubtitle={"Alpha Co"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.bravo3]}
subSubtitle={"Bravo Co"}
/>
<StrengthCount
piechartArray={piechartArray}
useCompanyLevelLogic={true}
milpacArray={milpacArray}
billetIDs={[lists.charlie3]}
Expand All @@ -576,6 +604,7 @@ function MilpacRequest() {
</div>
<div className="CombinedStrength">
<StrengthCount
piechartArray={piechartArray}
milpacArray={milpacArray}
billetIDs={[
lists.regiCommand,
Expand Down
7 changes: 7 additions & 0 deletions client/src/modules/Generic/StrengthCount.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from "react";

function StrengthCount(props) {
var useCompanyLevelLogic = props.useCompanyLevelLogic;
var piechartArray=props.piechartArray;

if (useCompanyLevelLogic !== true) {
var combinedArray = [];
Expand All @@ -19,6 +20,9 @@ function StrengthCount(props) {
}
}

piechartArray.push(combinedArray.length)
console.log(piechartArray)

return (
<div className="Response Container">
<div className="Header Container">
Expand Down Expand Up @@ -46,6 +50,9 @@ function StrengthCount(props) {
}
}

piechartArray.push(combinedArray.length)
console.log(piechartArray)

return (
<div className="Response Container">
<div className="SubsubtitleAndCount">
Expand Down

0 comments on commit 92fab35

Please sign in to comment.