Hover text not visible for small bars
まだ誰も着手していません。
- 主要言語
- R
- スター
- 2.7k
- フォーク
- 641
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
I can't find a way to get the hover text to show up in a bar chart when the value of the bar is 0 or very small. The bar is not shown at all when the value is 0 but you can get around that by adding an outline color which makes it visible. However, the hover text does not show. One work around is to replace the zero with a small number but this does not show the hover text unless you zoom in or move the cursor extremely slowly. Another work around which works okay is to add a very small point geom which will provide the hover text for the small bar but then there are two different hover text sources for the larger bars which looks strange.
An ideal solution in my opinion would show a line when the value is 0 and the hover text would show up over the line. This is not the default for ggplot though so it would also be fine if when the line is added by including an outline for the bar geom the hovertext showed up when hovering near the line.
library(ggplot2)
library(plotly)
df <- data.frame(x = letters[1:5], y = 0:4*10, text = paste("some text", 1:5))
# No bar in ggplot or plotly
gp <- ggplot(df, aes(x, y, text = text))+
geom_col()
ggplotly(gp, tooltip = "text")
# has line but no hovertext
gp <- ggplot(df, aes(x, y, text = text))+
geom_col(color = "black")
ggplotly(gp, tooltip = "text")
# has small bar but can only see hover text if zoom in
df$y[1] <- 0.01
gp <- ggplot(df, aes(x, y, text = text))+
geom_col(color = "black")
ggplotly(gp, tooltip = "text")
# Hover text shows up for point but mutiple hovertexts for larger bars
gp <- ggplot(df, aes(x, y, text = text))+
geom_col(color = "black")+
geom_point(size = 0.1)
ggplotly(gp, tooltip = "text")
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、issue 内の ggplotly の例を実行し、geom_col のバーがゼロおよび非常に小さい値に対してどのように hover ターゲットを生成するかを追跡します。バーの hover 処理と関連するテストを特定し、その後、ゼロまたは非常に小さい値のバーが重複した hover ソースを作成せずに、要求された tooltip を表示することを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- r
- 領域
- data-visualization
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100