File tree 5 files changed +36
-65
lines changed
UN_Advanced/shinyapps/chelsea
UN_Simple/shinyapps/chelsea 5 files changed +36
-65
lines changed Original file line number Diff line number Diff line change 1
- # # Make histogram of movie ratings
2
-
3
- # # Add data
4
- # This example is using the movies data (built into ggplot)
1
+ # server.R
5
2
x = movies $ rating
6
3
minx = min(x )
7
4
maxx = max(x )
8
5
9
6
shinyServer(function (input , output ) {
10
7
output $ trendPlot <- renderGraph({
11
- # pull number of bins from the ui
12
8
bins <- input $ bins
13
-
14
- # draw the histogram with
15
- # the specified number of bins
16
- trace1 <- list (
17
- x = x ,
18
- autobinx = FALSE ,
19
- xbins = list (
20
- start = minx ,
21
- end = maxx ,
22
- size = ((maxx - minx )/ bins )
23
- ),
24
- type = " histogram"
25
- )
26
-
27
- # define data
9
+ trace1 <- list (x = x ,
10
+ autobinx = FALSE ,
11
+ xbins = list (start = minx ,
12
+ end = maxx ,
13
+ size = ((maxx - minx )/ bins )
14
+ ),
15
+ type = " histogram"
16
+ )
17
+
28
18
data <- list (trace1 )
29
- # define layout information
30
- layout <- list (xaxis =
19
+ layout <- list (xaxis =
31
20
list (title = " Ratings" ,
32
- range = c(minx , maxx ),
33
- autorange = FALSE ,
34
- autotick = FALSE ,
35
- tick0 = minx ,
36
- dtick = ((maxx - minx )/ bins )) )
37
-
38
- # This sends message up to the browser client, which will get fed through to
39
- # Plotly's javascript graphing library embedded inside the graph
21
+ range = c(minx , maxx ),
22
+ autorange = FALSE ,
23
+ autotick = FALSE ,
24
+ tick0 = minx ,
25
+ dtick = ((maxx - minx )/ bins )
26
+ )
27
+ )
28
+
40
29
return (list (
41
- list (
42
- id = " trendPlot" ,
43
- task = " newPlot" ,
44
- data = data ,
45
- layout = layout
46
- )
30
+ list (id = " trendPlot" ,
31
+ task = " newPlot" ,
32
+ data = data ,
33
+ layout = layout
34
+ )
47
35
))
48
36
})
49
37
})
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
- # Define UI for application that draws a histogram
1
+ # ui.R
2
2
shinyUI(fluidPage(
3
-
4
- # Application title
5
- titlePanel(" Movie Ratings!" ),
6
-
7
- # Sidebar with a slider input for the number of bins
8
- sidebarLayout(
9
- sidebarPanel(
10
- sliderInput(" bins" ,
11
- " Number of bins:" ,
12
- min = 1 ,
13
- max = 50 ,
14
- value = 10 )
15
- ),
16
-
17
- # Show a plot of the generated distribution
3
+ titlePanel(" Movie Ratings!" ),
4
+ sidebarLayout(
5
+ sidebarPanel(
6
+ sliderInput(" bins" ,
7
+ " Number of bins:" ,
8
+ min = 1 ,
9
+ max = 50 ,
10
+ value = 10
11
+ )
12
+ ),
18
13
mainPanel(
19
- graphOutput(" trendPlot" )
14
+ graphOutput(" trendPlot" )
20
15
)
21
16
)
22
17
))
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments