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

Issue supplying rgba() codes to color arg #1233

Closed
viniciusvgp opened this issue Apr 11, 2018 · 5 comments
Closed

Issue supplying rgba() codes to color arg #1233

viniciusvgp opened this issue Apr 11, 2018 · 5 comments
Labels

Comments

@viniciusvgp
Copy link

viniciusvgp commented Apr 11, 2018

When using hoveron='fills' the custom hover text is not drawn. The hover shows only the split/fill variable.

Code example:

library(plotly)
data.frame(AA=c(2,3,3,2,NA, 6,7,7,6,NA),
           BB=c(2,2,3,2,NA, 6,6,7,6,NA),
           CC=c(rep('abc', 5), rep('xyz', 5)),
           LL=c(rep('A', 5), rep('B', 5))) %>%
    plot_ly() %>%
             add_trace(x=~AA,
                       y=~BB,
                       text=~paste('<br> <b>Example</b> of <em>custom</em> hover text <br>', LL, '<br>', CC, '<br>.'),
                       split=~LL, 
                       mode="lines", 
                       fill="toself", 
                       hoveron='fills',
                       type="scatter", 
                       color = I(c(rep(toRGB("black", 1), 5),
                                   rep(toRGB("red", 1), 5)))
                       )

Result:
wrong hover

@cpsievert
Copy link
Collaborator

I believe you want fill, not fills?

@cpsievert cpsievert changed the title Custom hover text feature seems to be broken Issue supplying rgba() codes to color arg Apr 11, 2018
@cpsievert
Copy link
Collaborator

Interestingly enough this example is currently broken in the development version, so I will keep this open

@cpsievert cpsievert added the bug label Apr 11, 2018
@cpsievert cpsievert added this to the Next CRAN release milestone Apr 11, 2018
@viniciusvgp
Copy link
Author

It is 'fills' with 's'. From the code, it seems correct:

 R/layers2traces.R:29:    if (identical("fills", hover_on(x))) {
 R/layers2traces.R:915:  if (identical(hover_on(dat), "fills")) {

@cpsievert
Copy link
Collaborator

cpsievert commented Apr 12, 2018

Do u know if supplying a vector of text when hover='fills' ever worked in version 4.7.1 or prior?

I just recently added the ability to "reduce" a vector of (redundant) text to a string when hoveron = 'fill' (which I now see should be hoveron='fills', thanks)

Now that I think of it, it seems it'd be better to always "reduce" a vector of text to a string when hoveron='fills'...

@cpsievert
Copy link
Collaborator

Should work as you'd expect now, thanks!

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

No branches or pull requests

2 participants