ソースを参照

Add data table for "Totals" chart

Alan Lam 8 年 前
親
コミット
fad8e5829a
2 ファイル変更、15 行追加、2 行削除
  1. 12 2
      controllers/performance.php
  2. 3 0
      views/performance.php

+ 12 - 2
controllers/performance.php

@@ -514,7 +514,7 @@ if($submit) {
 		$chart->setDatalabelSuffixes("%");
 		$charts[] = $chart;
 
-		// Monthly Totals by Period
+		// Totals by Period
 
 		$test_counts = array_column($data, "testCount");
 		$pass_counts = array_column($data, "passCount");
@@ -540,18 +540,28 @@ if($submit) {
 			"background_colours" => "#2196F3",
 			"type" => "bar",
 			"y_axis_id" => "y-axis-1",
+			"datalabels" => [
+				"display" => false
+			],
 		]);
 		$chart->addDataset("Pass", $pass_counts, [
 			"background_colours" => "#4CAF50",
 			"type" => "bar",
 			"y_axis_id" => "y-axis-1",
+			"datalabels" => [
+				"display" => false
+			],
 		]);
 		$chart->addDataset("Fail", $fail_counts, [
 			"background_colours" => "#F44336",
 			"type" => "bar",
 			"y_axis_id" => "y-axis-1",
+			"datalabels" => [
+				"display" => false
+			],
 		]);
-		$chart->setDatalabelSuffixes(" %", " T", " P", " F");
+		$chart->setDatalabelSuffixes("%", "", "", "");
+		$chart->print = true;
 		$charts[] = $chart;
 
 		// Point of Challenge (Each Period)

+ 3 - 0
views/performance.php

@@ -270,6 +270,9 @@ $date_range_custom_style = ($date_range == "custom") ? "" : "display: none";
 				<canvas id="<?=$chart->getID()?>" data-chart="<?=htmlspecialchars($chart->getJSON())?>" width="400" height="300">
 				</canvas>
 				<?php
+				if($chart->print) {
+					$chart->printDataTable();
+				}
 			}
 			?>
 			</div>