Improve event tooltip with series info
This commit is contained in:
parent
cf30e830a0
commit
1ec09e1b76
27
script.js
27
script.js
@ -764,7 +764,9 @@ function showEonstripDetail(index, startCob) {
|
||||
start: relStart,
|
||||
end: relEnd,
|
||||
cobStart: occ,
|
||||
cobEnd: occ + duration
|
||||
cobEnd: occ + duration,
|
||||
seriesStart: startCobEv,
|
||||
seriesEnd: endCobEv
|
||||
});
|
||||
occ += interval;
|
||||
}
|
||||
@ -813,21 +815,26 @@ function showEonstripDetail(index, startCob) {
|
||||
|
||||
const tooltip = document.createElement('div');
|
||||
tooltip.className = 'tooltip';
|
||||
const opts = {
|
||||
const optsShort = {
|
||||
timeZone: currentTimezone === 'TAI' ? 'UTC' : currentTimezone,
|
||||
year: 'numeric', month: 'short', day: 'numeric',
|
||||
hour: '2-digit', minute: '2-digit', second: '2-digit',
|
||||
hour: '2-digit', minute: '2-digit',
|
||||
hour12: false
|
||||
};
|
||||
const startStr = formatCobieTimestamp(ev.cobStart);
|
||||
const endStr = formatCobieTimestamp(ev.cobEnd);
|
||||
const startDate = fromCobiets(ev.cobStart).toLocaleString('en-US', opts);
|
||||
const endDate = fromCobiets(ev.cobEnd).toLocaleString('en-US', opts);
|
||||
|
||||
const startStr = formatCobieTimestamp(ev.cobStart);
|
||||
const endStr = formatCobieTimestamp(ev.cobEnd);
|
||||
const startDate = fromCobiets(ev.cobStart).toLocaleString('en-US', optsShort);
|
||||
const endDate = fromCobiets(ev.cobEnd).toLocaleString('en-US', optsShort);
|
||||
const seriesStart = formatCobieTimestamp(ev.seriesStart);
|
||||
const seriesEnd = isFinite(ev.seriesEnd) ?
|
||||
formatCobieTimestamp(ev.seriesEnd) : '∞';
|
||||
|
||||
tooltip.innerHTML =
|
||||
`<strong>${ev.label}</strong><br>` +
|
||||
`Start: ${startStr}<br>` +
|
||||
`End: ${endStr}<br>` +
|
||||
`${startDate} – ${endDate}`;
|
||||
`Start: ${startStr} (${startDate})<br>` +
|
||||
`End: ${endStr} (${endDate})<br>` +
|
||||
`Series: ${seriesStart} – ${seriesEnd}`;
|
||||
elem.appendChild(tooltip);
|
||||
timeline.appendChild(elem);
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user