Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Triggering Hover Events #23

Open
vigorem opened this issue Aug 26, 2019 · 2 comments
Open

Triggering Hover Events #23

vigorem opened this issue Aug 26, 2019 · 2 comments

Comments

@vigorem
Copy link

vigorem commented Aug 26, 2019

Hi,

I'm trying to manualy trigger an hover event on my chart so it would display the tooltips for the last records on loading.

This is something documented in the official docs

var curve1 = Math.floor(Math.random()*2),
        curve2 = Math.floor(Math.random()*2),
        point1 = Math.floor(Math.random()*14),
        point2 = Math.floor(Math.random()*14);
Plotly.Fx.hover('myDiv',[
        {curveNumber:curve1, pointNumber:point1},
        {curveNumber:curve2, pointNumber:point2}
    ]);

but I'm having some difficulties on how to implement it with the vue-plotly component

<vue-plotly :data="data" :layout="layout" :options="options"/>

In advance, many thanks for the help

@cptnk
Copy link

cptnk commented Sep 18, 2019

You can add an ref to your component:

<vue-plotly v-show="display" :data="graphData" :layout="calculatedLayoutSizes" id="3dPlot"
            :display-mode-bar="false" ref="crazyPlotly"></vue-plotly>

then use the ref plotly events without the prefix within your mount point or similar method:

                this.$refs.crazyPlotly.$on('hover', d => {
                    d.points[0].data.marker.color = 'rgb(113, 176, 39)';
                    this.currentCurve = d.points[0].curveNumber;
                });

@ttmms
Copy link

ttmms commented Jun 1, 2021

@vigorem did you ever find out how to trigger hover event? I would like to know too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants