plotly / plotly/plotly.R

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

未关闭
#1,447 5 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

shiny
主要语言
R
星标
2.7k
派生
641
PR 合并指标
30 天内没有已合并 PR

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先复现带有 URL 书签功能的示例 Shiny 应用,并比较 Plotly 交互前后的生成 URL。调查书签 URL 如何捕获报告中所述的 plotly 相关参数;如果存在一种实用方式,可以默认或通过选项省略这些参数,同时不破坏有用的书签行为,则视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
r
领域
data-visualization, frontend
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。