Commit 062fe720 by Torkel Ödegaard

More options can now be set on pre series basis, this is awesome!

parent cdcbb872
...@@ -187,6 +187,7 @@ function (angular, $, kbn, moment, _) { ...@@ -187,6 +187,7 @@ function (angular, $, kbn, moment, _) {
series.lines = {}; series.lines = {};
series.points = {}; series.points = {};
series.bars = {}; series.bars = {};
delete series.stack;
for (var i = 0; i < scope.panel.seriesOverrides.length; i++) { for (var i = 0; i < scope.panel.seriesOverrides.length; i++) {
var override = scope.panel.seriesOverrides[i]; var override = scope.panel.seriesOverrides[i];
...@@ -197,6 +198,10 @@ function (angular, $, kbn, moment, _) { ...@@ -197,6 +198,10 @@ function (angular, $, kbn, moment, _) {
if (override.points !== void 0) { series.points.show = override.points; } if (override.points !== void 0) { series.points.show = override.points; }
if (override.bars !== void 0) { series.bars.show = override.bars; } if (override.bars !== void 0) { series.bars.show = override.bars; }
if (override.fill !== void 0) { series.lines.fill = translateFillOption(override.fill); } if (override.fill !== void 0) { series.lines.fill = translateFillOption(override.fill); }
if (override.stack !== void 0) { series.stack = override.stack; }
if (override.linewidth !== void 0) { series.lines.lineWidth = override.linewidth; }
if (override.pointradius !== void 0) { series.points.radius = override.pointradius; }
if (override.steppedLine !== void 0) { series.lines.steps = override.steppedLine; }
} }
} }
......
...@@ -59,9 +59,12 @@ define([ ...@@ -59,9 +59,12 @@ define([
$scope.addOverrideOption('Bars', 'bars', [true, false]); $scope.addOverrideOption('Bars', 'bars', [true, false]);
$scope.addOverrideOption('Lines', 'lines', [true, false]); $scope.addOverrideOption('Lines', 'lines', [true, false]);
$scope.addOverrideOption('Points', 'points', [true, false]);
$scope.addOverrideOption('Line fill', 'fill', [0,1,2,3,4,5,6,7,8,9,10]); $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('Line width', 'linewidth', [0,1,2,3,4,5,6,7,8,9,10]);
$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]);
$scope.updateCurrentOverrides(); $scope.updateCurrentOverrides();
}); });
......
...@@ -109,6 +109,42 @@ define([ ...@@ -109,6 +109,42 @@ define([
}); });
}); });
graphScenario('series option overrides, linewidth, stack', function(ctx) {
ctx.setup(function(scope, data) {
scope.panel.lines = true;
scope.panel.stack = true;
scope.panel.linewidth = 2;
scope.panel.seriesOverrides = [
{ alias: 'test', linewidth: 5, stack: false }
];
data[1].info.alias = 'test';
});
it('should match second series and disable stack, and set lineWidth', function() {
expect(ctx.plotOptions.series.stack).to.be(true);
expect(ctx.plotData[1].stack).to.be(false);
expect(ctx.plotData[1].lines.lineWidth).to.be(5);
});
});
graphScenario('series option overrides, pointradius, steppedLine', function(ctx) {
ctx.setup(function(scope, data) {
scope.panel.seriesOverrides = [
{ alias: 'test', pointradius: 5, steppedLine: true }
];
data[1].info.alias = 'test';
});
it('should match second series and set pointradius, and set steppedLine', function() {
expect(ctx.plotData[1].points.radius).to.be(5);
expect(ctx.plotData[1].lines.steps).to.be(true);
});
});
}); });
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment