plotly / plotly/plotly.R

Using Shift on event_data("plotly_click") only stores last key

オープン
#1,401 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

difficulty: medium enhancement shiny
主要言語
R
スター
2.7k
フォーク
641
PR マージ指標
30日以内にマージされた PR はありません

説明

When using the SHIFT-key on a plotly_click event, it returns only the last clicked key, whereas using SHIFT on plotly_selected stores all selected keys.

Is it possible to adapt the event_data("plotly_click") to be consistent with the highlighting and return all clicked/highlighted elements?

Or can I deactivate SHIFT for click-events alltogether and leave it activated for selection-events?

clickselect

Shiny-App:

library(shiny)
library(ggplot2)
library(plotly)

dfN <- data.frame(
  time_stamp = seq.Date(as.Date("2018-04-01"), as.Date("2018-07-30"), 1),
  val = runif(121, 100,1000),
  col = "green", stringsAsFactors = F
)


ui <- fluidPage(
  plotlyOutput("plot"),
  verbatimTextOutput("clicked"),
  verbatimTextOutput("selection")
)

server <- function(input, output, session) {
  output$plot <- renderPlotly({
    key <- highlight_key(dfN)
    p <- ggplot() +
      geom_col(data = key, aes(x = plotly:::to_milliseconds(time_stamp), y = val, fill=I(col))) +
      theme(legend.position="none")
    
    ggplotly(p, source = "Src") %>% layout(xaxis = list(tickval = NULL, ticktext = NULL, type = "date")) %>% 
      highlight(selectize=F, off = "plotly_doubleclick", on = "plotly_click", color = "blue",
                opacityDim = 0.5, selected = attrs_selected(opacity = 1))
  })
    

  output$clicked <- renderPrint({
    s <- event_data("plotly_click", source = "Src")
    s
  })
  output$selection <- renderPrint({
    s <- event_data("plotly_selected", source = "Src")
    s
  })
}

shinyApp(ui, server)

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Issue にある最小限の Shiny アプリから始め、event_data("plotly_click") を highlight() および event_data("plotly_selected") と併せて追跡します。両方のイベントで Shift キーを押しながらクリックした状態がどのように表現されるかを比較し、完了条件を、クリックイベントについて強調表示されたすべてのキーを返すこと、または選択動作を維持したままクリックでの Shift を無効化する方法を文書化して実装することのいずれかとして定義します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, r
領域
data-visualization, frontend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
38/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。