Alan Lam 7 лет назад
Родитель
Сommit
da7fe5313f

+ 0 - 22
controllers/reports.php

@@ -68,28 +68,6 @@ $locations_missing_area_manager = [];
 
 $charts = [];
 
-$colours = [
-	"#f44336",
-	"#673ab7",
-	"#03a9f4",
-	"#4caf50",
-	"#ffeb3b",
-	"#ff5722",
-	"#607d8b",
-	"#e91e63",
-	"#3f51b5",
-	"#00bcd4",
-	"#8bc34a",
-	"#ffc107",
-	"#795548",
-	"#9c27b0",
-	"#2196f3",
-	"#009688",
-	"#cddc39",
-	"#ff9800",
-	"#9e9e9e",
-];
-
 $submit = http::value("submit");
 if($submit) {
 	try {

+ 22 - 0
engine/chart.php

@@ -11,6 +11,28 @@ class Chart {
 		"borderRadius" => "2",
 	];
 
+	const COLOURS = [
+		"#f44336",
+		"#673ab7",
+		"#03a9f4",
+		"#4caf50",
+		"#ffeb3b",
+		"#ff5722",
+		"#607d8b",
+		"#e91e63",
+		"#3f51b5",
+		"#00bcd4",
+		"#8bc34a",
+		"#ffc107",
+		"#795548",
+		"#9c27b0",
+		"#2196f3",
+		"#009688",
+		"#cddc39",
+		"#ff9800",
+		"#9e9e9e",
+	];
+
 	private $id = "";
 	private $title = "Untitled";
 	private $type = "bar";

+ 2 - 2
template_processing/age_verification/reports_build_charts.php

@@ -489,7 +489,7 @@ if($has_regions) {
 			$r_data = $region_data[$region][$key];
 			$data_values[] = ($r_data->testCount == 0) ? 0 : round(($r_data->passCount * 100) / $r_data->testCount);
 		}
-		$chart->addDataset($key_labels[$index], $data_values, ["background_colours" => $colours[$index]]);
+		$chart->addDataset($key_labels[$index], $data_values, ["background_colours" => Chart::COLOURS[$index]]);
 	}
 	$chart->setDatalabelSuffixes(...array_fill(0, count($keys), "%"));
 
@@ -577,7 +577,7 @@ if($has_area_managers) {
 			$data_values[] = ($a_data->testCount == 0) ? 0 : round(($a_data->passCount * 100) / $a_data->testCount);
 		}
 		$chart->addDataset($key_labels[$index], $data_values, [
-			"background_colours" => $colours[$index],
+			"background_colours" => Chart::COLOURS[$index],
 			"datalabels" => [
 				"display" => false,
 			],

+ 2 - 2
template_processing/age_verification_mitchells_butlers/reports_build_charts.php

@@ -489,7 +489,7 @@ if($has_regions) {
 			$r_data = $region_data[$region][$key];
 			$data_values[] = ($r_data->testCount == 0) ? 0 : round(($r_data->passCount * 100) / $r_data->testCount);
 		}
-		$chart->addDataset($key_labels[$index], $data_values, ["background_colours" => $colours[$index]]);
+		$chart->addDataset($key_labels[$index], $data_values, ["background_colours" => Chart::COLOURS[$index]]);
 	}
 	$chart->setDatalabelSuffixes(...array_fill(0, count($keys), "%"));
 
@@ -577,7 +577,7 @@ if($has_area_managers) {
 			$data_values[] = ($a_data->testCount == 0) ? 0 : round(($a_data->passCount * 100) / $a_data->testCount);
 		}
 		$chart->addDataset($key_labels[$index], $data_values, [
-			"background_colours" => $colours[$index],
+			"background_colours" => Chart::COLOURS[$index],
 			"datalabels" => [
 				"display" => false,
 			],