Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 601b386

Browse files
Add frames to Graph
1 parent 442fe91 commit 601b386

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/components/Graph.react.js

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,18 @@ class PlotlyGraph extends Component {
9898
) {
9999
return Plotly.animate(id, figure, animation_options);
100100
}
101-
return Plotly.react(id, figure.data, clone(figure.layout), config).then(
102-
() => {
103-
if (!this._hasPlotted) {
104-
this.bindEvents();
105-
Plotly.Plots.resize(document.getElementById(id));
106-
this._hasPlotted = true;
107-
}
101+
return Plotly.react(id, {
102+
data: figure.data,
103+
layout: clone(figure.layout),
104+
frames: figure.frames,
105+
config: config,
106+
}).then(() => {
107+
if (!this._hasPlotted) {
108+
this.bindEvents();
109+
Plotly.Plots.resize(document.getElementById(id));
110+
this._hasPlotted = true;
108111
}
109-
);
112+
});
110113
}
111114

112115
extend(props) {
@@ -322,12 +325,12 @@ const graphPropTypes = {
322325
* Plotly `figure` object. See schema:
323326
* https://plot.ly/javascript/reference
324327
* Only supports `data` array and `layout` object.
325-
* `config` is set separately by the `config` property,
326-
* and `frames` is not supported.
328+
* `config` is set separately by the `config` property
327329
*/
328330
figure: PropTypes.exact({
329331
data: PropTypes.arrayOf(PropTypes.object),
330332
layout: PropTypes.object,
333+
frames: PropTypes.arrayOf(PropTypes.object),
331334
}),
332335

333336
/**
@@ -622,7 +625,7 @@ const graphDefaultProps = {
622625
relayoutData: null,
623626
extendData: null,
624627
restyleData: null,
625-
figure: {data: [], layout: {}},
628+
figure: {data: [], layout: {}, frames: []},
626629
animate: false,
627630
animation_options: {
628631
frame: {

0 commit comments

Comments
 (0)