Skip to content

multiple selectize/dynamic color brushes rendered in shiny  #1584

Closed
sthagen/plotly-plotly.R
#11

Activity

  1. PsychlytxTD commented on Nov 13, 2019

    @PsychlytxTD

    Hi Carson, I've come across the same issue. I'd prefer to stick with the highlight approach vs. event_data if possible. I find that the plots appear fine in my app, unless I change the value of a dateRangeInput upstream, causing the app to filter the data and reload. My code is below:

    `all_cases_by_measure<- reactive({

    by_measure_nested<- nested_data() %>% dplyr::mutate(data = purrr::map(data, ~ dplyr::mutate(., timepoint = 1:length(.x$date))))

    by_measure<- tidyr::unnest(by_measure_nested)

    by_measure<- dplyr::mutate(by_measure, timepoint = paste("Time", timepoint))

    by_measure<- by_measure %>% tidyr::unite("Client", first_name, last_name, birth_date, sep = " ")

    by_measure<- by_measure %>% dplyr::group_by(subscale, timepoint) %>% dplyr::mutate(mean_score = round(mean(score, na.rm = TRUE), 2)) %>% dplyr::ungroup()

    by_measure$subscale<- gsub("_", "-", by_measure$subscale)

    by_measure %>%
    group_by(subscale) %>%
    dplyr::do(
    p = highlight_key(., ~Client, group = "Select A Client") %>%
    plot_ly(type = 'scatter', mode = 'lines', showlegend = FALSE) %>%
    add_lines(x = ~timepoint, y = ~ mean_score, text = ~paste("Mean Score:", mean_score),
    line = list(width = 3, dash = 'dash'),
    marker = list(symbol ="diamond-open"),
    mode = 'lines+markers', hoverinfo = "text") %>%
    group_by(Client) %>%
    add_trace(
    x = ~timepoint, y = ~score, text = ~paste("Client:", Client, "
    ",
    "Assessment Date:", date, "
    ",
    "Score:", score, "
    ",
    "Change Since Previous:", sprintf("%+3.1f", change_all)
    ),
    mode = 'lines+markers', hoverinfo = "text") %>%
    layout(xaxis = list(tickangle = 45)) %>%
    add_annotations(
    text = ~unique(subscale),
    x = 0.5, y = 1,
    xref = "paper", yref = "paper",
    xanchor = "center", yanchor = "bottom",
    showarrow = FALSE
    )
    ) %>%
    subplot(
    nrows = (NROW(.)/2) + 1,
    shareY = FALSE, shareX = FALSE, titleY = FALSE
    ) %>% highlight(
    dynamic = TRUE,
    selectize = TRUE,
    color = "red"
    )

    })

    output$plot_all_cases_by_measure<- plotly::renderPlotly({

    req(all_cases_by_measure())

    })`

  2. Solomon-0xGuardian commented on Apr 29, 2020

    @Solomon-0xGuardian

    I am also having this issue with Plotly in R. When I "highlight" and set "selectize = TRUE" I get a second box with a vertical scroll bar. I would really like to remove this box. Any thoughts? Maybe it is because my data set is very large (scatter plot with >40,000 points). Sorry I can't share more than the image at this point as the data is proprietary. Thanks in advance!

    PlotlyDoubleBox

  3. jbullock35 commented on May 15, 2020

    @jbullock35

    @AFoudree, I had the same problem -- the same vertical-scroll-bar artifact when I added a selectize dropdown menu to a scatterplot. Curiously, the problem appeared only when I used type = "scattergl"; it didn't appear with type = "scatter". (I know that switching to type = "scatter" may not work for you. 40,000 points in a plot seems like a lot.)

  4. Solomon-0xGuardian commented on Jul 3, 2020

    @Solomon-0xGuardian

    @jbullock35 Thanks for the comment. I cannot believe I missed the notification on this in my inbox. I will play with the scatter type and get back to you shortly. Thanks for the advice!

  5. Solomon-0xGuardian commented on Jul 8, 2020

    @Solomon-0xGuardian

    @jbullock35 I was finally able to remove the second vertical-scroll-bar artifact! I found a solution in stack overflow (Mar 8th, 2020). It looks like the problem may be occurring because the highlight-selectize widget does not work well with shiny dashboards. The fix involves embedding java script to manually remove the scroll-bar-artifact. This solution was presented by StéphaneLaurent and can be found here: https://stackoverflow.com/questions/60583349/why-does-shiny-app-add-a-spurious-widget-to-a-plotly-graph-using-highlight-funct/62795535#62795535

    Thanks again for your helpful ideas!

  6. added 2 commits that reference this issue on Mar 26, 2021
    e9a6898
    74e1781
  7. added a commit that references this issue on Apr 7, 2021
    3581d7a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions