2025-11-11 18:42:55 +00:00
|
|
|
|
2025-11-10 18:31:32 +00:00
|
|
|
<svg [attr.viewBox]="viewBox" xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
style="border: solid thin black; margin: 1rem; padding: 5px">
|
2025-11-11 18:42:55 +00:00
|
|
|
@let allSinglePoints = getSinglePoints();
|
|
|
|
|
@let firstPoint = allSinglePoints[0];
|
|
|
|
|
@let lastPoint = allSinglePoints[allSinglePoints.length - 1];
|
|
|
|
|
<line [attr.x1]="firstPoint" [attr.y1]="1.5*normalizedLineHeight" [attr.x2]="lastPoint"
|
|
|
|
|
[attr.y2]="1.5*normalizedLineHeight" [attr.stroke-width]="normalizedNumberLineStrokeWidth" stroke="#000000">
|
|
|
|
|
</line>
|
|
|
|
|
@for (singlePoint of allSinglePoints; track $index) {
|
|
|
|
|
<line [attr.x1]="singlePoint" [attr.y1]="normalizedLineHeight" [attr.x2]="singlePoint"
|
|
|
|
|
[attr.y2]="2*normalizedLineHeight" [attr.stroke-width]="normalizedNumberLineStrokeWidth" stroke="#000000">
|
|
|
|
|
</line>
|
|
|
|
|
<text [attr.font-size]="normalizedNumberLineFontSize" [attr.x]="singlePoint"
|
|
|
|
|
[attr.y]="$index % 2 === 0 ? normalizedLineHeight : 2*normalizedLineHeight"
|
|
|
|
|
[attr.alignment-baseline]="$index % 2 === 1 ? 'before-edge' : 'after-edge'"
|
|
|
|
|
[attr.text-anchor]="singlePoint < lastPoint / 2 ? 'start' : 'end'">{{singlePoint}} mm</text>
|
|
|
|
|
}
|
2025-11-10 18:31:32 +00:00
|
|
|
@for (point of points; track $index; let index=$index) {
|
|
|
|
|
@let color = getRandomColor(index);
|
|
|
|
|
@for (line of lineCountNumber(point.count); track line) {
|
|
|
|
|
@let start = line % 2 === 1 ? point.start : point.end;
|
|
|
|
|
@let end = line % 2 === 1 ? point.end : point.start;
|
2025-11-11 18:42:55 +00:00
|
|
|
@let offset = (start > end ? 0.5 : -0.5) * normalizedStrokeWidth;
|
2025-11-10 18:31:32 +00:00
|
|
|
|
2025-11-11 18:42:55 +00:00
|
|
|
<line [attr.x1]="start + offset" [attr.y1]="getLineNumber(index, line) * lineGap + 0.5 * normalizedStrokeWidth"
|
|
|
|
|
[attr.x2]="end + offset" [attr.y2]="getLineNumber(index, line) * lineGap + 0.5 * normalizedStrokeWidth"
|
|
|
|
|
[attr.stroke]="color" [attr.stroke-width]="normalizedStrokeWidth" />
|
2025-11-10 18:31:32 +00:00
|
|
|
@if (index
|
2025-11-11 18:42:55 +00:00
|
|
|
< points.length - 1 || (index===points.length - 1 && line < point.count)) { <line [attr.x1]="end"
|
2025-11-10 18:31:32 +00:00
|
|
|
[attr.y1]="getLineNumber(index, line) * lineGap" [attr.x2]="end"
|
2025-11-11 18:42:55 +00:00
|
|
|
[attr.y2]="(getLineNumber(index, line)+1) * lineGap + normalizedStrokeWidth" [attr.stroke]="color"
|
|
|
|
|
[attr.stroke-width]="normalizedStrokeWidth" />
|
2025-11-10 18:31:32 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</svg>
|