diff --git a/superset/assets/javascripts/explore/components/ChartContainer.jsx b/superset/assets/javascripts/explore/components/ChartContainer.jsx index fb0a342840337..ab2be2fcdf24c 100644 --- a/superset/assets/javascripts/explore/components/ChartContainer.jsx +++ b/superset/assets/javascripts/explore/components/ChartContainer.jsx @@ -32,6 +32,7 @@ const propTypes = { column_formats: PropTypes.object, containerId: PropTypes.string.isRequired, height: PropTypes.string.isRequired, + width: PropTypes.string.isRequired, isStarred: PropTypes.bool.isRequired, slice: PropTypes.object, table_name: PropTypes.string, @@ -60,6 +61,7 @@ class ChartContainer extends React.PureComponent { ( prevProps.queryResponse !== this.props.queryResponse || prevProps.height !== this.props.height || + prevProps.width !== this.props.width || this.props.triggerRender ) && !this.props.queryResponse.error && this.props.chartStatus !== 'failed' diff --git a/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx b/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx index f015aa99b6a09..706459e4b4f66 100644 --- a/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx +++ b/superset/assets/javascripts/explore/components/ExploreViewContainer.jsx @@ -28,6 +28,7 @@ class ExploreViewContainer extends React.Component { super(props); this.state = { height: this.getHeight(), + width: this.getWidth(), showModal: false, }; } @@ -75,6 +76,10 @@ class ExploreViewContainer extends React.Component { this.props.actions.chartUpdateStopped(this.props.queryRequest); } + getWidth() { + return `${window.innerWidth}px`; + } + getHeight() { if (this.props.forcedHeight) { return this.props.forcedHeight + 'px'; @@ -93,7 +98,7 @@ class ExploreViewContainer extends React.Component { handleResize() { clearTimeout(this.resizeTimer); this.resizeTimer = setTimeout(() => { - this.setState({ height: this.getHeight() }); + this.setState({ height: this.getHeight(), width: this.getWidth() }); }, 250); } @@ -131,6 +136,7 @@ class ExploreViewContainer extends React.Component { return ( ); }