Let plotly calculate the height based on provided margin values

This commit is contained in:
Kumar Vora
2016-05-09 16:11:51 -05:00
parent 303e158eb1
commit d2ba0cb6cf

View File

@@ -121,7 +121,6 @@
angular.module('plotly', [])
.constant('ColorPalette', ColorPalette)
.directive('plotlyChart', function () {
var baseHeight = 250;
var bottomMargin = 50;
return {
restrict: 'E',
@@ -165,7 +164,6 @@
scope.layout.showlegend = _.has(scope.options, 'legend') ? scope.options.legend.enabled : true;
if(_.has(scope.options, 'bottomMargin')) {
bottomMargin = parseInt(scope.options.bottomMargin);
scope.layout.height = baseHeight + bottomMargin;
scope.layout.margin.b = bottomMargin;
}
delete scope.layout.barmode;
@@ -289,7 +287,7 @@
scope.$watch('options', recalculateOptions, true);
scope.layout = {margin: {l: 50, r: 50, b: bottomMargin, t: 20, pad: 4}, height: baseHeight+bottomMargin, autosize: true, hovermode: 'closest'};
scope.layout = {margin: {l: 50, r: 50, b: bottomMargin, t: 20, pad: 4}, autosize: true, hovermode: 'closest'};
scope.plotlyOptions = {showLink: false, displaylogo: false};
scope.data = [];