Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 27 additions & 5 deletions components/dash-core-components/src/fragments/Graph.react.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ import {
import PropTypes from 'prop-types';
import {graphPropTypes, graphDefaultProps} from '../components/Graph.react';

import LoadingElement from '../utils/LoadingElement';

/* global Plotly:true */

import ResizeDetector from '../utils/ResizeDetector';
import LoadingElement from '../utils/LoadingElement';

/**
* `autosize: true` causes Plotly.js to conform to the parent element size.
Expand Down Expand Up @@ -537,23 +536,46 @@ class PlotlyGraph extends Component {
}

render() {
const {className, id} = this.props;
const {className, id, loading_state} = this.props;
const style = this.getStyle();

if (window.dash_component_api) {
return (
<LoadingElement
id={id}
key={id}
className={className}
style={style}
ref={this.parentElement}
>
<ResizeDetector
onResize={this.graphResize}
targets={[this.parentElement, this.gd]}
/>
<div
ref={this.gd}
style={{height: '100%', width: '100%'}}
/>
</LoadingElement>
);
}
return (
<LoadingElement
<div
id={id}
key={id}
className={className}
style={style}
ref={this.parentElement}
data-dash-is-loading={
(loading_state && loading_state.is_loading) || undefined
}
>
<ResizeDetector
onResize={this.graphResize}
targets={[this.parentElement, this.gd]}
/>
<div ref={this.gd} style={{height: '100%', width: '100%'}} />
</LoadingElement>
</div>
);
}
}
Expand Down