fix(webui): timeline opens on full landscape, drop undated points

After the chronological-order fix the page opened on the earliest month
(1995-12), showing only a handful of same-colored dots while the legend
listed every category — looked broken.

- Initialise the plot on the LAST frame (full landscape); Play now replays
  the build-up from the start (fromcurrent: false), slider starts at the end.
- Make _extract_month robust: year-only / junk dates (ISO/ETSI 'time' like
  '2015/CD Amd 2', bare '2023', '') no longer yield malformed month labels
  ('2015-/C') or a garbled 'unknown' frame badge.
- Drop undated docs from the temporal animation (they remain on /landscape).

At the full initial frame every category has points, so the legend matches
what is drawn.
This commit is contained in:
2026-05-23 11:52:13 +02:00
parent d449b04509
commit e166091388
3 changed files with 21 additions and 13 deletions

View File

@@ -141,9 +141,12 @@ if (points.length > 0 && months.length > 0) {
};
});
// --- Initial plot (first month) ---
const firstTraces = buildTraces(months[0]);
const firstCount = points.filter(p => p.month <= months[0]).length;
// --- Initial plot: show the FULL landscape (last frame) so the page
// doesn't open on the near-empty earliest month. Play replays from
// the start to animate the build-up. ---
const initMonth = months[months.length - 1];
const initTraces = buildTraces(initMonth);
const initCount = points.length;
// Slider steps
const sliderSteps = months.map(month => ({
@@ -165,7 +168,7 @@ if (points.length > 0 && months.length > 0) {
{
label: '&#9654; Play',
method: 'animate',
args: [null, { frame: { duration: 500, redraw: true }, transition: { duration: 300 }, fromcurrent: true }]
args: [null, { frame: { duration: 500, redraw: true }, transition: { duration: 300 }, fromcurrent: false }]
},
{
label: '&#9724; Pause',
@@ -175,7 +178,7 @@ if (points.length > 0 && months.length > 0) {
]
}],
sliders: [{
active: 0,
active: months.length - 1,
steps: sliderSteps,
x: 0.05, len: 0.9,
xanchor: 'left',
@@ -194,13 +197,13 @@ if (points.length > 0 && months.length > 0) {
}],
};
Plotly.newPlot('tsneAnim', firstTraces, layout, CFG).then(() => {
Plotly.newPlot('tsneAnim', initTraces, layout, CFG).then(() => {
Plotly.addFrames('tsneAnim', frames);
});
// Update badge on animation frame
const badge = document.querySelector('#monthBadge span');
badge.textContent = `${fmtMonth(months[0])}${firstCount} drafts`;
badge.textContent = `${fmtMonth(initMonth)}${initCount} drafts`;
document.getElementById('tsneAnim').on('plotly_animatingframe', function(ev) {
const month = ev.name;