Allow increasing the space between legend entries

This is achieved by allowing the attributes `horizontalPadding` and
`verticalPadding` to be overridden.
master
Guilherme Simoes 2015-03-04 12:34:59 +00:00
parent c1a884e327
commit 6ee4453a2d
3 changed files with 26 additions and 2 deletions

View File

@ -68,8 +68,8 @@
// Expand the bounds of the largest shape slightly. This will be the size allocated to
// all elements
maxHeight = (maxHeight < keyHeight ? keyHeight : maxHeight) + 2;
maxWidth += keyWidth + 20;
maxHeight = (maxHeight < keyHeight ? keyHeight : maxHeight) + self._getVerticalPadding();
maxWidth += keyWidth + self._getHorizontalPadding();
// Iterate the shapes and position them based on the alignment and size of the legend
theseShapes

View File

@ -0,0 +1,12 @@
// Copyright: 2015 PMSI-AlignAlytics
// License: "https://github.com/PMSI-AlignAlytics/dimple/blob/master/MIT-LICENSE.txt"
// Source: /src/objects/legend/methods/_getHorizontalPadding.js
this._getHorizontalPadding = function () {
var horizontalPadding;
if (isNaN(this.horizontalPadding)) {
horizontalPadding = 20;
} else {
horizontalPadding = this.horizontalPadding;
}
return horizontalPadding;
};

View File

@ -0,0 +1,12 @@
// Copyright: 2015 PMSI-AlignAlytics
// License: "https://github.com/PMSI-AlignAlytics/dimple/blob/master/MIT-LICENSE.txt"
// Source: /src/objects/legend/methods/_getVerticalPadding.js
this._getVerticalPadding = function () {
var verticalPadding;
if (isNaN(this.verticalPadding)) {
verticalPadding = 2;
} else {
verticalPadding = this.verticalPadding;
}
return verticalPadding;
};