@@ -73,60 +73,79 @@ class PlotlyChart extends React.Component<IPlotlyChartProps, any> {
73
73
// this.container!.on('plotly_buttonclicked', this.props.onButtonClicked);
74
74
// }
75
75
if ( this . props . onClick ) {
76
+ this . container ! . removeAllListeners ( "plotly_click" ) ;
76
77
this . container ! . on ( 'plotly_click' , this . props . onClick ) ;
77
78
}
78
79
if ( this . props . onClickAnnotation ) {
80
+ this . container ! . removeAllListeners ( "plotly_clickannotation" ) ;
79
81
this . container ! . on ( 'plotly_clickannotation' , this . props . onClickAnnotation ) ;
80
82
}
81
83
if ( this . props . onDeselect ) {
84
+ this . container ! . removeAllListeners ( "plotly_deselect" ) ;
82
85
this . container ! . on ( 'plotly_deselect' , this . props . onDeselect ) ;
83
86
}
84
87
if ( this . props . onDoubleClick ) {
88
+ this . container ! . removeAllListeners ( "plotly_doubleclick" ) ;
85
89
this . container ! . on ( 'plotly_doubleclick' , this . props . onDoubleClick ) ;
86
90
}
87
91
if ( this . props . onFramework ) {
92
+ this . container ! . removeAllListeners ( "plotly_framework" ) ;
88
93
this . container ! . on ( 'plotly_framework' , this . props . onFramework ) ;
89
94
}
90
95
if ( this . props . onHover ) {
96
+ this . container ! . removeAllListeners ( "plotly_hover" ) ;
91
97
this . container ! . on ( 'plotly_hover' , this . props . onHover ) ;
92
98
}
93
99
if ( this . props . onLegendClick ) {
100
+ this . container ! . removeAllListeners ( "plotly_legendclick" ) ;
94
101
this . container ! . on ( 'plotly_legendclick' , this . props . onLegendClick ) ;
95
102
}
96
103
if ( this . props . onLegendDoubleClick ) {
104
+ this . container ! . removeAllListeners ( "plotly_legenddoubleclick" ) ;
97
105
this . container ! . on ( 'plotly_legenddoubleclick' , this . props . onLegendDoubleClick ) ;
98
106
}
99
107
if ( this . props . onRelayout ) {
108
+ this . container ! . removeAllListeners ( "plotly_relayout" ) ;
100
109
this . container ! . on ( 'plotly_relayout' , this . props . onRelayout ) ;
101
110
}
102
111
if ( this . props . onRestyle ) {
112
+ this . container ! . removeAllListeners ( "plotly_restyle" ) ;
103
113
this . container ! . on ( 'plotly_restyle' , this . props . onRestyle ) ;
104
114
}
105
115
if ( this . props . onRedraw ) {
116
+ this . container ! . removeAllListeners ( "plotly_redraw" ) ;
106
117
this . container ! . on ( 'plotly_redraw' , this . props . onRedraw ) ;
107
118
}
108
119
if ( this . props . onSelecting ) {
120
+ this . container ! . removeAllListeners ( "plotly_selecting" ) ;
109
121
this . container ! . on ( 'plotly_selecting' , this . props . onSelecting ) ;
110
122
}
111
123
if ( this . props . onSliderChange ) {
124
+ this . container ! . removeAllListeners ( "plotly_sliderchange" ) ;
112
125
this . container ! . on ( 'plotly_sliderchange' , this . props . onSliderChange ) ;
113
126
}
114
127
if ( this . props . onSliderEnd ) {
128
+ this . container ! . removeAllListeners ( "plotly_sliderend" ) ;
115
129
this . container ! . on ( 'plotly_sliderend' , this . props . onSliderEnd ) ;
116
130
}
117
131
if ( this . props . onSliderStart ) {
132
+ this . container ! . removeAllListeners ( "plotly_sliderstart" ) ;
118
133
this . container ! . on ( 'plotly_sliderstart' , this . props . onSliderStart ) ;
119
134
}
120
135
if ( this . props . onTransitioning ) {
136
+ this . container ! . removeAllListeners ( "plotly_transitioning" ) ;
121
137
this . container ! . on ( 'plotly_transitioning' , this . props . onTransitioning ) ;
122
138
}
123
139
if ( this . props . onTransitionInterrupted ) {
140
+ this . container ! . removeAllListeners ( "plotly_transitioninterrupted" ) ;
124
141
this . container ! . on ( 'plotly_transitioninterrupted' , this . props . onTransitionInterrupted ) ;
125
142
}
126
143
if ( this . props . onUnHover ) {
144
+ this . container ! . removeAllListeners ( "plotly_unhover" ) ;
127
145
this . container ! . on ( 'plotly_unhover' , this . props . onUnHover ) ;
128
146
}
129
147
if ( this . props . onEvent ) {
148
+ this . container ! . removeAllListeners ( "plotly_event" ) ;
130
149
this . container ! . on ( 'plotly_event' , this . props . onEvent ) ;
131
150
}
132
151
window . addEventListener ( 'resize' , this . resize ) ;
@@ -210,4 +229,4 @@ class PlotlyChart extends React.Component<IPlotlyChartProps, any> {
210
229
}
211
230
}
212
231
213
- export default PlotlyChart ;
232
+ export default PlotlyChart ;
0 commit comments