impl updated graph tooltips

This commit is contained in:
Nick Krecklow
2020-05-11 20:05:34 -05:00
parent 9d8dce716b
commit 8177c43d15
4 changed files with 65 additions and 40 deletions

View File

@ -80,19 +80,17 @@ export class ServerRegistration {
// eslint-disable-next-line new-cap
this._plotInstance = new uPlot({
plugins: [
uPlotTooltipPlugin((pos, id, plot) => {
uPlotTooltipPlugin((pos, id) => {
if (pos) {
const playerCount = plot.data[1][id]
const playerCount = this._graphData[1][id]
if (typeof playerCount !== 'number') {
this._app.tooltip.hide()
} else {
const text = formatNumber(playerCount) + ' Players<br>' + formatTimestampSeconds(this._graphData[0][id])
return
this._app.tooltip.set(pos.left, pos.top, 10, 10, text)
}
const text = formatNumber(playerCount) + ' Players<br>' + formatTimestampSeconds(plot.data[0][id])
this._app.tooltip.set(pos.left, pos.top, 10, 10, text)
} else {
this._app.tooltip.hide()
}