Coupling tooltips on hover between subplots using r and plotly
まだ誰も着手していません。
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I would like to do a plot like this one: https://www.somesolvedproblems.com/2020/03/how-to-link-plotly-events-between-plots.html
Here is what I have tried:
library(tidyverse)
library(htmlwidgets)
library(ggplot2)
library(plotly)
library(shiny)
x <- seq(0,1, 0.001)
y <- sin(2*pi*x)
z <- cos(2*pi*x)
df <- data.frame(x = x, y = y, z = z)
p <- ggplot(df, aes(x, y)) + geom_line()
q <- ggplot(df, aes(x, z)) + geom_line()
r <- subplot(p
, q
, nrows =1
, titleX = FALSE
, titleY = FALSE)
r$elementId <- "rt"
s <- r %>%
onRender("
function(el) {
el.on('plotly_hover', function (eventdata){
console.log(eventdata.xvals);
Plotly.Fx.hover('rt',
[
{ curveNumber: 0, pointNumber:eventdata.points[0].pointNumber },
{ curveNumber: 1, pointNumber:eventdata.points[0].pointNumber },
]
);
}
")
with hints from: https://community.plotly.com/t/coupling-hover-events-for-side-by-side-subplots/2049 and https://plotly-r.com/js-event-handlers.html
However, this does not work yet. Primarily, because of my lack of understanding of the javascript issues. Is such bidirectional trigger possible? Can this be done using plotly package and related tools such as htmlwidgets and htmltools package for r? Thanks.
This issue is also posted on stackoverflow:
Link to issue on Stackoverflow
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
この issue には、リポジトリ内のファイルもテストのエントリーポイントもありません。まず subplot()、htmlwidgets::onRender()、Plotly.Fx.hover() を使って R の例を再現し、その後、双方向の hover 動作としてサポートする仕様と、完了条件となる実行可能な例またはテストを定義してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, r
- 領域
- data-visualization
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100