1

I obtained a waterfall chart and I would like to make it reactive. To display my waterfall plot I used the following line :

ggplot(a, aes(WorkArea, fill = type)) + geom_rect(aes(x = WorkArea, xmin = id -0.45, xmax = id + 0.45, ymin = end, ymax =start))+scale_y_continuous(breaks=seq(0,round(max(as.numeric(a$TEST))),1))

My data are the following :

>dput(a)
structure(list(WorkArea = structure(1:12, .Label = c("W04-2017","1","2","3","4", "5", "6", "7", "8", "9", "10", "W02-2017"), class ="factor"), type = c("Reference", "GAP -", "GAP +", "GAP +", "GAP +", "GAP -","GAP +", "GAP +", "GAP -", "GAP +", "GAP -", "Reference"), id = 1:12, end =c(7.76, 7.74633088087763, 7.9153571928874, 8.00995033541827, 8.12310088678836, 7.95370807262163, 8.29697519437368, 8.31463895449699, 8.28302107983506,8.29280710260114, 8.28, 0), start = c(0, 7.76, 7.74633088087763, 7.9153571928874, 8.00995033541827, 8.12310088678836, 7.95370807262163,8.29697519437368,8.31463895449699, 8.28302107983506, 8.29280710260114, 8.28),TEST = list(7.76, -0.0136691191223706, 0.169026312009775, 0.0945931425308611, 0.113150551370094, -0.169392814166733, 0.343267121752054, 0.017663760123311, -0.0316178746619267,0.00978602276607453, -0.01280710260114, 9.45)), .Names = c("WorkArea","type", "id", "end", "start", "TEST"), class = "data.frame", row.names = c(NA, 12L))

My idea is : when an user click on a bar it becomes highlighted and a table is displayed with the details concerning this group(this bar). To do that I have to obtain the informations about the group.

How could I do that?

enter image description here

Axeman
  • 32,068
  • 8
  • 81
  • 94
Auré
  • 161
  • 1
  • 11
  • 1
    For ease of translating `ggplot2` items into interactive/reactive graphics, I'd recommend looking into `plotly` and the use of `ggplotly` within `shiny` – Jake Kaupp Jan 26 '17 at 14:46
  • 1
    this could help you http://stackoverflow.com/questions/41667116/obtain-observations-in-geom-hex-in-a-single-plot-shiny – MLavoie Jan 27 '17 at 18:48

0 Answers0