# Vertical or/and horizontal line that is always shown in any hovermode

**URL:** <https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302>\
**Category:** plotly.js\
**Created:** [February 9, 2019, 1:23am UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302 "2019-02-09T01:23:04Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![venkat777](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@venkat777](https://community.plotly.com/u/venkat777)\
**Post date:** [February 9, 2019, 1:23am UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302/1 "2019-02-09T01:23:04Z")

</div>

Hi Everyone,  
I am looking for a working examples .  
I have seen a lot of stuff reg but could not find the working examples.

# Vertical or/and horizontal line that is always shown in any hovermode

Thank You  
Venkat

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [February 10, 2019, 6:50pm UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302/2 "2019-02-10T18:50:51Z")

</div>

Here’s one: [https://codepen.io/etpinard/pen/MLVrYr](https://codepen.io/etpinard/pen/MLVrYr)

---

<div class="post-metadata">

**Author:** ![venkat777](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@venkat777](https://community.plotly.com/u/venkat777)\
**Post date:** [February 11, 2019, 3:16pm UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302/3 "2019-02-11T15:16:24Z")

</div>

Its working if we have single x-axis and single y-axis.  
But in my scenario we are having multiple y-axis.

I added on x-axis showspikes: true, spikemode: ‘toaxis+across+marker’, spikesnap: ‘cursor’

Can You pls advise where its wrong.

Thank You  
Venkat

 ![Spikes_Issue](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/d/d3ced7e22975299c8fabe1a68748b0f765454d42.jpeg)

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [February 11, 2019, 4:26pm UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302/4 "2019-02-11T16:26:25Z")

</div>

Can you share a reproducible code snippet to help us debug? Thanks!

---

<div class="post-metadata">

**Author:** ![venkat777](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@venkat777](https://community.plotly.com/u/venkat777)\
**Post date:** [February 11, 2019, 10:18pm UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302/5 "2019-02-11T22:18:24Z")

</div>

Hi etienne,  
my code is similar to the fiddler [https://jsfiddle.net/2v2qp0hy/2/](https://jsfiddle.net/2v2qp0hy/2/)  
Even the multiple Y axes code I have done using the fiddler given above.

can we add spike to it .  
I added “xaxis”: { showspikes: true, spikemode: ‘toaxis’, spikesnap: ‘cursor+data’ }.  
But it did not work.

Thank You.  
Venkat

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [February 12, 2019, 4:35pm UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302/6 "2019-02-12T16:35:49Z")

</div>

You were using an old version of plotly.js that didn’t include `spikes`.

Looks like [https://jsfiddle.net/86upsg2d/](https://jsfiddle.net/86upsg2d/) works ok.

---

<div class="post-metadata">

**Author:** ![venkat777](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@venkat777](https://community.plotly.com/u/venkat777)\
**Post date:** [February 12, 2019, 4:41pm UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302/7 "2019-02-12T16:41:32Z")

</div>

Yes the spikes is working on the latest fiddler.  
But can we show the data on hover on all the legends . And then add spikes.  
the spike will be as reference at the particular point to see all the legends hover.  
i.e a line (spike) + to see all the legends data.

or just add the line and show all the legends hover data.

Thank You  
Venkat

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [February 12, 2019, 5:01pm UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302/8 "2019-02-12T17:01:07Z")

</div>

I’m not sure what you mean by “hover on all the legends”. Could you clarify? Thank you!

---

<div class="post-metadata">

**Author:** ![venkat777](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@venkat777](https://community.plotly.com/u/venkat777)\
**Post date:** [February 12, 2019, 6:28pm UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302/9 "2019-02-12T18:28:12Z")

</div>

Hi Etiennne,  
I have hovered on the 2nd Trend from Top.  
**So the spike its shows on the Trend( red color)** all the rest of the trends are hovering the data.

 ![Spikes_withHoverAllLegends](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/f/fce3505368f418fe6b005be67bf4bbb366d4baba.jpeg)

Its a combination of spike +hover on the rest of Trends.

---

<div class="post-metadata">

**Author:** ![etienne](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/etienne/32/17_2.png) [@etienne](https://community.plotly.com/u/etienne)\
**Post date:** [February 12, 2019, 8:00pm UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302/10 "2019-02-12T20:00:56Z")

</div>

Ha, I see you’re using that `Fx.hover` trick.

Spikes don’t work so well with `Fx.hover` at the moment unfortunately:

- [https://github.com/plotly/plotly.js/issues/3219](https://github.com/plotly/plotly.js/issues/3219)
- [https://github.com/plotly/plotly.js/issues/2517](https://github.com/plotly/plotly.js/issues/2517)

---

<div class="post-metadata">

**Author:** ![venkat777](https://avatars.discourse-cdn.com/v4/letter/v/858c86/32.png) [@venkat777](https://community.plotly.com/u/venkat777)\
**Post date:** [February 12, 2019, 10:11pm UTC](https://community.plotly.com/t/vertical-or-and-horizontal-line-that-is-always-shown-in-any-hovermode/19302/11 "2019-02-12T22:11:56Z")

</div>

Thank You etienne.  
But it happens only when we have multiple y-axis.

Thank You  
Venkat
