diff --git a/web/ticket-order.js b/web/ticket-order.js
index 89e5d8f..0a7df20 100644
--- a/web/ticket-order.js
+++ b/web/ticket-order.js
@@ -190,10 +190,24 @@
}
stationYByCanonical = {};
+ const ysByCanonical = {};
for (const c of Object.keys(primaryLineByStation)) {
const li = primaryLineByStation[c];
if (li == null) continue;
- stationYByCanonical[c] = baseY + li * lineGapY;
+ const canonical = stationCanonicalByCode[c] || c;
+ if (!ysByCanonical[canonical]) ysByCanonical[canonical] = [];
+ ysByCanonical[canonical].push(baseY + li * lineGapY);
+ }
+
+ const canonicalY = {};
+ for (const canonical of Object.keys(ysByCanonical)) {
+ const ys = ysByCanonical[canonical];
+ canonicalY[canonical] = ys.reduce((a,b) => a+b, 0) / ys.length;
+ }
+
+ for (const c of Object.keys(primaryLineByStation)) {
+ const canonical = stationCanonicalByCode[c] || c;
+ stationYByCanonical[c] = canonicalY[canonical];
}
const allStations = Object.keys(primaryLineByStation);
@@ -229,7 +243,10 @@
let d = `M ${pts[0].x} ${pts[0].y}`;
for (let i = 1; i < pts.length; i++) {
- d += ` L ${pts[i].x} ${pts[i].y}`;
+ const prev = pts[i-1];
+ const curr = pts[i];
+ const midX = (prev.x + curr.x) / 2;
+ d += ` C ${midX} ${prev.y}, ${midX} ${curr.y}, ${curr.x} ${curr.y}`;
}
svgContent += ``;
}
@@ -238,11 +255,10 @@
for (const canonical of Object.keys(stationCodesByCanonical)) {
const codes = (stationCodesByCanonical[canonical] || []).filter(code => Number.isFinite(stationYByCanonical[code]));
if (codes.length < 2) continue;
- const ys = codes.map(code => stationYByCanonical[code]).sort((a, b) => a - b);
const x = stationXByCanonical[canonical];
- const labelY = ys[ys.length - 1] + 34;
- svgContent += ``;
- svgContent += ``;
+ const y = stationYByCanonical[codes[0]];
+ const labelY = y + 34;
+ svgContent += ``;
svgContent += ``;
svgContent += `${getStationDisplayName(canonical)}`;
labelShownForCanonical.add(canonical);