diff --git a/public/app/plugins/panel/graph/graph_tooltip.js b/public/app/plugins/panel/graph/graph_tooltip.js index 9ab6369a6b2..0c2136f7d9d 100644 --- a/public/app/plugins/panel/graph/graph_tooltip.js +++ b/public/app/plugins/panel/graph/graph_tooltip.js @@ -81,9 +81,9 @@ function ($) { // 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 }); + results.push({ value: value, hoverIndex: newhoverIndex, color: series.color, label: series.label }); } else { - results.push({ value: value, hoverIndex: hoverIndex }); + results.push({ value: value, hoverIndex: hoverIndex, color: series.color, label: series.label }); } } @@ -133,6 +133,18 @@ function ($) { absoluteTime = dashboard.formatDate(seriesHoverInfo.time, tooltipFormat); + // Dynamically reorder the hovercard for the current time point if the + // option is enabled. + if (panel.tooltip.ordering === 'decreasing') { + seriesHoverInfo.sort(function(a, b) { + return parseFloat(b.value) - parseFloat(a.value); + }); + } else if (panel.tooltip.ordering === 'increasing') { + seriesHoverInfo.sort(function(a, b) { + return parseFloat(a.value) - parseFloat(b.value); + }); + } + for (i = 0; i < seriesHoverInfo.length; i++) { hoverInfo = seriesHoverInfo[i]; @@ -150,7 +162,7 @@ function ($) { value = series.formatValue(hoverInfo.value); seriesHtml += '
'; - seriesHtml += ' ' + series.label + ':
'; + seriesHtml += ' ' + hoverInfo.label + ':
'; seriesHtml += '
' + value + '
'; plot.highlight(i, hoverInfo.hoverIndex); } diff --git a/public/app/plugins/panel/graph/module.ts b/public/app/plugins/panel/graph/module.ts index a11c537b178..2b2e75b5a33 100644 --- a/public/app/plugins/panel/graph/module.ts +++ b/public/app/plugins/panel/graph/module.ts @@ -92,6 +92,7 @@ class GraphCtrl extends MetricsPanelCtrl { tooltip : { value_type: 'cumulative', shared: true, + ordering: 'alphabetical', msResolution: false, }, // time overrides diff --git a/public/app/plugins/panel/graph/tab_display.html b/public/app/plugins/panel/graph/tab_display.html index 067651540e2..a33ae0bc67f 100644 --- a/public/app/plugins/panel/graph/tab_display.html +++ b/public/app/plugins/panel/graph/tab_display.html @@ -42,23 +42,29 @@
Misc options
- +
- +
- +
+
+ +
+ +
+