From aa87d8eb228257a9c9308406396bd9eeb855ac69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Fri, 7 Nov 2014 14:20:58 +0100 Subject: [PATCH] Graph: changed style of legend table mode to full width table and with headers, #1030 --- src/app/panels/graph/axisEditor.html | 1 - src/app/panels/graph/legend.js | 15 +++--- src/css/less/graph.less | 74 +++++++++++----------------- 3 files changed, 36 insertions(+), 54 deletions(-) diff --git a/src/app/panels/graph/axisEditor.html b/src/app/panels/graph/axisEditor.html index 6470c12ed89..1c25fb26aab 100644 --- a/src/app/panels/graph/axisEditor.html +++ b/src/app/panels/graph/axisEditor.html @@ -43,7 +43,6 @@ - diff --git a/src/app/panels/graph/legend.js b/src/app/panels/graph/legend.js index 9a8b8e37a7e..c01548afd9d 100644 --- a/src/app/panels/graph/legend.js +++ b/src/app/panels/graph/legend.js @@ -65,16 +65,17 @@ function (angular, app, _, kbn, $) { $container.toggleClass('graph-legend-table', panel.legend.alignAsTable); - if (panel.legend.bigTableMode) { - $container.toggleClass('graph-legend-big-table', true); + if (panel.legend.alignAsTable) { var header = ''; header += ''; header += ''; - header += 'min'; - header += 'max'; - header += 'avg'; - header += 'current'; - header += 'total'; + if (panel.legend.values) { + if (panel.legend.min) { header += 'min'; } + if (panel.legend.max) { header += 'max'; } + if (panel.legend.avg) { header += 'avg'; } + if (panel.legend.current) { header += 'current'; } + if (panel.legend.total) { header += 'total'; } + } header += ''; $container.append($(header)); } diff --git a/src/css/less/graph.less b/src/css/less/graph.less index bfcf2acf25c..438cb5d2379 100644 --- a/src/css/less/graph.less +++ b/src/css/less/graph.less @@ -53,6 +53,8 @@ .graph-legend-table { display: table; + width: 100%; + margin: 0; .graph-legend-series { display: table-row; @@ -63,73 +65,53 @@ } } - .graph-legend-alias { - float: none; - display: table-cell; - white-space: nowrap; - } - - .graph-legend-icon { - display: table-cell; - float: none; - white-space: nowrap; - padding: 0 4px; - top: 2px; - } - - .graph-legend-value { - float: none; - display: table-cell; - white-space: nowrap; - padding-left: 15px; - } -} - -.graph-legend-big-table { - width: 100%; - margin: 0; - td, .graph-legend-alias, .graph-legend-icon, .graph-legend-value { - padding: 2px 10px; + float: none; + display: table-cell; white-space: nowrap; + padding: 2px 10px; text-align: right; border-bottom: 1px solid @grafanaListBorderBottom; - - &:first-child { - text-align: left; - } - &:last-child td { - border: none; - } } .graph-legend-icon { width: 5px; - padding-right: 0; + padding: 0; + top: 0; + .icon-minus { + position: relative; + top: 2px; + } + } + + .graph-legend-value { + padding-left: 15px; } .graph-legend-alias { + padding-left: 7px; text-align: left; width: 95%; } + .graph-legend-series:nth-child(odd) { + background-color: @grafanaListAccent; + } + + .graph-legend-value { + &.current, &.max, &.min, &.total, &.avg { + &:before { + content: ''; + } + } + } + th { text-align: right; padding: 5px 10px; font-weight: bold; color: @blue } - - .graph-legend-series:nth-child(odd) { - background-color: @grafanaListAccent; - } - .graph-legend-value { - &.current, &.max, &.min, &.total, &.avg { - &:before { - content: ''; - } - } - } } .graph-legend-rightside {