Merge pull request #1087 from getredash/fix/chart_editor

Maintain fixed size of chart area
This commit is contained in:
Arik Fraimovich
2016-05-31 11:29:37 +03:00

View File

@@ -159,6 +159,11 @@
return ColorPaletteArray[index % ColorPaletteArray.length];
};
var calculateHeight = function() {
var height = Math.max(scope.height, (scope.height - 50) + bottomMargin);
return height;
}
var recalculateOptions = function() {
scope.data.length = 0;
scope.layout.showlegend = _.has(scope.options, 'legend') ? scope.options.legend.enabled : true;
@@ -281,13 +286,15 @@
percentBarStacking(scope.data);
}
}
scope.layout.margin.b = bottomMargin;
scope.layout.height = calculateHeight();
};
scope.$watch('series', recalculateOptions);
scope.$watch('options', recalculateOptions, true);
scope.layout = {margin: {l: 50, r: 50, b: bottomMargin, t: 20, pad: 4}, autosize: true, hovermode: 'closest'};
scope.layout = {margin: {l: 50, r: 50, b: bottomMargin, t: 20, pad: 4}, height: calculateHeight(), autosize: true, hovermode: 'closest'};
scope.plotlyOptions = {showLink: false, displaylogo: false};
scope.data = [];