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 000000000..d2dbaa985 --- /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 000000000..e785cdb67 --- /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 000000000..ea4c29c94 --- /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 000000000..37d3d9f0b --- /dev/null +++ b/libraries/graphs/line-plot-multi-eval/render.template.html @@ -0,0 +1,33 @@ +
+ +
+ + +