|
@@ -513,19 +513,33 @@ if($submit) {
|
|
|
return round(($d->passCount / $d->testCount) * 100);
|
|
return round(($d->passCount / $d->testCount) * 100);
|
|
|
}, $data));
|
|
}, $data));
|
|
|
|
|
|
|
|
|
|
+ $fail_rates = array_values(array_map(function($d) {
|
|
|
|
|
+ if($d->testCount == 0) return 0;
|
|
|
|
|
+ $pass_rate = round(($d->passCount / $d->testCount) * 100);
|
|
|
|
|
+ return 100 - $pass_rate;
|
|
|
|
|
+ }, $data));
|
|
|
|
|
+
|
|
|
$chart = new Chart;
|
|
$chart = new Chart;
|
|
|
|
|
+ $chart->addXAxis([
|
|
|
|
|
+ "type" => "category",
|
|
|
|
|
+ "stacked" => true,
|
|
|
|
|
+ ]);
|
|
|
$chart->addYAxis([
|
|
$chart->addYAxis([
|
|
|
"id" => "y-axis-1",
|
|
"id" => "y-axis-1",
|
|
|
- "tick_config" => ["min" => 0, "max" => 100]
|
|
|
|
|
|
|
+ "tick_config" => ["min" => 0, "max" => 100],
|
|
|
|
|
+ "stacked" => true,
|
|
|
]);
|
|
]);
|
|
|
|
|
|
|
|
$chart->setType("bar");
|
|
$chart->setType("bar");
|
|
|
- $chart->setTitle("Pass Rate by $resolution_name");
|
|
|
|
|
|
|
+ $chart->setTitle("Pass / Fail by $resolution_name");
|
|
|
$chart->setLabels($x_data_labels);
|
|
$chart->setLabels($x_data_labels);
|
|
|
$chart->addDataset("Pass Rate (%)", $pass_rates, [
|
|
$chart->addDataset("Pass Rate (%)", $pass_rates, [
|
|
|
- "background_colours" => "#2196F3"
|
|
|
|
|
|
|
+ "background_colours" => "#4CAF50"
|
|
|
|
|
+ ]);
|
|
|
|
|
+ $chart->addDataset("Fail Rate (%)", $fail_rates, [
|
|
|
|
|
+ "background_colours" => "#F44336"
|
|
|
]);
|
|
]);
|
|
|
- $chart->setDatalabelSuffixes("%");
|
|
|
|
|
|
|
+ $chart->setDatalabelSuffixes("%", "%");
|
|
|
$charts[] = $chart;
|
|
$charts[] = $chart;
|
|
|
|
|
|
|
|
// Totals by Period
|
|
// Totals by Period
|