summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorCamil Staps2024-01-24 09:40:30 +0100
committerCamil Staps2024-01-24 09:40:30 +0100
commitfa80a2b56c4d501a2f648425d611554c6ee34372 (patch)
treeb225f5dfd955aed6f49ef553b126b8fc36322ef0
parentUpdate publication statistics (diff)
Mention durations in tooltips on publications.html
-rw-r--r--resources/pug/finals/publications.pug12
1 files changed, 11 insertions, 1 deletions
diff --git a/resources/pug/finals/publications.pug b/resources/pug/finals/publications.pug
index 2de2fc1..d35fe08 100644
--- a/resources/pug/finals/publications.pug
+++ b/resources/pug/finals/publications.pug
@@ -123,7 +123,17 @@ block content
staticScale: 25,
},
tooltip: {
- xDateFormat: '%Y-%m-%d',
+ pointFormatter: function () {
+ const start = this.series.chart.time.dateFormat('%Y-%m-%d', this.start);
+
+ if (!this.end) { /* milestone */
+ return `<b>${this.name}</b> on ${start}`;
+ }
+
+ const days = Math.floor((this.end - this.start) / 1000 / 60 / 60 / 24);
+ const end = this.series.chart.time.dateFormat('%Y-%m-%d', this.end);
+ return `In <b>${this.name}</b> for ${days} days; ${start}–${end}`;
+ },
},
series,
});