diff --git a/Back-End/src/Controller/Api/BarChartController.php b/Back-End/src/Controller/Api/BarChartController.php index 5a958a065feede700d0dbc84621bf119c7924e48..a1df496a7a15f53e7c9dfdf6ee514aba57253618 100644 --- a/Back-End/src/Controller/Api/BarChartController.php +++ b/Back-End/src/Controller/Api/BarChartController.php @@ -2,4 +2,30 @@ namespace App\Controller\Api; -} +use App\Entity\LandValue; +use App\Repository\LandValueRepository; +use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; +use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\Routing\Annotation\Route; + +class BarChartController extends AbstractController +{ + private LandValueRepository $landValueRepository; + private Request $request; + + public function __construct(LandValueRepository $landValueRepository, RequestStack $request) + { + $this->landValueRepository = $landValueRepository; + $this->request = $request->getCurrentRequest(); + } + + public function __invoke(): array + { + $startParam = $this->request->query->get('start'); + $endParam = $this->request->query->get('end'); + $groupParam = $this->request->query->get('group'); + + return $this->landValueRepository->barChart($startParam, $endParam, $groupParam); + } +} \ No newline at end of file diff --git a/Back-End/src/Controller/Api/DonutChartController.php b/Back-End/src/Controller/Api/DonutChartController.php new file mode 100644 index 0000000000000000000000000000000000000000..b7c1a1e202fe1305549386365aefb9aaaf701133 --- /dev/null +++ b/Back-End/src/Controller/Api/DonutChartController.php @@ -0,0 +1,34 @@ +landValueRepository = $landValueRepository; + $this->request = $request->getCurrentRequest(); + } + + public function __invoke(): array + { + $year = $this->request->query->get('year'); + + if ($year === null) { + $year = '2022'; + } + + return $this->landValueRepository->donutChart($year); + } +} diff --git a/Back-End/src/Controller/Api/LineChartController.php b/Back-End/src/Controller/Api/LineChartController.php new file mode 100644 index 0000000000000000000000000000000000000000..c08a2e793a66e3b8447c3d43a815924122a4bc81 --- /dev/null +++ b/Back-End/src/Controller/Api/LineChartController.php @@ -0,0 +1,16 @@ +