diff --git a/src/app/panels/graph/timeSeries.js b/src/app/components/timeSeries.js similarity index 92% rename from src/app/panels/graph/timeSeries.js rename to src/app/components/timeSeries.js index f1794cd6a30..8858b01a139 100644 --- a/src/app/panels/graph/timeSeries.js +++ b/src/app/components/timeSeries.js @@ -5,15 +5,13 @@ define([ function (_, kbn) { 'use strict'; - var ts = {}; - - ts.ZeroFilled = function (opts) { + function TimeSeries(opts) { this.datapoints = opts.datapoints; this.info = opts.info; this.label = opts.info.alias; - }; + } - ts.ZeroFilled.prototype.getFlotPairs = function (fillStyle, yFormats) { + TimeSeries.prototype.getFlotPairs = function (fillStyle, yFormats) { var result = []; this.color = this.info.color; @@ -74,5 +72,6 @@ function (_, kbn) { return result; }; - return ts; -}); \ No newline at end of file + return TimeSeries; + +}); diff --git a/src/app/directives/grafanaGraph.js b/src/app/directives/grafanaGraph.js index c2be3d90d13..21d47bcdf63 100755 --- a/src/app/directives/grafanaGraph.js +++ b/src/app/directives/grafanaGraph.js @@ -154,10 +154,9 @@ function (angular, $, kbn, moment, _) { }; for (var i = 0; i < data.length; i++) { - var _d = data[i].getFlotPairs(panel.nullPointMode, panel.y_formats); - data[i].data = _d; - data[0].lines = { show: false, dashes: true }; - data[0].bars = { show: true }; + var series = data[i]; + series.data = series.getFlotPairs(panel.nullPointMode, panel.y_formats); + applySeriesOverrideOptions(series); } if (data.length && data[0].info.timeStep) { @@ -184,6 +183,19 @@ function (angular, $, kbn, moment, _) { } } + function applySeriesOverrideOptions(series) { + for (var i = 0; i < scope.panel.seriesOverrides.length; i++) { + var override = scope.panel.seriesOverrides[i]; + if (override.alias === series.info.alias) { + if (!_.isUndefined(override.fill)) { + series.lines = { + fill: override.fill === 0 ? 0.001 : override.fill/10 + }; + } + } + } + } + function shouldDelayDraw(panel) { if (panel.legend.rightSide) { return true; diff --git a/src/app/panels/graph/module.js b/src/app/panels/graph/module.js index 557503023a1..9d2253b0147 100644 --- a/src/app/panels/graph/module.js +++ b/src/app/panels/graph/module.js @@ -5,7 +5,7 @@ define([ 'lodash', 'kbn', 'moment', - './timeSeries', + 'components/timeSeries', './seriesOverridesCtrl', 'services/panelSrv', 'services/annotationsSrv', @@ -17,7 +17,7 @@ define([ 'jquery.flot.stack', 'jquery.flot.stackpercent' ], -function (angular, app, $, _, kbn, moment, timeSeries) { +function (angular, app, $, _, kbn, moment, TimeSeries) { 'use strict'; var module = angular.module('grafana.panels.graph'); @@ -258,7 +258,7 @@ function (angular, app, $, _, kbn, moment, timeSeries) { $scope.legend.push(seriesInfo); - var series = new timeSeries.ZeroFilled({ + var series = new TimeSeries({ datapoints: datapoints, info: seriesInfo, }); diff --git a/src/app/panels/graph/seriesOverridesCtrl.js b/src/app/panels/graph/seriesOverridesCtrl.js index 2123510400b..ed2e27fdf7c 100644 --- a/src/app/panels/graph/seriesOverridesCtrl.js +++ b/src/app/panels/graph/seriesOverridesCtrl.js @@ -35,6 +35,7 @@ define([ var value = option.values[valueIndex]; $scope.override[option.propertyName] = value; $scope.updateCurrentOverrides(); + $scope.render(); }; $scope.removeOverride = function(option) { diff --git a/src/app/panels/graph/styleEditor.html b/src/app/panels/graph/styleEditor.html index c436ba10ceb..9b0d2b4fbba 100644 --- a/src/app/panels/graph/styleEditor.html +++ b/src/app/panels/graph/styleEditor.html @@ -84,7 +84,7 @@ alias or regex