|
@@ -41,7 +41,7 @@ function ($, _) {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
this.getMultiSeriesPlotHoverInfo = function(seriesList, pos) {
|
|
this.getMultiSeriesPlotHoverInfo = function(seriesList, pos) {
|
|
|
- var value, i, series, hoverIndex, hoverDistance, pointTime;
|
|
|
|
|
|
|
+ var value, i, series, hoverIndex, hoverDistance, pointTime, yaxis;
|
|
|
var results = [];
|
|
var results = [];
|
|
|
|
|
|
|
|
//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
|
|
@@ -51,12 +51,12 @@ function ($, _) {
|
|
|
series = seriesList[i];
|
|
series = seriesList[i];
|
|
|
|
|
|
|
|
if (!series.data.length || (panel.legend.hideEmpty && series.allIsNull)) {
|
|
if (!series.data.length || (panel.legend.hideEmpty && series.allIsNull)) {
|
|
|
- results.push({ hidden: true });
|
|
|
|
|
|
|
+ results.push({ hidden: true, value: 0, yaxis: 0 });
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!series.data.length || (panel.legend.hideZero && series.allIsZero)) {
|
|
if (!series.data.length || (panel.legend.hideZero && series.allIsZero)) {
|
|
|
- results.push({ hidden: true });
|
|
|
|
|
|
|
+ results.push({ hidden: true, value: 0, yaxis: 0 });
|
|
|
continue;
|
|
continue;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -85,13 +85,20 @@ function ($, _) {
|
|
|
hoverIndex = this.findHoverIndexFromDataPoints(pos.x, series, hoverIndex);
|
|
hoverIndex = this.findHoverIndexFromDataPoints(pos.x, series, hoverIndex);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ yaxis = 0;
|
|
|
|
|
+ if (series.yaxis) {
|
|
|
|
|
+ yaxis = series.yaxis.n;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
results.push({
|
|
results.push({
|
|
|
value: value,
|
|
value: value,
|
|
|
hoverIndex: hoverIndex,
|
|
hoverIndex: hoverIndex,
|
|
|
color: series.color,
|
|
color: series.color,
|
|
|
label: series.label,
|
|
label: series.label,
|
|
|
time: pointTime,
|
|
time: pointTime,
|
|
|
- distance: hoverDistance
|
|
|
|
|
|
|
+ distance: hoverDistance,
|
|
|
|
|
+ yaxis: yaxis,
|
|
|
|
|
+ index: i
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -145,7 +152,7 @@ function ($, _) {
|
|
|
absoluteTime = dashboard.formatDate(seriesHoverInfo.time, tooltipFormat);
|
|
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.
|
|
|
|
|
|
|
+ // option is enabled, sort by yaxis by default.
|
|
|
if (panel.tooltip.sort === 2) {
|
|
if (panel.tooltip.sort === 2) {
|
|
|
seriesHoverInfo.sort(function(a, b) {
|
|
seriesHoverInfo.sort(function(a, b) {
|
|
|
return b.value - a.value;
|
|
return b.value - a.value;
|
|
@@ -155,6 +162,11 @@ function ($, _) {
|
|
|
return a.value - b.value;
|
|
return a.value - b.value;
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
|
|
+ else {
|
|
|
|
|
+ seriesHoverInfo.sort(function(a, b) {
|
|
|
|
|
+ return a.yaxis - b.yaxis;
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
for (i = 0; i < seriesHoverInfo.length; i++) {
|
|
for (i = 0; i < seriesHoverInfo.length; i++) {
|
|
|
hoverInfo = seriesHoverInfo[i];
|
|
hoverInfo = seriesHoverInfo[i];
|
|
@@ -168,14 +180,14 @@ function ($, _) {
|
|
|
highlightClass = 'graph-tooltip-list-item--highlight';
|
|
highlightClass = 'graph-tooltip-list-item--highlight';
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- series = seriesList[i];
|
|
|
|
|
|
|
+ series = seriesList[hoverInfo.index];
|
|
|
|
|
|
|
|
value = series.formatValue(hoverInfo.value);
|
|
value = series.formatValue(hoverInfo.value);
|
|
|
|
|
|
|
|
seriesHtml += '<div class="graph-tooltip-list-item ' + highlightClass + '"><div class="graph-tooltip-series-name">';
|
|
seriesHtml += '<div class="graph-tooltip-list-item ' + highlightClass + '"><div class="graph-tooltip-series-name">';
|
|
|
seriesHtml += '<i class="fa fa-minus" style="color:' + hoverInfo.color +';"></i> ' + hoverInfo.label + ':</div>';
|
|
seriesHtml += '<i class="fa fa-minus" style="color:' + hoverInfo.color +';"></i> ' + hoverInfo.label + ':</div>';
|
|
|
seriesHtml += '<div class="graph-tooltip-value">' + value + '</div></div>';
|
|
seriesHtml += '<div class="graph-tooltip-value">' + value + '</div></div>';
|
|
|
- plot.highlight(i, hoverInfo.hoverIndex);
|
|
|
|
|
|
|
+ plot.highlight(hoverInfo.index, hoverInfo.hoverIndex);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
self.showTooltip(absoluteTime, seriesHtml, pos);
|
|
self.showTooltip(absoluteTime, seriesHtml, pos);
|