diff --git a/src/app/components/timeSeries.js b/src/app/components/timeSeries.js index 95a4d3ded34..c64b5931e7f 100644 --- a/src/app/components/timeSeries.js +++ b/src/app/components/timeSeries.js @@ -9,7 +9,6 @@ function (_, kbn) { this.datapoints = opts.datapoints; this.info = opts.info; this.label = opts.info.alias; - this.zindex = 0; } function matchSeriesOverride(aliasOrRegex, seriesAlias) { @@ -31,6 +30,7 @@ function (_, kbn) { this.points = {}; this.bars = {}; this.info.yaxis = 1; + this.zindex = 0; delete this.stack; for (var i = 0; i < overrides.length; i++) { diff --git a/src/app/directives/grafanaGraph.js b/src/app/directives/grafanaGraph.js index 6148c6d2bc4..38ef36bc912 100755 --- a/src/app/directives/grafanaGraph.js +++ b/src/app/directives/grafanaGraph.js @@ -168,19 +168,19 @@ function (angular, $, kbn, moment, _) { addAnnotations(options); configureAxisOptions(data, options); - data = _.sortBy(data, function(series) { return series.zindex; }); + var sortedSeries = _.sortBy(data, function(series) { return series.zindex; }); // if legend is to the right delay plot draw a few milliseconds // so the legend width calculation can be done if (shouldDelayDraw(panel)) { legendSideLastValue = panel.legend.rightSide; setTimeout(function() { - plot = $.plot(elem, data, options); + plot = $.plot(elem, sortedSeries, options); addAxisLabels(); }, 50); } else { - plot = $.plot(elem, data, options); + plot = $.plot(elem, sortedSeries, options); addAxisLabels(); } } diff --git a/src/app/panels/graph/styleEditor.html b/src/app/panels/graph/styleEditor.html index 5a50f4995d0..ec4f59b50b4 100644 --- a/src/app/panels/graph/styleEditor.html +++ b/src/app/panels/graph/styleEditor.html @@ -66,16 +66,14 @@
Series specific overrides Regex match example: /server[0-3]/i
- +
@@ -90,9 +88,7 @@ class="input-medium grafana-target-segment-input" >
  • - - - + {{option.name}}: {{option.value}}
  • +
    diff --git a/src/test/specs/grafanaGraph-specs.js b/src/test/specs/grafanaGraph-specs.js index 449d8db4c39..5f3ad0dd413 100644 --- a/src/test/specs/grafanaGraph-specs.js +++ b/src/test/specs/grafanaGraph-specs.js @@ -92,8 +92,8 @@ define([ }); graphScenario('should order series order according to zindex', function(ctx) { - ctx.setup(function(scope, data) { - data[0].zindex = 2; + ctx.setup(function(scope) { + scope.panel.seriesOverrides = [{ alias: 'series1', zindex: 2 }]; }); it('should move zindex 2 last', function() { diff --git a/src/test/specs/timeSeries-specs.js b/src/test/specs/timeSeries-specs.js index f5fa980c491..cf28c1aa450 100644 --- a/src/test/specs/timeSeries-specs.js +++ b/src/test/specs/timeSeries-specs.js @@ -101,8 +101,8 @@ define([ it('should set yaxis', function() { expect(series.info.yaxis).to.be(2); - }); + it('should set zindex', function() { expect(series.zindex).to.be(2); });