make tooltipPlugin more generic for further use
This commit is contained in:
parent
1ff9478988
commit
9987434fea
@ -80,9 +80,9 @@ export class ServerRegistration {
|
|||||||
// eslint-disable-next-line new-cap
|
// eslint-disable-next-line new-cap
|
||||||
this._plotInstance = new uPlot({
|
this._plotInstance = new uPlot({
|
||||||
plugins: [
|
plugins: [
|
||||||
uPlotTooltipPlugin((pos, point) => {
|
uPlotTooltipPlugin((pos, id, plot) => {
|
||||||
if (pos) {
|
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)
|
this._app.tooltip.set(pos.left, pos.top, 10, 10, text)
|
||||||
} else {
|
} else {
|
||||||
|
@ -20,11 +20,7 @@ export function uPlotTooltipPlugin (onHover) {
|
|||||||
onHover({
|
onHover({
|
||||||
left: bounds.left + left + window.pageXOffset,
|
left: bounds.left + left + window.pageXOffset,
|
||||||
top: bounds.top + top + window.pageYOffset
|
top: bounds.top + top + window.pageYOffset
|
||||||
}, {
|
}, idx, u)
|
||||||
idx,
|
|
||||||
x: u.data[0][idx],
|
|
||||||
y: u.data[1][idx]
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
"connectTimeout": 2500
|
"connectTimeout": 2500
|
||||||
},
|
},
|
||||||
"performance": {
|
"performance": {
|
||||||
"skipUnfurlSrv": false,
|
"skipUnfurlSrv": true,
|
||||||
"unfurlSrvCacheTtl": 120000
|
"unfurlSrvCacheTtl": 120000
|
||||||
},
|
},
|
||||||
"logToDatabase": true,
|
"logToDatabase": true,
|
||||||
|
Loading…
Reference in New Issue
Block a user