With the help of this code i can get total for each bar but how to show this total using hover or tooltip function
#Data
hp=read.csv(textConnection(
"class,year,amount
a,99,100
a,100,200
a,101,150
b,100,50
b,101,100
c,102,70
c,102,80
c,103,90
c,104,50
d,102,90"))
hp$year=as.factor(hp$year)
d = ggplot(hp, aes(reorder(class, -amount, sum), amount, fill = year)) +
geom_col()
#geom_text(aes(label = stat(y), group = class),stat = 'summary', fun = sum,vjust = -1)