How can I fix the issue of showing the same tooltip value in all x-axis for area charts using ggplotly?

R ggplotly geom_area (area chart) tooltip issue - showing same tooltip value in all x-axis.

I am facing tooltip issue in my projects while creating area charts using geom_area from ggplot package in R (for the tooltip, converted into plotly object using ggplotly() function from plotly package). for all x-axis, it is showing same tooltip value.

Please see the reproducible example code (this code is from R Graph Gallery)

Packages

library(ggplot2)
library(dplyr)
library(plotly)

create data

time <- as.numeric(rep(seq(1,7),each=7)) # x Axis
value <- runif(49, 10, 100) # y Axis
group <- rep(LETTERS[1:7],times=7) # group, one shape per group
data <- data.frame(time, value, group)

stacked area chart

ggplotly(
ggplot(data, aes(x=time, y=value, fill=group)) +
geom_area()
)

Please see below images, I am getting same tooltip value all x-axis.
Could someone please help me to resolve this? I have same issue in my two projects.
[image]
[image]

package versions: "ggplot2" - "3.4.0" "plotly" - "4.10.1"

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.