|
@@ -48,6 +48,8 @@ function ($) {
|
|
|
//now we know the current X (j) position for X and Y values
|
|
//now we know the current X (j) position for X and Y values
|
|
|
var last_value = 0; //needed for stacked values
|
|
var last_value = 0; //needed for stacked values
|
|
|
|
|
|
|
|
|
|
+ var minDistance, minTime;
|
|
|
|
|
+
|
|
|
for (i = 0; i < seriesList.length; i++) {
|
|
for (i = 0; i < seriesList.length; i++) {
|
|
|
series = seriesList[i];
|
|
series = seriesList[i];
|
|
|
|
|
|
|
@@ -65,6 +67,13 @@ function ($) {
|
|
|
hoverDistance = pos.x - series.data[hoverIndex][0];
|
|
hoverDistance = pos.x - series.data[hoverIndex][0];
|
|
|
pointTime = series.data[hoverIndex][0];
|
|
pointTime = series.data[hoverIndex][0];
|
|
|
|
|
|
|
|
|
|
+ if (! minDistance
|
|
|
|
|
+ || (hoverDistance >=0 && (hoverDistance < minDistance || minDistance < 0))
|
|
|
|
|
+ || (hoverDistance < 0 && hoverDistance > minDistance)) {
|
|
|
|
|
+ minDistance = hoverDistance;
|
|
|
|
|
+ minTime = pointTime;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
if (series.stack) {
|
|
if (series.stack) {
|
|
|
if (panel.tooltip.value_type === 'individual') {
|
|
if (panel.tooltip.value_type === 'individual') {
|
|
|
value = series.data[hoverIndex][1];
|
|
value = series.data[hoverIndex][1];
|
|
@@ -103,6 +112,9 @@ function ($) {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ // Find point which closer to pointer
|
|
|
|
|
+ results.time = minTime;
|
|
|
|
|
+
|
|
|
return results;
|
|
return results;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -147,6 +159,8 @@ function ($) {
|
|
|
|
|
|
|
|
seriesHtml = '';
|
|
seriesHtml = '';
|
|
|
|
|
|
|
|
|
|
+ absoluteTime = dashboard.formatDate(seriesHoverInfo.time, tooltipFormat);
|
|
|
|
|
+
|
|
|
// Dynamically reorder the hovercard for the current time point if the
|
|
// Dynamically reorder the hovercard for the current time point if the
|
|
|
// option is enabled, sort by yaxis by default.
|
|
// option is enabled, sort by yaxis by default.
|
|
|
if (panel.tooltip.sort === 2) {
|
|
if (panel.tooltip.sort === 2) {
|
|
@@ -163,8 +177,6 @@ function ($) {
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- var distance, time;
|
|
|
|
|
-
|
|
|
|
|
for (i = 0; i < seriesHoverInfo.length; i++) {
|
|
for (i = 0; i < seriesHoverInfo.length; i++) {
|
|
|
hoverInfo = seriesHoverInfo[i];
|
|
hoverInfo = seriesHoverInfo[i];
|
|
|
|
|
|
|
@@ -172,13 +184,6 @@ function ($) {
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if (! distance
|
|
|
|
|
- || (hoverInfo.distance >=0 && (hoverInfo.distance < distance || distance < 0))
|
|
|
|
|
- || (hoverInfo.distance < 0 && hoverInfo.distance > distance)) {
|
|
|
|
|
- distance = hoverInfo.distance;
|
|
|
|
|
- time = hoverInfo.time;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
var highlightClass = '';
|
|
var highlightClass = '';
|
|
|
if (item && i === item.seriesIndex) {
|
|
if (item && i === item.seriesIndex) {
|
|
|
highlightClass = 'graph-tooltip-list-item--highlight';
|
|
highlightClass = 'graph-tooltip-list-item--highlight';
|
|
@@ -194,7 +199,6 @@ function ($) {
|
|
|
plot.highlight(hoverInfo.index, hoverInfo.hoverIndex);
|
|
plot.highlight(hoverInfo.index, hoverInfo.hoverIndex);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- absoluteTime = dashboard.formatDate(time, tooltipFormat);
|
|
|
|
|
self.showTooltip(absoluteTime, seriesHtml, pos);
|
|
self.showTooltip(absoluteTime, seriesHtml, pos);
|
|
|
}
|
|
}
|
|
|
// single series tooltip
|
|
// single series tooltip
|