|
|
@@ -9,7 +9,7 @@ function ($) {
|
|
|
|
|
|
var $tooltip = $('<div id="tooltip">');
|
|
|
|
|
|
- this.findHoverIndexFromDataPoints = function(posX, series,last) {
|
|
|
+ this.findHoverIndexFromDataPoints = function(posX, series, last) {
|
|
|
var ps = series.datapoints.pointsize;
|
|
|
var initial = last*ps;
|
|
|
var len = series.datapoints.points.length;
|
|
|
@@ -38,34 +38,10 @@ function ($) {
|
|
|
};
|
|
|
|
|
|
this.getMultiSeriesPlotHoverInfo = function(seriesList, pos) {
|
|
|
- var value, i, series, hoverIndex, seriesTmp;
|
|
|
+ var value, i, series, hoverIndex;
|
|
|
var results = [];
|
|
|
|
|
|
- var pointCount;
|
|
|
- for (i = 0; i < seriesList.length; i++) {
|
|
|
- seriesTmp = seriesList[i];
|
|
|
- if (!seriesTmp.data.length) { continue; }
|
|
|
-
|
|
|
- if (!pointCount) {
|
|
|
- series = seriesTmp;
|
|
|
- pointCount = series.data.length;
|
|
|
- continue;
|
|
|
- }
|
|
|
-
|
|
|
- if (seriesTmp.data.length !== pointCount) {
|
|
|
- results.pointCountMismatch = true;
|
|
|
- return results;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- hoverIndex = this.findHoverIndexFromData(pos.x, series);
|
|
|
- var lasthoverIndex = 0;
|
|
|
- if(!scope.panel.steppedLine) {
|
|
|
- lasthoverIndex = hoverIndex;
|
|
|
- }
|
|
|
-
|
|
|
//now we know the current X (j) position for X and Y values
|
|
|
- results.time = series.data[hoverIndex][0];
|
|
|
var last_value = 0; //needed for stacked values
|
|
|
|
|
|
for (i = 0; i < seriesList.length; i++) {
|
|
|
@@ -76,6 +52,9 @@ function ($) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
+ hoverIndex = this.findHoverIndexFromData(pos.x, series);
|
|
|
+ results.time = series.data[hoverIndex][0];
|
|
|
+
|
|
|
if (scope.panel.stack) {
|
|
|
if (scope.panel.tooltip.value_type === 'individual') {
|
|
|
value = series.data[hoverIndex][1];
|
|
|
@@ -90,19 +69,9 @@ function ($) {
|
|
|
// Highlighting multiple Points depending on the plot type
|
|
|
if (scope.panel.steppedLine || (scope.panel.stack && scope.panel.nullPointMode == "null")) {
|
|
|
// stacked and steppedLine plots can have series with different length.
|
|
|
- // Stacked series can increase its length on each new stacked serie if null points found,
|
|
|
- // to speed the index search we begin always on the las found hoverIndex.
|
|
|
- var newhoverIndex = this.findHoverIndexFromDataPoints(pos.x, series,lasthoverIndex);
|
|
|
- // update lasthoverIndex depends also on the plot type.
|
|
|
- if(!scope.panel.steppedLine) {
|
|
|
- // on stacked graphs new will be always greater than last
|
|
|
- lasthoverIndex = newhoverIndex;
|
|
|
- } else {
|
|
|
- // if steppeLine, not always series increases its length, so we should begin
|
|
|
- // to search correct index from the original hoverIndex on each serie.
|
|
|
- lasthoverIndex = hoverIndex;
|
|
|
- }
|
|
|
-
|
|
|
+ // Stacked series can increase its length on each new stacked serie if null points found,
|
|
|
+ // to speed the index search we begin always on the last found hoverIndex.
|
|
|
+ var newhoverIndex = this.findHoverIndexFromDataPoints(pos.x, series, hoverIndex);
|
|
|
results.push({ value: value, hoverIndex: newhoverIndex});
|
|
|
} else {
|
|
|
results.push({ value: value, hoverIndex: hoverIndex});
|
|
|
@@ -141,13 +110,6 @@ function ($) {
|
|
|
plot.unhighlight();
|
|
|
|
|
|
var seriesHoverInfo = self.getMultiSeriesPlotHoverInfo(plotData, pos);
|
|
|
- if (seriesHoverInfo.pointCountMismatch) {
|
|
|
- self.showTooltip('Shared tooltip error', '<ul>' +
|
|
|
- '<li>Series point counts are not the same</li>' +
|
|
|
- '<li>Set null point mode to null or null as zero</li>' +
|
|
|
- '<li>For influxdb users set fill(0) in your query</li></ul>', pos);
|
|
|
- return;
|
|
|
- }
|
|
|
|
|
|
seriesHtml = '';
|
|
|
timestamp = dashboard.formatDate(seriesHoverInfo.time);
|