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 ''; +