make tooltipPlugin more generic for further use

This commit is contained in:
Nick Krecklow 2020-05-11 00:42:02 -05:00
parent 1ff9478988
commit 9987434fea
No known key found for this signature in database
GPG Key ID: 5F149FDE156FFA94
3 changed files with 4 additions and 8 deletions

@ -80,9 +80,9 @@ export class ServerRegistration {
// eslint-disable-next-line new-cap
this._plotInstance = new uPlot({
plugins: [
uPlotTooltipPlugin((pos, point) => {
uPlotTooltipPlugin((pos, id, plot) => {
if (pos) {
const text = formatNumber(point.y) + ' Players<br>' + formatTimestamp(point.x * 1000)
const text = formatNumber(plot.data[1][id]) + ' Players<br>' + formatTimestamp(plot.data[0][id] * 1000)
this._app.tooltip.set(pos.left, pos.top, 10, 10, text)
} else {

@ -20,11 +20,7 @@ export function uPlotTooltipPlugin (onHover) {
onHover({
left: bounds.left + left + window.pageXOffset,
top: bounds.top + top + window.pageYOffset
}, {
idx,
x: u.data[0][idx],
y: u.data[1][idx]
})
}, idx, u)
}
}
}

@ -10,7 +10,7 @@
"connectTimeout": 2500
},
"performance": {
"skipUnfurlSrv": false,
"skipUnfurlSrv": true,
"unfurlSrvCacheTtl": 120000
},
"logToDatabase": true,