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

Small domain causing hovers to not appear #527

Closed
abalter opened this issue May 12, 2016 · 4 comments · Fixed by #2215
Closed

Small domain causing hovers to not appear #527

abalter opened this issue May 12, 2016 · 4 comments · Fixed by #2215
Labels
bug something broken

Comments

@abalter
Copy link

abalter commented May 12, 2016

Ok, maybe "sensible" and "nonsensical" are not really true, I'm just thinking domain should be [0,1], but maybe that is not necessary.

This bug was discovered via this SO post. http://stackoverflow.com/questions/37178664/plotly-hover-text-not-displaying/37180688#37180688

This fiddle has the following code, and hover text is not working. If I make the single change of domain from [0.85, 0.9] to [0.85, 1.9], the hovers show. But the whole point is to have the line of markers above other plots as in http://plnkr.co/edit/vvStyutowlwubUdddY37

var data =
{
    "x":["2014-02-10 00:00:00.0","2014-02-18 00:00:00.0","2014-02-24 00:00:00.0"],
  "y":[0,0,0],
  "text":["gemcitabine","gemcitabine + Abraxane","Xeloda"],
    "hoverinfo": "all",
  "name":"Treatment",
  "type":"scatter",
  "mode":"markers",
  "marker":
  {
    "size":9,
    "color":"#800000"
    },
  "uid":"c2e171"
};

var layout = 
{
    "title":"Treatments",
  "height":600,
  "width":655,
  "autosize":true,
  "yaxis":
  {
    "titlefont":
    {
        "size":12,
      "color":"#800000"
    },
    "domain":[0.85,0.9],
    "showgrid":false,
    "showline":false,
    "showticklabels":false,
    "zeroline":true,
    "type":"linear",
    "range":[0,0],
    "autorange":true
  },
  "hovermode":"closest",
  "xaxis":
  {
    "type":"date",
    "range":[1389215256994.8186,1434909143005.1814],
    "autorange":true
  }
};

Plotly.plot('graph', [data], layout);
@etpinard
Copy link
Contributor

Bug confirmed. Thanks for bringing this up.

Reproducible codepen: http://codepen.io/etpinard/pen/BKEpgW

Hover labels visibility should not be affected by the axis domains.

@etpinard
Copy link
Contributor

If I make the single change of domain from [0.85, 0.9] to [0.85, 1.9], the hovers show

By the way, domain values beyond [0,1] (e.g [0.85, 1.9]) are constrained to the [0,1] interval. That is, [0.85, 1.9] is really the same as [0.85, 1] for plotly.js.

@etpinard etpinard added the bug something broken label May 13, 2016
@etpinard etpinard changed the title Sensible domain causing hovers to not appear (nonsensical domain lets them appear). Small domain causing hovers to not appear May 18, 2016
@abalter
Copy link
Author

abalter commented May 25, 2016

Here are a couple of playgrounds that might help with debugging:

https://jsfiddle.net/abalter/kehgovq9/

https://jsfiddle.net/abalter/kehgovq9/

@jdugge
Copy link
Contributor

jdugge commented Sep 13, 2017

I believe this happens because plot.ly wants to constrain labels strictly to the height of current y axis (pmax is basically the length of the current axis).

One way to solve this could be to allow labels to spill out of the current axis, at least into the associated x-axis, but possibly also into other subplots or even into the margins of the plot.

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

Successfully merging a pull request may close this issue.

3 participants