From 433af083717a47d80ad69b8c30f61c4e0440d02e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torkel=20=C3=96degaard?= Date: Sat, 28 Dec 2013 17:51:20 +0100 Subject: [PATCH] fixed persistance of alias color changes --- src/app/panels/graphite/funcEditor.html | 1 - src/app/panels/graphite/legend.html | 32 ++++++++++++++++++++++++ src/app/panels/graphite/module.html | 19 ++------------ src/app/panels/graphite/module.js | 21 +++++++++------- src/app/panels/graphite/seriesColor.html | 8 ------ 5 files changed, 46 insertions(+), 35 deletions(-) create mode 100644 src/app/panels/graphite/legend.html delete mode 100644 src/app/panels/graphite/seriesColor.html diff --git a/src/app/panels/graphite/funcEditor.html b/src/app/panels/graphite/funcEditor.html index d73ce7a6a1d..5ed79505dbf 100644 --- a/src/app/panels/graphite/funcEditor.html +++ b/src/app/panels/graphite/funcEditor.html @@ -10,7 +10,6 @@    × -
diff --git a/src/app/panels/graphite/legend.html b/src/app/panels/graphite/legend.html new file mode 100644 index 00000000000..8d8ceac64ba --- /dev/null +++ b/src/app/panels/graphite/legend.html @@ -0,0 +1,32 @@ + + + + + + {{series.alias}} + + + + + diff --git a/src/app/panels/graphite/module.html b/src/app/panels/graphite/module.html index 5c10dda9a53..6a241fc562a 100644 --- a/src/app/panels/graphite/module.html +++ b/src/app/panels/graphite/module.html @@ -50,23 +50,8 @@
-
- - - - - - {{series.alias}} - - - +
+
diff --git a/src/app/panels/graphite/module.js b/src/app/panels/graphite/module.js index e22fa9ec39e..75374028059 100644 --- a/src/app/panels/graphite/module.js +++ b/src/app/panels/graphite/module.js @@ -193,14 +193,15 @@ function (angular, app, $, _, kbn, moment, timeSeries) { * zerofill:: Improves the accuracy of line charts at a small performance cost. */ zerofill : true, - /** @scratch /panels/histogram/3 - * derivative:: Show each point on the x-axis as the change from the previous point - */ + tooltip : { value_type: 'cumulative', query_as_alias: true }, - targets: [] + + targets: [], + + aliasColors: {} }; _.defaults($scope.panel,_d); @@ -217,7 +218,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) { $scope.editor = {index: 1}; $scope.editorTabs = _.union(['General'],_.pluck($scope.panelMeta.fullEditorTabs,'title')); $scope.hiddenSeries = {}; - $scope.aliasToColor = {}; // Always show the query if an alias isn't set. Users can set an alias if the query is too // long $scope.panel.tooltip.query_as_alias = true; @@ -335,9 +335,6 @@ function (angular, app, $, _, kbn, moment, timeSeries) { throw { message: 'no data in response from graphite' }; } - //console.log('Data from graphite:', results); - //console.log('nr datapoints from graphite: %d', results[0].datapoints.length); - var tsOpts = { interval: interval, start_date: range && range.from, @@ -356,7 +353,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) { var target = graphiteSrv.match($scope.panel.targets, targetData.target); var alias = targetData.target; - var color = $scope.aliasToColor[alias] || $scope.colors[data.length]; + var color = $scope.panel.aliasColors[alias] || $scope.colors[data.length]; var seriesInfo = { alias: alias, @@ -438,6 +435,12 @@ function (angular, app, $, _, kbn, moment, timeSeries) { $scope.$emit('render'); }; + $scope.changeSeriesColor = function(series, color) { + series.color = color; + $scope.panel.aliasColors[series.alias] = series.color; + $scope.render(); + } + $scope.toggleFullscreen = function(evt) { if ($scope.showFullscreen) { $rootScope.$emit('panel-fullscreen-exit'); diff --git a/src/app/panels/graphite/seriesColor.html b/src/app/panels/graphite/seriesColor.html deleted file mode 100644 index 3220c139178..00000000000 --- a/src/app/panels/graphite/seriesColor.html +++ /dev/null @@ -1,8 +0,0 @@ -
- - -
\ No newline at end of file