You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using the (click) output of <plotly-plot>. The associated component method fires twice. I use $event as argument from the html template. This argument has the associated ploytly plot data for the first invocation. The second invocation only has a regular MouseEvent.
The text was updated successfully, but these errors were encountered:
You really pointed a big issue. Once you use (click) it adds an event listener for both core's angular and the plotly-plot element. That's why it triggers twice ... I am studying if it would be possible to remove only the core's somehow (tried using @HostListener canceling/stopping the event, but no success) ... A second solution would be prefixing the event like (plotlyClick) so this would avoid the conflict.
In this meanwhile, a simple solution to avoid executing the click twice: Check if the given $event is instance of MouseEvent, if yes it is the native event, if not, it is the plotly-plot event.
@jjmurre I could not find a good way to avoid the event being emitted twice. The best I could figure was to deprecated the (click) and ask the developers to use (plotly_click). I added this explanation to the FAQ
I am using the (click) output of
<plotly-plot>
. The associated component method fires twice. I use $event as argument from the html template. This argument has the associated ploytly plot data for the first invocation. The second invocation only has a regular MouseEvent.The text was updated successfully, but these errors were encountered: