From 22b11d7d4da4d55d0755c25ee952b380d357078e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 9 Apr 2016 12:45:35 -0400 Subject: [PATCH] feat(graph panel): changed to PR #4493 and other polish, removed the relative time from graph tooltip, did not think it worked that well --- .../app/plugins/panel/graph/graph_tooltip.js | 19 ++++++++----------- public/sass/_variables.dark.scss | 5 +++-- public/sass/_variables.light.scss | 1 + public/sass/components/_panel_graph.scss | 13 +++++++------ public/sass/components/_tooltip.scss | 7 ------- 5 files changed, 19 insertions(+), 26 deletions(-) diff --git a/public/app/plugins/panel/graph/graph_tooltip.js b/public/app/plugins/panel/graph/graph_tooltip.js index afb473723ae..7f2b83220a8 100644 --- a/public/app/plugins/panel/graph/graph_tooltip.js +++ b/public/app/plugins/panel/graph/graph_tooltip.js @@ -33,9 +33,8 @@ function ($) { return j - 1; }; - this.showTooltip = function(absoluteTime, relativeTime, innerHtml, pos) { - var body = '
'+ absoluteTime + - ' (' + relativeTime + ')
'; + this.showTooltip = function(absoluteTime, innerHtml, pos) { + var body = '
'+ absoluteTime + '
'; body += innerHtml + '
'; $tooltip.html(body).place_tt(pos.pageX + 20, pos.pageY); }; @@ -109,7 +108,7 @@ function ($) { var plot = elem.data().plot; var plotData = plot.getData(); var seriesList = getSeriesFn(); - var group, value, absoluteTime, relativeTime, hoverInfo, i, series, seriesHtml, tooltipFormat; + var group, value, absoluteTime, hoverInfo, i, series, seriesHtml, tooltipFormat; if (panel.tooltip.msResolution) { tooltipFormat = 'YYYY-MM-DD HH:mm:ss.SSS'; @@ -132,7 +131,6 @@ function ($) { seriesHtml = ''; - relativeTime = dashboard.getRelativeTime(seriesHoverInfo.time); absoluteTime = dashboard.formatDate(seriesHoverInfo.time, tooltipFormat); for (i = 0; i < seriesHoverInfo.length; i++) { @@ -142,22 +140,22 @@ function ($) { continue; } - var highlightStyle = ''; + var highlightClass = ''; if (item && i === item.seriesIndex) { - highlightStyle = ' style="font-weight: bold;"'; + highlightClass = 'graph-tooltip-list-item--highlight'; } series = seriesList[i]; value = series.formatValue(hoverInfo.value); - seriesHtml += '
'; + seriesHtml += '
'; seriesHtml += ' ' + series.label + ':
'; seriesHtml += '
' + value + '
'; plot.highlight(i, hoverInfo.hoverIndex); } - self.showTooltip(absoluteTime, relativeTime, seriesHtml, pos); + self.showTooltip(absoluteTime, seriesHtml, pos); } // single series tooltip else if (item) { @@ -174,12 +172,11 @@ function ($) { value = series.formatValue(value); - relativeTime = dashboard.getRelativeTime(item.datapoint[0]); absoluteTime = dashboard.formatDate(item.datapoint[0], tooltipFormat); group += '
' + value + '
'; - self.showTooltip(absoluteTime, relativeTime, group, pos); + self.showTooltip(absoluteTime, group, pos); } // no hit else { diff --git a/public/sass/_variables.dark.scss b/public/sass/_variables.dark.scss index 18b2931373d..3a390e2f883 100644 --- a/public/sass/_variables.dark.scss +++ b/public/sass/_variables.dark.scss @@ -39,6 +39,7 @@ $brand-primary: $orange; $brand-success: $green; $brand-warning: $brand-primary; $brand-danger: $red; +$brand-text-highlight: #f7941d; // Status colors // ------------------------- @@ -242,8 +243,8 @@ $infoBackground: $blue-dark; // Tooltips and popovers // ------------------------- -$tooltipColor: $white; -$tooltipBackground: rgb(58, 57, 57); +$tooltipColor: $text-color; +$tooltipBackground: $dark-4; $tooltipArrowWidth: 5px; $tooltipArrowColor: $tooltipBackground; $tooltipLinkColor: $link-color; diff --git a/public/sass/_variables.light.scss b/public/sass/_variables.light.scss index 8fef6ae72eb..91b42c5c6be 100644 --- a/public/sass/_variables.light.scss +++ b/public/sass/_variables.light.scss @@ -44,6 +44,7 @@ $brand-primary: $orange; $brand-success: $green; $brand-warning: $orange; $brand-danger: $red; +$brand-text-highlight: #f7941d; // Status colors // ------------------------- diff --git a/public/sass/components/_panel_graph.scss b/public/sass/components/_panel_graph.scss index 9837f33a543..c8d68bbdd46 100644 --- a/public/sass/components/_panel_graph.scss +++ b/public/sass/components/_panel_graph.scss @@ -237,27 +237,28 @@ .graph-tooltip-time { text-align: center; - font-weight: $font-weight-semi-bold; position: relative; top: -3px; - } - - .tone-down { - opacity: 0.7; + padding: 0.2rem; } .graph-tooltip-list-item { display: table-row; + + &--highlight { + color: $brand-text-highlight; + } } .graph-tooltip-series-name { display: table-cell; + padding: 0.15rem; } .graph-tooltip-value { display: table-cell; font-weight: bold; - padding-left: 10px; + padding-left: 15px; text-align: right; } } diff --git a/public/sass/components/_tooltip.scss b/public/sass/components/_tooltip.scss index e70e1010bf1..6499d73c0d8 100644 --- a/public/sass/components/_tooltip.scss +++ b/public/sass/components/_tooltip.scss @@ -88,13 +88,6 @@ } } -.grafana-tooltip hr { - padding: 2px; - color: #c8c8c8; - margin: 0px; - border-bottom: 0px solid #c8c8c8; -} - .grafana-tip { padding-left: 5px; }