mirror of
https://github.com/getredash/redash.git
synced 2025-12-19 17:37:19 -05:00
Let plotly calculate the height based on provided margin values
This commit is contained in:
@@ -121,7 +121,6 @@
|
|||||||
angular.module('plotly', [])
|
angular.module('plotly', [])
|
||||||
.constant('ColorPalette', ColorPalette)
|
.constant('ColorPalette', ColorPalette)
|
||||||
.directive('plotlyChart', function () {
|
.directive('plotlyChart', function () {
|
||||||
var baseHeight = 250;
|
|
||||||
var bottomMargin = 50;
|
var bottomMargin = 50;
|
||||||
return {
|
return {
|
||||||
restrict: 'E',
|
restrict: 'E',
|
||||||
@@ -165,7 +164,6 @@
|
|||||||
scope.layout.showlegend = _.has(scope.options, 'legend') ? scope.options.legend.enabled : true;
|
scope.layout.showlegend = _.has(scope.options, 'legend') ? scope.options.legend.enabled : true;
|
||||||
if(_.has(scope.options, 'bottomMargin')) {
|
if(_.has(scope.options, 'bottomMargin')) {
|
||||||
bottomMargin = parseInt(scope.options.bottomMargin);
|
bottomMargin = parseInt(scope.options.bottomMargin);
|
||||||
scope.layout.height = baseHeight + bottomMargin;
|
|
||||||
scope.layout.margin.b = bottomMargin;
|
scope.layout.margin.b = bottomMargin;
|
||||||
}
|
}
|
||||||
delete scope.layout.barmode;
|
delete scope.layout.barmode;
|
||||||
@@ -289,7 +287,7 @@
|
|||||||
scope.$watch('options', recalculateOptions, true);
|
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.plotlyOptions = {showLink: false, displaylogo: false};
|
||||||
scope.data = [];
|
scope.data = [];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user