mirror of
https://github.com/getredash/redash.git
synced 2025-12-25 01:03:20 -05:00
Merge pull request #1087 from getredash/fix/chart_editor
Maintain fixed size of chart area
This commit is contained in:
@@ -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 = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user