David-Desmaisons / vue-plotly

📈 vue wrapper for plotly.js
https://david-desmaisons.github.io/vue-plotly/
MIT License
256 stars 74 forks source link

How to call undocumented Plotly calls #3

Closed sjennen closed 5 years ago

sjennen commented 5 years ago

Is there a way to call Plotly.Fx.hover using this wrapper? We have a a need for that functionality based on the code from this page: https://plot.ly/javascript/hover-events/#triggering-hover-events

Codermar commented 5 years ago

The plotly instance could be passed back to the component via an event and then you could use anything in it. I can do a quick PR for this if still interested.

 // Plotly.vue
  mounted() {
    Plotly.newPlot(this.$el, this.data, this.innerLayout, this.options);
    events.forEach(evt => {
      this.$el.on(evt.completeName, evt.handler(this));
    });
    this.$emit("plotlyready", Plotly);
  }, 
David-Desmaisons commented 5 years ago

@sjennen You can import ploty in your code to access Plotly.Fx.hover.

ttmms commented 3 years ago

@David-Desmaisons could you give an example? I don't find anything related to Fx in plotly when imported.

bennybobw commented 1 year ago

It's been a while since anyone commented on this, but here's what I did:

import { Plotly } from 'vue-plotly'
import * as PlotlyJs from 'plotly.js'
// then
PlotlyJs.Fx.hover()