plotly / plotly/plotly.R

hovertemplate not parsed with text input

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

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

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

説明

Hello plotly.R,

I'm using the hovertemplate in a bar chart with my data segmented using the color argument. I wish to use the text value in my hovertemplate.
The issue is that the template is not processed for one of my two segments.

Run the below code, and hover on the three bars. For the first two, the hover info is correct, for the last one, it shows the template part where the text is supposed to go.

Note 1: replacing text with y works in this case. But there could be a case where I really need the text and not the y.
Note 2: the texttemplate does not have this issue and correctly shows the value of the text in all three bars.

library(plotly)

df <- data.frame(year = c('2021', '2020', '2019'), value = c(123, 110, 95))
plot_ly(data = df, x=~year, y=~value, text=~value, type='bar', color=~(year=='2021'),
        textposition = 'outside', texttemplate = '%{text:.2s}',
        hovertemplate = paste('Year: %{x}', '<br>Value: %{text:.4s}<br><extra></extra>'))

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

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

はじめの一歩

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

調査の方向性

まず、提供されている plot_ly の例を実行し、3 本すべての棒について hovertemplate と texttemplate を比較します。特に 2019 年のセグメントを確認してください。R の入力値 text、color、hovertemplate がレンダリングされたチャートにどのように渡されるかを追跡します。完了条件は、すべての棒で %{text} に期待される値が表示されることです。

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

評価

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

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

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