shinyapp上的Timevis时间线与daterangeinput和选择输入

时间:2018-02-15 15:18:46

标签: r shiny

当尝试运行闪亮的应用程序以显示包含我的数据的时间轴并且日期范围输入和选择输入有效时,仅显示日期范围输入和选择输入。

library(shiny)
library(timevis)

data1=data.frame(id=1:49,
            group=B_no,
            content = Alcohol,
            start = Start_Date,
            end= End_Date,
            type='point')
data2=data.frame(id=unique(B_no),content=unique(B_no),title="B_no")

ui <- bootstrapPage(
 timevisOutput("timeline"),
 dateRangeInput("daterange1","Date range", 
             start = Start_Date, end = End_Date,
             min = "01-01-2013", max = "31-12-2016",
             format="dd/mm/yy",
             separator="-"),
 selectInput("BID","BID:",B_no)
  )

 server <- function(input, output, session) {
output$timeline <- renderTimevis({
timevis(data1,data2)
})
}

shinyApp(ui = ui, server = server)

2 个答案:

答案 0 :(得分:0)

这是我的数据

> data1
  id      group content     start       end  type
1   1 AB12457869 Non_Alc 31-Jul-13 02-Aug-13 point
2   2 AB12457869 Non_Alc 20-Aug-14 22-Aug-14 point
3   3 AB56854278 Non_Alc 28-May-14 01-Jun-14 point
4   4 AB56854278     Alc 21-Jan-15 24-Jan-15 point
5   5 AB56854278 Non_Alc 05-Jun-16 16-Jun-16 point
6   6 AB56854278 Non_Alc 20-Jun-16 22-Jun-16 point
7   7 AB45248456     Alc 20-Jan-14 22-Jan-14 point
8   8 AB45248456 Non_Alc 11-Nov-14 15-Nov-14 point
9   9 AB45248456 Non_Alc 12-Mar-15 22-Mar-15 point
10 10 AB45248456     Alc 24-Jun-15 28-Aug-15 point
11 11 AB45248456 Non_Alc 22-Dec-15 25-Dec-15 point
12 12 AB45248456     Alc 20-Jun-16 22-Aug-16 point
13 13 AB33562487 Non_Alc 15-Apr-14 18-Apr-14 point
14 14 AB33562487     Alc 10-Jul-15 18-Jul-15 point
15 15 AB33562487     Alc 15-Dec-15 18-Dec-15 point
16 16 AB33562487 Non_Alc 04-Apr-16 07-Apr-16 point
17 17 AB74147145 Non_Alc 12-Aug-15 14-Aug-15 point
18 18 AB74147145     Alc 13-Jun-16 14-Jun-16 point
19 19 AB25455145 Non_Alc 22-May-13 25-May-13 point
20 20 AB25455145     Alc 20-Jun-15 24-Jun-15 point
21 21 AB25455145     Alc 08-Oct-16 12-Oct-16 point
22 22 AB12452345     Alc 16-May-15 19-Jun-15 point
23 23 AB12452345     Alc 03-Feb-14 03-Mar-14 point
24 24 AB12451234 Non_Alc 18-Apr-16 29-Apr-16 point
25 25 AB12452355     Alc 01-Dec-14 31-Dec-14 point
26 26 AB12452355     Alc 01-Feb-15 06-Feb-15 point
27 27 AB12452465 Non_Alc 16-Sep-15 30-Sep-15 point
28 28 AB12452987     Alc 01-Apr-14 05-Apr-14 point
29 29 AB12452987     Alc 12-Aug-13 18-Aug-13 point
30 30 AB12452987     Alc 21-Aug-14 29-Aug-14 point
31 31 LC47295639 Non_Alc 31-Jul-13 02-Aug-13 point
32 32 LC47295639 Non_Alc 20-Aug-14 22-Aug-14 point
33 33 LC47295639 Non_Alc 30-Oct-14 05-Nov-14 point
34 34 JH50729563 Non_Alc 21-Oct-15 27-Oct-15 point
35 35 JH50729563     Alc 29-Nov-15 05-Dec-15 point
36 36 CV11129477     Alc 07-May-13 11-May-13 point
37 37 GB99947732 Non_Alc 26-Mar-14 01-Apr-14 point
38 38 GB99947732     Alc 22-Jun-14 01-Jul-14 point
39 39 GB99947732 Non_Alc 26-Dec-14 03-Jan-15 point
40 40 KL28757383 Non_Alc 11-Aug-14 14-Aug-14 point
41 41 KL28757383 Non_Alc 11-Aug-14 14-Aug-14 point
42 42 KL28757383 Non_Alc 30-Nov-14 14-Dec-14 point
43 43 KL28757383     Alc 01-Feb-15 09-Feb-15 point
44 44 KL28757383     Alc 11-Apr-15 14-Apr-15 point
45 45 KL28757383 Non_Alc 29-Jul-15 06-Aug-15 point
46 46 LO44447288     Alc 15-Jun-13 20-Jun-13 point
47 47 LO44447288     Alc 11-Aug-13 14-Aug-13 point
48 48 LO44447288     Alc 29-Dec-13 10-Jan-14 point
49 49 LO44447288 Non_Alc 08-Mar-14 14-Mar-14 point
> data2
       id    content title
       1  AB12457869 AB12457869  B_no
       2  AB56854278 AB56854278  B_no
       3  AB45248456 AB45248456  B_no
       4  AB33562487 AB33562487  B_no
       5  AB74147145 AB74147145  B_no
       6  AB25455145 AB25455145  B_no
       7  AB12452345 AB12452345  B_no
       8  AB12451234 AB12451234  B_no
       9  AB12452355 AB12452355  B_no
       10 AB12452465 AB12452465  B_no
       11 AB12452987 AB12452987  B_no
       12 LC47295639 LC47295639  B_no
       13 JH50729563 JH50729563  B_no
       14 CV11129477 CV11129477  B_no
       15 GB99947732 GB99947732  B_no
       16 KL28757383 KL28757383  B_no
       17 LO44447288 LO44447288  B_no

答案 1 :(得分:0)

将数据放入dput()

时没有任何反应