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
From the official plotly documentation and when using simple JavaScript, it is possible to do something like this to disable the default behavior for legend clicking: myPlot.on('plotly_legendclick', function(data){ return false; });
After looking into your code, the angular wrapper seems to simply register a corresponding EventEmitter for every plot event and does not provide a way to disable those events at all. It would be nice to be able to disable the legend click or double-click behavior. Maybe it is possible to build a property like [disableLegendClick] and [disableLegendDoubleClick] or something? Or transfer the 'return false' approach to the Angular wrapper, if technically possible.
My next approach would be to somehow get the underlying plotly div from the template through whatever means and manually overwrite the two events. But I am not sure which side-effects that might have and it also somehow defeats the purpose of the wrapper by working around it.
Any ideas? Is there a way I have not yet tried? I am not sure if this is actually a bug or a feature request. After I had a look into the code I simply assumed the latter. I am using version 1.1.0 of the wrapper and plotly.js 1.45.3.
The text was updated successfully, but these errors were encountered:
@Schmaga this is a very specific scenario. I don't like the idea of using properties like [disableLegendClick] for it doesn't scale well (imagine having a property like this for each event?).
As a quick solution (while we wonder about a good api), you could use the initialized event to get the current plotlyInstance and set the event manually. Like this:
@andrefarzat I totally agree that the disable properties are not a scalable design. It was just a quick thought.
And your workaround did the trick. Thanks alot!
Maybe instead of a disable property per event, it would be possible to bind a list of disabled events? Another more or less bad design. No better idea has popped up, yet :) I'm quite sure it's not possible to pass any Angular event return values to the underlying JavaScript event, so that's probably a no-go.
So maybe, just maybe... It might be enough to document this workaround somewhere and keep it that way? I think it's not that bad. What do you think?
From the official plotly documentation and when using simple JavaScript, it is possible to do something like this to disable the default behavior for legend clicking:
myPlot.on('plotly_legendclick', function(data){ return false; });
After looking into your code, the angular wrapper seems to simply register a corresponding EventEmitter for every plot event and does not provide a way to disable those events at all. It would be nice to be able to disable the legend click or double-click behavior. Maybe it is possible to build a property like [disableLegendClick] and [disableLegendDoubleClick] or something? Or transfer the 'return false' approach to the Angular wrapper, if technically possible.
My next approach would be to somehow get the underlying plotly div from the template through whatever means and manually overwrite the two events. But I am not sure which side-effects that might have and it also somehow defeats the purpose of the wrapper by working around it.
Any ideas? Is there a way I have not yet tried? I am not sure if this is actually a bug or a feature request. After I had a look into the code I simply assumed the latter. I am using version 1.1.0 of the wrapper and plotly.js 1.45.3.
The text was updated successfully, but these errors were encountered: