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

This commit is contained in:
Torkel Ödegaard 2015-06-12 20:06:47 +02:00
parent 48175101c6
commit 4a9bc70ca0
4 changed files with 17 additions and 1 deletions

View File

@ -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**

View File

@ -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;

View File

@ -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();
});

View File

@ -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]);
}