From 799c47f2ab4947bde45cdafd91fa2fadf09b9f57 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 10 Sep 2024 17:40:32 +0200 Subject: [PATCH 1/3] Introduced Line Plot Multi for Evaluation Comparisons --- .../line-plot-multi-eval/build.template.html | 29 +++++++ .../graphs/line-plot-multi-eval/config.json | 5 ++ .../graphs/line-plot-multi-eval/process.php | 81 +++++++++++++++++++ .../line-plot-multi-eval/render.template.html | 33 ++++++++ 4 files changed, 148 insertions(+) create mode 100644 libraries/graphs/line-plot-multi-eval/build.template.html create mode 100644 libraries/graphs/line-plot-multi-eval/config.json create mode 100644 libraries/graphs/line-plot-multi-eval/process.php create mode 100644 libraries/graphs/line-plot-multi-eval/render.template.html diff --git a/libraries/graphs/line-plot-multi-eval/build.template.html b/libraries/graphs/line-plot-multi-eval/build.template.html new file mode 100644 index 0000000000..f11f8ddb4b --- /dev/null +++ b/libraries/graphs/line-plot-multi-eval/build.template.html @@ -0,0 +1,29 @@ +
+
+

Line Plot For Evaluations (multiple parameters)

+
+
+
+ + + + + + + +
+
+ +
\ No newline at end of file diff --git a/libraries/graphs/line-plot-multi-eval/config.json b/libraries/graphs/line-plot-multi-eval/config.json new file mode 100644 index 0000000000..647f928a9f --- /dev/null +++ b/libraries/graphs/line-plot-multi-eval/config.json @@ -0,0 +1,5 @@ +{ + "name": "Line Plot For Evaluations(multiple parameters)", + "type": "line-plot-multi-eval", + "required": "chartjs" +} \ No newline at end of file diff --git a/libraries/graphs/line-plot-multi-eval/process.php b/libraries/graphs/line-plot-multi-eval/process.php new file mode 100644 index 0000000000..ea4c29c94b --- /dev/null +++ b/libraries/graphs/line-plot-multi-eval/process.php @@ -0,0 +1,81 @@ + []]; +$colors = ['#00c0ef', '#3c8dbc', '#f56954']; + +$parameterData = []; +$labels = []; + +if (!is_array($parameter)) { + $parameter = explode(",", $parameter); +} + +// put together jobs +$arr = Util::mergeJobs($jobs, $parameter); +$jobGroups = $arr[0]; +$internLabels = $arr[1]; + +$colorIndex = 0; +for ($i = 0; $i < sizeof($jobGroups[0]); $i++) { + $parameterData[$i]['label'] = $internLabels[$i]; + $parameterData[$i]['backgroundColor'] = $colors[$colorIndex % sizeof($colors)]; + $parameterData[$i]['borderColor'] = $colors[$colorIndex % sizeof($colors)]; + $parameterData[$i]['fill'] = false; + $colorIndex++; +} + +$arr = Util::getDifferentParameters($jobs); +$changingParameters = $arr[0]; +$jobParameters = $arr[1]; + +foreach ($jobGroups as $jobGroup) { + /** @var $jobGroup Job[][] */ + $jobIds = []; + $index = 0; + foreach ($jobGroup as $j) { + $sum = 0; + foreach ($j as $job) { + $results = json_decode($job->getResult(), true); + foreach ($parameter as $p) { + if (isset($results[$allData['plotting']])) { + $sum += floatval($results[$allData['plotting']]); + } + } + } + $parameterData[$index]['data'][] = $sum / sizeof($j); + $jobIds[] = $j[0]->getInternalId(); + $index++; + } + $label = []; + foreach ($changingParameters as $changingParameter) { + if (in_array($changingParameter, $parameter)) { + continue; + } else if ($changingParameter == 'run') { + continue; + } + $label[] = $changingParameter . ": " . $jobParameters[$jobGroup[0][0]->getId()][$changingParameter]; + } + + $labels[] = "Jobs[" . implode(", ", $label) . "]"; +} + +foreach ($parameterData as $pData) { + $dataArray['datasets'][] = $pData; + $dataArray['labels'] = $labels; +} + +$plotData = json_encode($dataArray); \ No newline at end of file diff --git a/libraries/graphs/line-plot-multi-eval/render.template.html b/libraries/graphs/line-plot-multi-eval/render.template.html new file mode 100644 index 0000000000..37d3d9f0be --- /dev/null +++ b/libraries/graphs/line-plot-multi-eval/render.template.html @@ -0,0 +1,33 @@ +
+ +
+ + + From 262cf5cd28a062e32cd0b0a533aa87e4ec8624ee Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 10 Sep 2024 17:41:56 +0200 Subject: [PATCH 2/3] Introduced Line Plot Multi for Evaluation Comparisons --- libraries/graphs/line-plot-multi-eval/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/graphs/line-plot-multi-eval/config.json b/libraries/graphs/line-plot-multi-eval/config.json index 647f928a9f..e785cdb67e 100644 --- a/libraries/graphs/line-plot-multi-eval/config.json +++ b/libraries/graphs/line-plot-multi-eval/config.json @@ -1,5 +1,5 @@ { - "name": "Line Plot For Evaluations(multiple parameters)", + "name": "Line Plot For Evaluations (multiple parameters)", "type": "line-plot-multi-eval", "required": "chartjs" } \ No newline at end of file From e82f4a627633ef9fa0d90557771380d744acb0c6 Mon Sep 17 00:00:00 2001 From: PatrikB Date: Tue, 10 Sep 2024 17:44:57 +0200 Subject: [PATCH 3/3] Introduced Line Plot Multi for Evaluation Comparisons --- libraries/graphs/line-plot-multi-eval/build.template.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/graphs/line-plot-multi-eval/build.template.html b/libraries/graphs/line-plot-multi-eval/build.template.html index f11f8ddb4b..d2dbaa9853 100644 --- a/libraries/graphs/line-plot-multi-eval/build.template.html +++ b/libraries/graphs/line-plot-multi-eval/build.template.html @@ -6,7 +6,7 @@

Line Plot For Evaluations (multiple parameters)

- +