Sfoglia il codice sorgente

Added new style override, transform negative-Y, Closes #2162

Torkel Ödegaard 10 anni fa
parent
commit
4a9bc70ca0

+ 1 - 0
CHANGELOG.md

@@ -6,6 +6,7 @@
 - [Issue #1888](https://github.com/grafana/grafana/issues/1144). Templating: Repeat panel or row for each selected template variable value
 - [Issue #1888](https://github.com/grafana/grafana/issues/1944). Dashboard: Custom Navigation links & dynamic links to related dashboards
 - [Issue #590](https://github.com/grafana/grafana/issues/590).   Graph: Define series color using regex rule
+- [Issue #2162](https://github.com/grafana/grafana/issues/2162). Graph: New series style override, negative-y transform and stack groups
 - [Issue #2096](https://github.com/grafana/grafana/issues/2096). Dashboard list panel: Now supports search by multiple tags
 
 **User or Organization admin**

+ 1 - 0
public/app/components/timeSeries.js

@@ -54,6 +54,7 @@ function (_, kbn) {
       if (override.zindex !== void 0) { this.zindex = override.zindex; }
       if (override.fillBelowTo !== void 0) { this.fillBelowTo = override.fillBelowTo; }
       if (override.color !== void 0) { this.color = override.color; }
+      if (override.transform !== void 0) { this.transform = override.transform; }
 
       if (override.yaxis !== void 0) {
         this.yaxis = override.yaxis;

+ 2 - 1
public/app/panels/graph/seriesOverridesCtrl.js

@@ -99,10 +99,11 @@ define([
     $scope.addOverrideOption('Staircase line', 'steppedLine', [true, false]);
     $scope.addOverrideOption('Points', 'points', [true, false]);
     $scope.addOverrideOption('Points Radius', 'pointradius', [1,2,3,4,5]);
-    $scope.addOverrideOption('Stack', 'stack', [true, false, 2, 3, 4, 5]);
+    $scope.addOverrideOption('Stack', 'stack', [true, false, 'A', 'B', 'C', 'D']);
     $scope.addOverrideOption('Color', 'color', ['change']);
     $scope.addOverrideOption('Y-axis', 'yaxis', [1, 2]);
     $scope.addOverrideOption('Z-index', 'zindex', [-1,-2,-3,0,1,2,3]);
+    $scope.addOverrideOption('Transform', 'transform', ['negative-Y']);
     $scope.updateCurrentOverrides();
 
   });

+ 13 - 0
public/vendor/jquery/jquery.flot.js

@@ -1226,6 +1226,19 @@ Licensed under the MIT license.
             // give the hooks a chance to run
             for (i = 0; i < series.length; ++i) {
                 s = series[i];
+                points = s.datapoints.points;
+                ps = s.datapoints.pointsize;
+
+                // grafana
+                if (s.transform === 'negative-Y') {
+                  for (j = 0; j < points.length; j += ps) {
+                    if (points[j] == null)
+                        continue;
+
+                      val = points[j + 1];
+                      points[j + 1] = -val;
+                  }
+                }
 
                 executeHooks(hooks.processDatapoints, [ s, s.datapoints]);
             }