如何创建交互式瀑布情节? [R

时间:2017-01-26 13:06:58

标签: r ggplot2 shiny

我获得了一张瀑布图,我想让它反应一下。 为了显示我的瀑布图,我使用了以下行:

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))

我的数据如下:

>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))

我的想法是:当用户点击一个栏时,它会突出显示,并显示一个表格,其中包含有关该组的详细信息(此栏)。要做到这一点,我必须获得有关该组的信息。

我怎么能这样做?

enter image description here

0 个答案:

没有答案