diff options
author | Camil Staps | 2024-01-24 09:40:30 +0100 |
---|---|---|
committer | Camil Staps | 2024-01-24 09:40:30 +0100 |
commit | fa80a2b56c4d501a2f648425d611554c6ee34372 (patch) | |
tree | b225f5dfd955aed6f49ef553b126b8fc36322ef0 /resources/pug/finals | |
parent | Update publication statistics (diff) |
Mention durations in tooltips on publications.html
Diffstat (limited to 'resources/pug/finals')
-rw-r--r-- | resources/pug/finals/publications.pug | 12 |
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, }); |