mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
tslint: autofix of let -> const (#13033)
This commit is contained in:
@@ -2,20 +2,20 @@ import $ from 'jquery';
|
||||
import { appEvents } from 'app/core/core';
|
||||
|
||||
export default function GraphTooltip(elem, dashboard, scope, getSeriesFn) {
|
||||
let self = this;
|
||||
let ctrl = scope.ctrl;
|
||||
let panel = ctrl.panel;
|
||||
const self = this;
|
||||
const ctrl = scope.ctrl;
|
||||
const panel = ctrl.panel;
|
||||
|
||||
let $tooltip = $('<div class="graph-tooltip">');
|
||||
const $tooltip = $('<div class="graph-tooltip">');
|
||||
|
||||
this.destroy = function() {
|
||||
$tooltip.remove();
|
||||
};
|
||||
|
||||
this.findHoverIndexFromDataPoints = function(posX, series, last) {
|
||||
let ps = series.datapoints.pointsize;
|
||||
let initial = last * ps;
|
||||
let len = series.datapoints.points.length;
|
||||
const ps = series.datapoints.pointsize;
|
||||
const initial = last * ps;
|
||||
const len = series.datapoints.points.length;
|
||||
let j;
|
||||
for (j = initial; j < len; j += ps) {
|
||||
// Special case of a non stepped line, highlight the very last point just before a null point
|
||||
@@ -149,7 +149,7 @@ export default function GraphTooltip(elem, dashboard, scope, getSeriesFn) {
|
||||
|
||||
elem.mouseleave(function() {
|
||||
if (panel.tooltip.shared) {
|
||||
let plot = elem.data().plot;
|
||||
const plot = elem.data().plot;
|
||||
if (plot) {
|
||||
$tooltip.detach();
|
||||
plot.unhighlight();
|
||||
@@ -177,25 +177,25 @@ export default function GraphTooltip(elem, dashboard, scope, getSeriesFn) {
|
||||
};
|
||||
|
||||
this.show = function(pos, item) {
|
||||
let plot = elem.data().plot;
|
||||
let plotData = plot.getData();
|
||||
let xAxes = plot.getXAxes();
|
||||
let xMode = xAxes[0].options.mode;
|
||||
let seriesList = getSeriesFn();
|
||||
const plot = elem.data().plot;
|
||||
const plotData = plot.getData();
|
||||
const xAxes = plot.getXAxes();
|
||||
const xMode = xAxes[0].options.mode;
|
||||
const seriesList = getSeriesFn();
|
||||
let allSeriesMode = panel.tooltip.shared;
|
||||
let group, value, absoluteTime, hoverInfo, i, series, seriesHtml, tooltipFormat;
|
||||
|
||||
// if panelRelY is defined another panel wants us to show a tooltip
|
||||
// get pageX from position on x axis and pageY from relative position in original panel
|
||||
if (pos.panelRelY) {
|
||||
let pointOffset = plot.pointOffset({ x: pos.x });
|
||||
const pointOffset = plot.pointOffset({ x: pos.x });
|
||||
if (Number.isNaN(pointOffset.left) || pointOffset.left < 0 || pointOffset.left > elem.width()) {
|
||||
self.clear(plot);
|
||||
return;
|
||||
}
|
||||
pos.pageX = elem.offset().left + pointOffset.left;
|
||||
pos.pageY = elem.offset().top + elem.height() * pos.panelRelY;
|
||||
let isVisible =
|
||||
const isVisible =
|
||||
pos.pageY >= $(window).scrollTop() && pos.pageY <= $(window).innerHeight() + $(window).scrollTop();
|
||||
if (!isVisible) {
|
||||
self.clear(plot);
|
||||
@@ -223,7 +223,7 @@ export default function GraphTooltip(elem, dashboard, scope, getSeriesFn) {
|
||||
if (allSeriesMode) {
|
||||
plot.unhighlight();
|
||||
|
||||
let seriesHoverInfo = self.getMultiSeriesPlotHoverInfo(plotData, pos);
|
||||
const seriesHoverInfo = self.getMultiSeriesPlotHoverInfo(plotData, pos);
|
||||
|
||||
seriesHtml = '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user