Skip to content

When bookmarking, add option to NOT retain all the verbose plotly parameters #1447

Open
@daattali

Description

@daattali

When I have a plotly plot in a bookmarkable shiny app, the bookmarking URL becomes very long and messy with lots of plotly-related data that doesn't seem too useful. It would be nice if there was an easy way to turn that off, or perhaps even just not include all this information by default.

Example app:

library(shiny)
library(plotly)

ui <- function(req) {
  fluidPage(
    bookmarkButton(),
    plotlyOutput("plot")
  )
}

server <- function(input, output, session) {
  output$plot <- renderPlotly({
    plot_ly(economics, x = ~pop)
  })
}

shinyApp(ui, server, enableBookmarking = "url", options = list(port = 3900))

When I just open this app and click on the bookmark button, I get this URL:

http://127.0.0.1:3900/?_inputs_&.clientValue-default-plotlyCrosstalkOpts=%7B%22on%22%3A%22plotly_click%22%2C%22persistent%22%3Afalse%2C%22dynamic%22%3Afalse%2C%22selectize%22%3Afalse%2C%22opacityDim%22%3A0.2%2C%22selected%22%3A%7B%22opacity%22%3A1%7D%2C%22debounce%22%3A0%2C%22color%22%3A%5B%5D%7D&.clientValue-plotly_relayout-A=%22%7B%5C%22width%5C%22%3A1570%2C%5C%22height%5C%22%3A400%7D%22

looks unnecessarily long. If I interact with this basic plot a little bit, I get an even longer URL such as

http://127.0.0.1:3900/?_inputs_&.clientValue-default-plotlyCrosstalkOpts=%7B%22on%22%3A%22plotly_click%22%2C%22persistent%22%3Afalse%2C%22dynamic%22%3Afalse%2C%22selectize%22%3Afalse%2C%22opacityDim%22%3A0.2%2C%22selected%22%3A%7B%22opacity%22%3A1%7D%2C%22debounce%22%3A0%2C%22color%22%3A%5B%5D%2C%22persistentShift%22%3Afalse%7D&.clientValue-plotly_hover-A=null&.clientValue-plotly_relayout-A=%22%7B%5C%22dragmode%5C%22%3A%5C%22lasso%5C%22%7D%22&.clientValue-plotly_selected-A=%22%5B%7B%5C%22curveNumber%5C%22%3A0%2C%5C%22x%5C%22%3A294999.5%2C%5C%22y%5C%22%3A43%7D%2C%7B%5C%22curveNumber%5C%22%3A0%2C%5C%22x%5C%22%3A304999.5%2C%5C%22y%5C%22%3A46%7D%5D%22

But even though it's so long, pasting this back into the URL bar goes back to the default plotly view and it did not retain the interactions I did. So it doesn't seem too useful to have the bookmark URL dirtied for this.

I'm not sure if this is a plotly issue, a crosstalk issue, an htmlwidgets issue, or maybe even a shiny issue. If this is the wrong place to post, let me know where it should go instead.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions