Refine range results and restore new-tab view links

Zweite Runde Kundenrückmeldung:

- Range-Ergebnisse: Das Diagramm behält die komplette lineare Skala
  (rangeMin..rangeMax), aber die Werte-Liste/Tabelle zeigt nur noch die
  tatsächlich beantworteten Werte. Sonst würde eine große Skala (z. B. Alter
  1-100, Schrittweite 1) die Ergebnisseite mit hunderten Nullzeilen fluten.
  Neues Feld distributionRows für die Liste; distribution bleibt fürs Diagramm.
- Große Skalen: X-Achsenbeschriftung wird ausgedünnt (Chart.js autoSkip/
  maxTicksLimit, SVG jede n-te Beschriftung), Punkt-Marker verkleinert bzw.
  ab >40 Punkten weggelassen. Auch die Y-Ticks im PDF-SVG werden gedeckelt.
- PDF-Range-Tabelle ohne Farb-Swatch-Spalte (nur Wert/Anzahl/Anteil), da die
  Kopplung an ein Vollskalen-Diagramm nicht mehr sinnvoll ist.
- Aktionslinks in der Frontend-Liste: Öffentliche Ansicht, Entwurfs-Ansicht
  und Ergebnisse anzeigen öffnen wieder im neuen Fenster (target=_blank);
  nur Bearbeiten bleibt im selben Tab.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-05 20:15:05 +02:00
parent c7439e4822
commit 954a5102ac
6 changed files with 79 additions and 44 deletions
+18 -3
View File
@@ -361,7 +361,16 @@ final class SurveyResultsPdfService
$xLabels = [];
$yGrid = [];
for ($tick = 0; $tick <= $maxValue; ++$tick) {
// Große Skalen (z. B. Alter 1100): X-Beschriftung ausdünnen und die
// Punkt-Marker verkleinern bzw. weglassen, damit das Diagramm lesbar bleibt.
$pointCount = count($values);
$labelStep = max(1, (int) ceil($pointCount / 12));
$lastIndex = $pointCount - 1;
$pointRadius = $pointCount > 40 ? 0.0 : ($pointCount > 20 ? 3.0 : 5.5);
$yStep = max(1, (int) ceil($maxValue / 6));
for ($tick = 0; $tick <= $maxValue; $tick += $yStep) {
$ratio = $maxValue > 0 ? $tick / $maxValue : 0;
$y = $paddingTop + $plotHeight - ($ratio * $plotHeight);
$yGrid[] = sprintf('<line x1="%.2f" y1="%.2f" x2="%.2f" y2="%.2f" stroke="#d7dee8" stroke-width="1" />', $paddingLeft, $y, $width - $paddingRight, $y);
@@ -373,8 +382,14 @@ final class SurveyResultsPdfService
$y = $paddingTop + $plotHeight - (($value / $maxValue) * $plotHeight);
$polylinePoints[] = sprintf('%.2f,%.2f', $x, $y);
$areaPolylinePoints[] = sprintf('%.2f,%.2f', $x, $y);
$pointCircles[] = sprintf('<circle cx="%.2f" cy="%.2f" r="5.5" fill="%s" stroke="#ffffff" stroke-width="2" />', $x, $y, $this->escapeXml((string) ($pointColors[$index] ?? '#EC7C32')));
$xLabels[] = sprintf('<text x="%.2f" y="%.2f" text-anchor="middle" font-size="11" font-family="DejaVu Sans" fill="#555e68">%s</text>', $x, $height - 16, $this->escapeXml($labels[$index]));
if ($pointRadius > 0.0) {
$pointCircles[] = sprintf('<circle cx="%.2f" cy="%.2f" r="%.1f" fill="%s" stroke="#ffffff" stroke-width="2" />', $x, $y, $pointRadius, $this->escapeXml((string) ($pointColors[$index] ?? '#EC7C32')));
}
if (0 === $index % $labelStep || $index === $lastIndex) {
$xLabels[] = sprintf('<text x="%.2f" y="%.2f" text-anchor="middle" font-size="11" font-family="DejaVu Sans" fill="#555e68">%s</text>', $x, $height - 16, $this->escapeXml($labels[$index]));
}
}
$areaPoints = sprintf(