From 0d839f7eabeb3d5159e2d729b11a6a814f8b7257 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 8 Nov 2023 19:51:34 +0100 Subject: [PATCH 1/8] dgo --- update/demo.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 update/demo.php diff --git a/update/demo.php b/update/demo.php new file mode 100644 index 0000000..6fa6d18 --- /dev/null +++ b/update/demo.php @@ -0,0 +1,41 @@ + 25, "label" => "Sunday"), + array("y" => 15, "label" => "Monday"), + array("y" => 25, "label" => "Tuesday"), + array("y" => 5, "label" => "Wednesday"), + array("y" => 10, "label" => "Thursday"), + array("y" => 0, "label" => "Friday"), + array("y" => 20, "label" => "Saturday") +); + +?> + + + + + + +
+ + + \ No newline at end of file From b8bb0e16be2335f1a3f4a354a74bd29239a8baa3 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 8 Nov 2023 19:55:20 +0100 Subject: [PATCH 2/8] demo --- demo.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 demo.php diff --git a/demo.php b/demo.php new file mode 100644 index 0000000..6fa6d18 --- /dev/null +++ b/demo.php @@ -0,0 +1,41 @@ + 25, "label" => "Sunday"), + array("y" => 15, "label" => "Monday"), + array("y" => 25, "label" => "Tuesday"), + array("y" => 5, "label" => "Wednesday"), + array("y" => 10, "label" => "Thursday"), + array("y" => 0, "label" => "Friday"), + array("y" => 20, "label" => "Saturday") +); + +?> + + + + + + +
+ + + \ No newline at end of file From fe9b10d88dc838e77a293ae538ad9cec8d320f85 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 8 Nov 2023 19:56:16 +0100 Subject: [PATCH 3/8] date/wins --- demo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/demo.php b/demo.php index 6fa6d18..168a377 100644 --- a/demo.php +++ b/demo.php @@ -19,10 +19,10 @@ window.onload = function () { var chart = new CanvasJS.Chart("chartContainer", { title: { - text: "Push-ups Over a Week" + text: "Winrato last month" }, axisY: { - title: "Number of Push-ups" + title: "wins" }, data: [{ type: "line", From 6618c0f5c5b0a969a2a3ded6c45cdfe68ce47843 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 8 Nov 2023 19:59:47 +0100 Subject: [PATCH 4/8] ARRAY --- demo.php | 41 +++++++++++++++++++++++++++++++++++++++++ update/demo.php | 41 ----------------------------------------- 2 files changed, 41 insertions(+), 41 deletions(-) delete mode 100644 update/demo.php diff --git a/demo.php b/demo.php index 168a377..bb1d681 100644 --- a/demo.php +++ b/demo.php @@ -11,6 +11,47 @@ $dataPoints = array( ); ?> +format('m-d'); // Month-Day format + + // Add to dataPoints + $dataPoints[] = array( + "y" => $jsonArray['winplace'], + "label" => $label + ); + } + } + closedir($handle); +} + +// Output the array +print_r($dataPoints); +?> + + diff --git a/update/demo.php b/update/demo.php deleted file mode 100644 index 6fa6d18..0000000 --- a/update/demo.php +++ /dev/null @@ -1,41 +0,0 @@ - 25, "label" => "Sunday"), - array("y" => 15, "label" => "Monday"), - array("y" => 25, "label" => "Tuesday"), - array("y" => 5, "label" => "Wednesday"), - array("y" => 10, "label" => "Thursday"), - array("y" => 0, "label" => "Friday"), - array("y" => 20, "label" => "Saturday") -); - -?> - - - - - - -
- - - \ No newline at end of file From 7cfb3a8e40a394bd203da969da36c6c442ba5e8b Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 8 Nov 2023 20:01:42 +0100 Subject: [PATCH 5/8] datas --- demo.php | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/demo.php b/demo.php index bb1d681..c8dbcf3 100644 --- a/demo.php +++ b/demo.php @@ -13,8 +13,8 @@ $dataPoints = array( ?> format('m-d'); // Month-Day format - // Add to dataPoints - $dataPoints[] = array( + // Initialize player array if not existing + if (!isset($dataPointsPerPlayer[$playername])) { + $dataPointsPerPlayer[$playername] = []; + } + + // Add to dataPoints for this player + $dataPointsPerPlayer[$playername][] = array( "y" => $jsonArray['winplace'], "label" => $label ); @@ -47,11 +54,19 @@ if ($handle = opendir($directory)) { closedir($handle); } -// Output the array -print_r($dataPoints); +// Now, $dataPointsPerPlayer is an array that contains an array of data points for each player +// You can access the data for a specific player like this: +// $playerData = $dataPointsPerPlayer['Lanta01']; + +// Output the array for debugging purposes +echo '
';
+print_r($dataPointsPerPlayer);
+echo '
'; + ?> + From e57291bac6855300c2079031fef767a88dd2bf88 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 8 Nov 2023 20:03:52 +0100 Subject: [PATCH 6/8] per player --- demo.php | 61 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 43 insertions(+), 18 deletions(-) diff --git a/demo.php b/demo.php index c8dbcf3..0c66151 100644 --- a/demo.php +++ b/demo.php @@ -59,9 +59,24 @@ if ($handle = opendir($directory)) { // $playerData = $dataPointsPerPlayer['Lanta01']; // Output the array for debugging purposes -echo '
';
-print_r($dataPointsPerPlayer);
-echo '
'; +// At the end of your PHP script, where you previously printed the array +// Instead, we will encode the $dataPointsPerPlayer array into JSON +$chartData = []; +foreach ($dataPointsPerPlayer as $player => $dataPoints) { + $chartData[] = [ + 'type' => 'line', + 'showInLegend' => true, + 'legendText' => $player, + 'dataPoints' => $dataPoints + ]; +} + +// Store the JSON encoded data in a PHP variable +$encodedChartData = json_encode($chartData, JSON_NUMERIC_CHECK); + +// You can then pass this to your JavaScript code like this +echo ""; + ?> @@ -72,23 +87,33 @@ echo ''; +
From 254516e465cc8444aa91ba467415f78aee908149 Mon Sep 17 00:00:00 2001 From: Thijs Stobbelaar Date: Wed, 8 Nov 2023 20:06:29 +0100 Subject: [PATCH 7/8] per day --- demo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo.php b/demo.php index 0c66151..387e0ca 100644 --- a/demo.php +++ b/demo.php @@ -90,7 +90,7 @@ window.onload = function () { var chart = new CanvasJS.Chart("chartContainer", { title: { - text: "Win rate by Player" + text: "Win place by Player / per day" }, axisY: { title: "Win Place" From dd2bd55c7a8bd0cac11710ed4cb6be79d929b480 Mon Sep 17 00:00:00 2001 From: stobbelaart Date: Fri, 10 Nov 2023 09:30:01 +0100 Subject: [PATCH 8/8] 10 --- update/get_matches.ps1 | 2 +- update/update_clan_members.ps1 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/update/get_matches.ps1 b/update/get_matches.ps1 index 8163ca8..769dbf5 100644 --- a/update/get_matches.ps1 +++ b/update/get_matches.ps1 @@ -31,7 +31,7 @@ if ($fileContent -match "\`$clanmembers\s*=\s*array\(([^)]+)\)") { else { Write-Output "Clan members not found" } -if ($clanMembersArray.count -ge 10 ) { +if ($clanMembersArray.count -gt 10 ) { write-output "Currently not able to process more then 10 players" exit } diff --git a/update/update_clan_members.ps1 b/update/update_clan_members.ps1 index 1270898..4e69495 100644 --- a/update/update_clan_members.ps1 +++ b/update/update_clan_members.ps1 @@ -27,7 +27,7 @@ if ($fileContent -match "\`$clanmembers\s*=\s*array\(([^)]+)\)") { else { Write-Output "Clan members not found" } -if ($clanMembersArray.count -ge 10 ) { +if ($clanMembersArray.count -gt 10 ) { write-output "Currently not able to process more then 10 players" exit }