Skip to content

Commit 3e0b592

Browse files
Start working on the responsive height of the Graph component
1 parent 0f1b299 commit 3e0b592

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

components/dash-core-components/src/fragments/Graph.react.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,24 @@ class PlotlyGraph extends Component {
374374
});
375375
}
376376

377+
getStyle() {
378+
let {style, responsive} = this.props;
379+
380+
if (!responsive) {
381+
return style;
382+
}
383+
384+
if (!style) {
385+
style = {};
386+
}
387+
388+
if (!style.height) {
389+
style.height = '100%';
390+
}
391+
392+
return style;
393+
}
394+
377395
componentDidMount() {
378396
this.plot(this.props);
379397
if (this.props.prependData) {
@@ -447,7 +465,8 @@ class PlotlyGraph extends Component {
447465
}
448466

449467
render() {
450-
const {className, id, style, loading_state} = this.props;
468+
const {className, id, loading_state} = this.props;
469+
const style = this.getStyle();
451470

452471
return (
453472
<div

0 commit comments

Comments
 (0)