plotly / plotly/plotly.R

customdata array access issues

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

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

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

説明

I am having issues accessing array elements inside of customdata using traditional JS indexing. The dot property accessor works, but using a key value or a numeric index inside of brackets doesn't seem to work. Here is my minimal reproducible example with only the version that works.

library(data.table)
library(plotly)

# Create sample data set of arbitrary length
n <- 1e3
dt <- data.table(
  x=seq_len(n),
  y=rnorm(n),
  z=1e5*rnorm(n),
  'text_label'=as.character(seq_len(n))
)

# Create customdata -- performance does not scale well with large n (1e6)
customCols <- c('z','text_label') # columns to include in customdata as they are not passed elsewhere
customdata <- split(dt[,.SD,.SDcols=customCols], seq_len(nrow(dt))) # fastest method of splitting data.frame

# Create and print plot
p <- plot_ly(data=dt) %>%
  add_trace(
    x=~x,
    y=~y,
    customdata=customdata,
    hovertemplate='<b>Test Label: </b>%{customdata.text_label}',
    type='scatter',
    mode='markers'
  )
print(p)

Hovertemplates that do not work

hovertemplate='<b>Test Label: </b>%{customdata[1]}',
hovertemplate='<b>Test Label: </b>%{customdata["text_label"]}',

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

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

はじめの一歩

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

調査の方向性

plot_ly()、add_trace()、customdata、および issue に示されている hovertemplate のバリエーションを使って R の例を再現します。まず、customdata が hovertemplate 式にどのように公開されるかを追跡し、次に、数値による角括弧アクセスとキーによる角括弧アクセスがドットアクセスと併用して機能することを確認します。両方の失敗する hovertemplate 形式で期待される customdata の値が表示されれば完了です。

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

評価

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

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

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