Skip to content

Commit

Permalink
Graph: New series style override option 'Fill below to', useful to vi…
Browse files Browse the repository at this point in the history
…sualize max & min as shadow for the mean, #940
  • Loading branch information
torkelo committed Oct 15, 2014
1 parent 1330488 commit 22db28d
Show file tree
Hide file tree
Showing 9 changed files with 314 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
**UI Improvements*
- [Issue #770](https://github.com/grafana/grafana/issues/770). UI: Panel dropdown menu replaced with a new panel menu

**Misc**
**Graph**
- [Issue #877](https://github.com/grafana/grafana/issues/877). Graph: Smart auto decimal precision when using scaled unit formats
- [Issue #850](https://github.com/grafana/grafana/issues/850). Graph: Shared tooltip that shows multiple series & crosshair line, thx @toni-moreno
- [Issue #940](https://github.com/grafana/grafana/issues/940). Graph: New series style override option "Fill below to", useful to visualize max & min as a shadow for the mean

**Misc**
- [Issue #938](https://github.com/grafana/grafana/issues/938). Panel: Plugin panels now reside outside of app/panels directory

**Fixes**
Expand Down
2 changes: 2 additions & 0 deletions src/app/components/require.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ require.config({
'jquery.flot.stackpercent':'../vendor/jquery/jquery.flot.stackpercent',
'jquery.flot.time': '../vendor/jquery/jquery.flot.time',
'jquery.flot.crosshair': '../vendor/jquery/jquery.flot.crosshair',
'jquery.flot.fillbelow': '../vendor/jquery/jquery.flot.fillbelow',

modernizr: '../vendor/modernizr-2.6.1',

Expand Down Expand Up @@ -83,6 +84,7 @@ require.config({
'jquery.flot.stackpercent':['jquery', 'jquery.flot'],
'jquery.flot.time': ['jquery', 'jquery.flot'],
'jquery.flot.crosshair':['jquery', 'jquery.flot'],
'jquery.flot.fillbelow':['jquery', 'jquery.flot'],
'angular-cookies': ['angular'],
'angular-dragdrop': ['jquery', 'angular'],
'angular-loader': ['angular'],
Expand Down
3 changes: 3 additions & 0 deletions src/app/components/timeSeries.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ function (_, kbn) {
this.datapoints = opts.datapoints;
this.info = opts.info;
this.label = opts.info.alias;
this.id = opts.info.alias;
this.valueFormater = kbn.valueFormats.none;
this.stats = {};
}
Expand Down Expand Up @@ -50,6 +51,8 @@ function (_, kbn) {
if (override.pointradius !== void 0) { this.points.radius = override.pointradius; }
if (override.steppedLine !== void 0) { this.lines.steps = override.steppedLine; }
if (override.zindex !== void 0) { this.zindex = override.zindex; }
if (override.fillBelowTo !== void 0) { this.fillBelowTo = override.fillBelowTo; }

if (override.yaxis !== void 0) {
this.info.yaxis = override.yaxis;
}
Expand Down
1 change: 1 addition & 0 deletions src/app/directives/grafanaGraph.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ function (angular, $, kbn, moment, _, GraphTooltip) {
var series = data[i];
series.applySeriesOverrides(panel.seriesOverrides);
series.data = series.getFlotPairs(panel.nullPointMode, panel.y_formats);

// if hidden remove points and disable stack
if (scope.hiddenSeries[series.info.alias]) {
series.data = [];
Expand Down
1 change: 1 addition & 0 deletions src/app/panels/graph/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ define([
'jquery.flot.time',
'jquery.flot.stack',
'jquery.flot.stackpercent',
'jquery.flot.fillbelow',
'jquery.flot.crosshair'
],
function (angular, app, $, _, kbn, moment, TimeSeries) {
Expand Down
1 change: 1 addition & 0 deletions src/app/panels/graph/seriesOverridesCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ define([
$scope.addOverrideOption('Lines', 'lines', [true, false]);
$scope.addOverrideOption('Line fill', 'fill', [0,1,2,3,4,5,6,7,8,9,10]);
$scope.addOverrideOption('Line width', 'linewidth', [0,1,2,3,4,5,6,7,8,9,10]);
$scope.addOverrideOption('Fill below to', 'fillBelowTo', $scope.getSeriesNames());
$scope.addOverrideOption('Staircase line', 'steppedLine', [true, false]);
$scope.addOverrideOption('Points', 'points', [true, false]);
$scope.addOverrideOption('Points Radius', 'pointradius', [1,2,3,4,5]);
Expand Down
11 changes: 11 additions & 0 deletions src/test/specs/timeSeries-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ define([
});
});

describe('series option overrides, fill below to', function() {
beforeEach(function() {
series.info.alias = 'test';
series.applySeriesOverrides([{ alias: 'test', fillBelowTo: 'min' }]);
});

it('should disable line fill and add fillBelowTo', function() {
expect(series.fillBelowTo).to.be('min');
});
});

describe('series option overrides, pointradius, steppedLine', function() {
beforeEach(function() {
series.info.alias = 'test';
Expand Down
3 changes: 2 additions & 1 deletion src/test/test-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ require.config({
'jquery.flot.stackpercent':'../vendor/jquery/jquery.flot.stackpercent',
'jquery.flot.time': '../vendor/jquery/jquery.flot.time',
'jquery.flot.crosshair': '../vendor/jquery/jquery.flot.crosshair',
'jquery.flot.fillbelow': '../vendor/jquery/jquery.flot.fillbelow',

modernizr: '../vendor/modernizr-2.6.1',
},
Expand All @@ -68,7 +69,6 @@ require.config({
exports: 'Crypto'
},

'jquery-ui': ['jquery'],
'jquery.flot': ['jquery'],
'jquery.flot.pie': ['jquery', 'jquery.flot'],
'jquery.flot.events': ['jquery', 'jquery.flot'],
Expand All @@ -77,6 +77,7 @@ require.config({
'jquery.flot.stackpercent':['jquery', 'jquery.flot'],
'jquery.flot.time': ['jquery', 'jquery.flot'],
'jquery.flot.crosshair':['jquery', 'jquery.flot'],
'jquery.flot.fillbelow':['jquery', 'jquery.flot'],

'angular-route': ['angular'],
'angular-cookies': ['angular'],
Expand Down
Loading

0 comments on commit 22db28d

Please sign in to comment.