Sluggish performance when using add_annotations
未关闭
还没有人认领这个 Issue。
- 主要语言
- R
- 星标
- 2.7k
- 派生
- 641
- PR 合并指标
- 30 天内没有已合并 PR
描述
Adding "add_annotations" to many points on any plot, cause slow performance.
Please see the below minimal example
library(shiny)
library(plotly)
library(quantmod)
ui <- fluidPage(
plotlyOutput("plot"),
verbatimTextOutput("event")
)
server <- function(input, output) {
output$plot <- renderPlotly({
getSymbols("AAPL",src='yahoo')
# basic example of ohlc charts
df <- data.frame(Date=index(AAPL),coredata(AAPL))
df <- tail(df, 500)
p <- df %>%
plot_ly(x = ~Date, type="candlestick",
open = ~AAPL.Open, close = ~AAPL.Close,
high = ~AAPL.High, low = ~AAPL.Low) %>%
add_annotations(x = ~Date , y = ~AAPL.Open, text = "Tslow",xref = "x", yref = "y", yref = "y",ax = -30, ay = 40,
arrowcolor = 'rgb(0, 153, 51)', arrowsize = 2, arrowwidth = 1, arrowhead = 4) %>%
layout(title = "Basic Candlestick Chart",xaxis = list(rangeslider = list(visible = F)))
p
})
output$event <- renderPrint({
d <- event_data("plotly_hover")
if (is.null(d)) "Hover on a point!" else d
})
}
shinyApp(ui, server)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先运行提供的 R Shiny 示例,使用 plotly、quantmod 和 500 个蜡烛图点,然后对 add_annotations 调用进行性能分析。该 issue 未指定源文件或测试;在不破坏示例的情况下确定并解决注释性能缓慢的原因,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- r
- 领域
- data-visualization, performance
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100