forked from rucliyang/Intro2ds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchap11-sentiment-ui.R
132 lines (131 loc) · 4.13 KB
/
chap11-sentiment-ui.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
dashboardPage(
dashboardHeader(title = "舆情系统示例"), #设置总标题
#设置菜单中各个模块的布局(从上到下)
dashboardSidebar(
sidebarMenu(
menuItem("主页", #模块名称
tabName = "homepage", #模块在代码中的对象名
icon = icon("file") #图标
),
menuItem("舆情监测", #模块名称
icon = icon("line-chart"), #图标
menuSubItem("情感动态", #子模块名称
tabName = "yuqing-mot" #子模块对象名
),
menuSubItem("情感走势",
tabName = "yuqing-con"),
menuSubItem("信息详情",
tabName = "yuqing-sum")
),
menuItem("设置",
icon = icon("line-chart"),
menuSubItem("监控词设置",
tabName = "setting-keyword"),
menuSubItem("爬虫监控",
tabName = "setting-source")
)
)
),
#每一个模块的具体内容
dashboardBody(
#每一个tabItem代指一个模块,由上面定义的对象名唯一确定
tabItems(
tabItem(tabName = "homepage", #对应“主页”
#fluidRow将页面分成了不同的行
fluidRow(
br(),
#fluidRow内部可以用column来分列
column(offset = 1, width = 10,
#输入日期
dateInput("date1", "日期:",
value = "2017-06-01",
min = "2017-01-01",
max = "2017-12-31",
format = "yyyy-mm-dd"))
),
fluidRow(
br(),
column(offset = 1, width = 5,
#输出server端的表格stat3
DT::dataTableOutput('stat3')),
column(br(),br(), width = 5,
#输出server端的词云图wordcloud1
wordcloud2::wordcloud2Output('wordcloud1', width = "100%", height = "600px"))
)
),
tabItem(tabName = "yuqing-sum", #对应“信息详情”
fluidRow(
br(),
column(offset = 1, width = 8,
DT::dataTableOutput('sum1'))
)
),
tabItem(tabName = "yuqing-con", #对应“情感走势”
fluidRow(
br(),
column(offset = 1, width = 8,
#输出server端所绘的线图line1
recharts::eChartOutput('line1'))
),
fluidRow(
br(),
column(offset = 1, width = 8,
#输出server端所绘的线图line2
recharts::eChartOutput('line2'))
)
),
tabItem(tabName = "yuqing-mot", #对应“情感动态”
fluidRow(
br(),br(),
column(offset = 1, width = 8,
#输出server端所绘的气泡图line3
plotly::plotlyOutput('line3'))
),
fluidRow(
br(),
column(offset = 1, width = 8,
#创建滑动型输入,输入所绘气泡图对应的时间点
sliderInput("slide1", "",
min = as.Date("2017-01-05"),
max = as.Date("2017-06-27"),
value = as.Date("2017-01-05"),
width = 1000))
)
),
tabItem(tabName = "setting-keyword", #对应“监控词设置”
fluidRow(
br(),
column(offset = 1, width = 3,
#创建文本型输入,用于添加监控词
textInput("keywordin1", "添加监控词:", "")),
column(br(), width = 1,
#创建“提交”按钮
actionButton("button1", "提交"))
),
fluidRow(
br(),
column(offset = 1, width = 9,
#输入server端的表格keyword1,显示已提交的监控词
DT::dataTableOutput('keyword1'))
)
),
tabItem(tabName = "setting-source", #对应“爬虫监控”
fluidRow(
br(),
column(offset = 1, width = 4,
#输出server端的更新时间图
recharts::eChartOutput('gauge1')),
column(width = 4,
#输出server端的媒体分布图
recharts::eChartOutput('gauge12'))
),
fluidRow(
br(),
column(offset = 1, width = 9,
#输出server端的表格crawler3
DT::dataTableOutput('crawler3'))
)
)
)
)
)