|
|
@@ -18,6 +18,8 @@ class ChartGenerator {
|
|
|
public const COLOUR_PURPLE = "#9C27B0";
|
|
|
public const COLOUR_GREY = "#9E9E9E";
|
|
|
public const COLOUR_CYAN = "#00BCD4";
|
|
|
+ public const COLOUR_BLACK = "#000000";
|
|
|
+ public const COLOUR_DARK_GREY = "#333333";
|
|
|
|
|
|
/** @var object $totalData */
|
|
|
private $totalData;
|
|
|
@@ -593,18 +595,46 @@ class ChartGenerator {
|
|
|
|
|
|
public function getPeriodicTestCountChart(): Chart {
|
|
|
$test_counts = $this->getPeriodicTestCounts();
|
|
|
+ $pass_rates = $this->getPeriodicPassRates();
|
|
|
+ $pass_rate_max = ceil(max($pass_rates) / 10) * 10;
|
|
|
|
|
|
$chart = new Chart;
|
|
|
$chart->addYAxis([
|
|
|
"id" => "y-axis-1",
|
|
|
"tick_config" => ["min" => 0, "max" => ceil(max($test_counts) / 10) * 10]
|
|
|
]);
|
|
|
+ $chart->addYAxis([
|
|
|
+ "id" => "y-axis-2",
|
|
|
+ "tick_config" => ["min" => 0, "max" => $pass_rate_max],
|
|
|
+ "position" => "right"
|
|
|
+ ]);
|
|
|
$chart->setType("bar");
|
|
|
$chart->setTitle("Tests by {$this->resolutionName}");
|
|
|
$chart->setLabels($this->xDataLabels);
|
|
|
$chart->addDataset("Tests", $test_counts, [
|
|
|
"background_colours" => self::COLOUR_BLUE
|
|
|
]);
|
|
|
+ $chart->addDataset("Pass Rate", $pass_rates, [
|
|
|
+ "type" => "line",
|
|
|
+ "y_axis_id" => "y-axis-2",
|
|
|
+ "border_colours" => self::COLOUR_RED,
|
|
|
+ "background_colours" => "transparent",
|
|
|
+ "line_tension" => 0,
|
|
|
+ "datalabels" => [
|
|
|
+ "align" => "top",
|
|
|
+ "color" => self::COLOUR_DARK_GREY,
|
|
|
+ "borderColor" => self::COLOUR_GREY,
|
|
|
+ "borderWidth" => 1,
|
|
|
+ "borderRadius" => 4,
|
|
|
+ "backgroundColor" => "white",
|
|
|
+ "font" => [
|
|
|
+ "weight" => "bold"
|
|
|
+ ],
|
|
|
+
|
|
|
+ ],
|
|
|
+ "point_background_colour" => self::COLOUR_RED,
|
|
|
+ ]);
|
|
|
+ $chart->setDatalabelSuffixes("", "%");
|
|
|
return $chart;
|
|
|
}
|
|
|
|