Tooltip of plotly not changing for different x values

17 Views Asked by At

I'm trying to visualize data with an geom_area and tooltips. My data looks sth like this:

##         Date   Weekday            variable  value
## 1  2023-11-27   Monday          Kaffewunsch     3
## 2  2023-11-28   Thursday        Kaffewunsch     6
## 3  2023-11-29   Wednesday       Kaffewunsch     5
...
## 22 2023-11-27     Monday  Kaffeezubereitung     0
## 23 2023-11-28   Thursday  Kaffeezubereitung     1
## 24 2023-11-29   Wednesday Kaffeezubereitung     0
...
## 43 2023-11-27     Monday        Kaffeekauf     2
## 44 2023-11-28   Thursday        Kaffeekauf     3
## 45 2023-11-29   Wednesday        Kaffeekauf     1
...

And my ggplot (which works just fine) like this:

area <- ggplot(prep_data, aes(x = Datum, 
                                y = value, 
                                fill = variable)) +
        geom_area(position = "stack") +
        scale_x_date() +
        theme_minimal() +
        labs(title = "Kaffeeaktivitäten über die Zeit",
             x = "Datum",
             y = "Anzahl",
             fill = "Kategorie")

But if I am using

ggplotly(area)

the tooltip is only showing the information from the 27th of November. The text is changing with the categorys (Kaffewunsch / Zubereitung...) but the value and the date stays the same regardless of the x axis value (date).

I search for answers but could'nt find a solution to this specific problem.

Thank you for your help

0

There are 0 best solutions below