@@ -9,6 +9,14 @@ class PlotlyEditor extends Component {
99 super ( ) ;
1010 this . state = { graphDiv : { } } ;
1111 this . PlotComponent = createPlotComponent ( props . plotly ) ;
12+ this . handleDirectUpdate = this . handleDirectUpdate . bind ( this ) ;
13+ }
14+
15+ handleDirectUpdate ( fig , graphDiv ) {
16+ this . setState ( { graphDiv} ) ;
17+ if ( this . props . onDirectUpdate ) {
18+ this . props . onDirectUpdate ( graphDiv . data , graphDiv . layout , graphDiv . _transitionData . _frames ) ;
19+ }
1220 }
1321
1422 render ( ) {
@@ -44,8 +52,8 @@ class PlotlyEditor extends Component {
4452 config = { this . props . config }
4553 useResizeHandler = { this . props . useResizeHandler }
4654 debug = { this . props . debug }
47- onInitialized = { ( fig , graphDiv ) => this . setState ( { graphDiv } ) }
48- onUpdate = { ( fig , graphDiv ) => this . setState ( { graphDiv } ) }
55+ onInitialized = { this . handleDirectUpdate }
56+ onUpdate = { this . handleDirectUpdate }
4957 style = { { width : '100%' , height : '100%' } }
5058 divId = { this . props . divId }
5159 />
@@ -64,6 +72,7 @@ PlotlyEditor.propTypes = {
6472 dataSources : PropTypes . object ,
6573 frames : PropTypes . array ,
6674 onUpdate : PropTypes . func ,
75+ onDirectUpdate : PropTypes . func ,
6776 plotly : PropTypes . object ,
6877 useResizeHandler : PropTypes . bool ,
6978 debug : PropTypes . bool ,
0 commit comments