@@ -73,60 +73,79 @@ class PlotlyChart extends React.Component<IPlotlyChartProps, any> {
7373 // this.container!.on('plotly_buttonclicked', this.props.onButtonClicked);
7474 // }
7575 if ( this . props . onClick ) {
76+ this . container ! . removeAllListeners ( "plotly_click" ) ;
7677 this . container ! . on ( 'plotly_click' , this . props . onClick ) ;
7778 }
7879 if ( this . props . onClickAnnotation ) {
80+ this . container ! . removeAllListeners ( "plotly_clickannotation" ) ;
7981 this . container ! . on ( 'plotly_clickannotation' , this . props . onClickAnnotation ) ;
8082 }
8183 if ( this . props . onDeselect ) {
84+ this . container ! . removeAllListeners ( "plotly_deselect" ) ;
8285 this . container ! . on ( 'plotly_deselect' , this . props . onDeselect ) ;
8386 }
8487 if ( this . props . onDoubleClick ) {
88+ this . container ! . removeAllListeners ( "plotly_doubleclick" ) ;
8589 this . container ! . on ( 'plotly_doubleclick' , this . props . onDoubleClick ) ;
8690 }
8791 if ( this . props . onFramework ) {
92+ this . container ! . removeAllListeners ( "plotly_framework" ) ;
8893 this . container ! . on ( 'plotly_framework' , this . props . onFramework ) ;
8994 }
9095 if ( this . props . onHover ) {
96+ this . container ! . removeAllListeners ( "plotly_hover" ) ;
9197 this . container ! . on ( 'plotly_hover' , this . props . onHover ) ;
9298 }
9399 if ( this . props . onLegendClick ) {
100+ this . container ! . removeAllListeners ( "plotly_legendclick" ) ;
94101 this . container ! . on ( 'plotly_legendclick' , this . props . onLegendClick ) ;
95102 }
96103 if ( this . props . onLegendDoubleClick ) {
104+ this . container ! . removeAllListeners ( "plotly_legenddoubleclick" ) ;
97105 this . container ! . on ( 'plotly_legenddoubleclick' , this . props . onLegendDoubleClick ) ;
98106 }
99107 if ( this . props . onRelayout ) {
108+ this . container ! . removeAllListeners ( "plotly_relayout" ) ;
100109 this . container ! . on ( 'plotly_relayout' , this . props . onRelayout ) ;
101110 }
102111 if ( this . props . onRestyle ) {
112+ this . container ! . removeAllListeners ( "plotly_restyle" ) ;
103113 this . container ! . on ( 'plotly_restyle' , this . props . onRestyle ) ;
104114 }
105115 if ( this . props . onRedraw ) {
116+ this . container ! . removeAllListeners ( "plotly_redraw" ) ;
106117 this . container ! . on ( 'plotly_redraw' , this . props . onRedraw ) ;
107118 }
108119 if ( this . props . onSelecting ) {
120+ this . container ! . removeAllListeners ( "plotly_selecting" ) ;
109121 this . container ! . on ( 'plotly_selecting' , this . props . onSelecting ) ;
110122 }
111123 if ( this . props . onSliderChange ) {
124+ this . container ! . removeAllListeners ( "plotly_sliderchange" ) ;
112125 this . container ! . on ( 'plotly_sliderchange' , this . props . onSliderChange ) ;
113126 }
114127 if ( this . props . onSliderEnd ) {
128+ this . container ! . removeAllListeners ( "plotly_sliderend" ) ;
115129 this . container ! . on ( 'plotly_sliderend' , this . props . onSliderEnd ) ;
116130 }
117131 if ( this . props . onSliderStart ) {
132+ this . container ! . removeAllListeners ( "plotly_sliderstart" ) ;
118133 this . container ! . on ( 'plotly_sliderstart' , this . props . onSliderStart ) ;
119134 }
120135 if ( this . props . onTransitioning ) {
136+ this . container ! . removeAllListeners ( "plotly_transitioning" ) ;
121137 this . container ! . on ( 'plotly_transitioning' , this . props . onTransitioning ) ;
122138 }
123139 if ( this . props . onTransitionInterrupted ) {
140+ this . container ! . removeAllListeners ( "plotly_transitioninterrupted" ) ;
124141 this . container ! . on ( 'plotly_transitioninterrupted' , this . props . onTransitionInterrupted ) ;
125142 }
126143 if ( this . props . onUnHover ) {
144+ this . container ! . removeAllListeners ( "plotly_unhover" ) ;
127145 this . container ! . on ( 'plotly_unhover' , this . props . onUnHover ) ;
128146 }
129147 if ( this . props . onEvent ) {
148+ this . container ! . removeAllListeners ( "plotly_event" ) ;
130149 this . container ! . on ( 'plotly_event' , this . props . onEvent ) ;
131150 }
132151 window . addEventListener ( 'resize' , this . resize ) ;
@@ -210,4 +229,4 @@ class PlotlyChart extends React.Component<IPlotlyChartProps, any> {
210229 }
211230}
212231
213- export default PlotlyChart ;
232+ export default PlotlyChart ;
0 commit comments