File size: 2,677 Bytes
44e13d1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
817bc41
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
library(shiny)
library(shinythemes)
library(readxl)
library(ggplot2)
motor_data <- read_excel("/india_vehicle_sales_trends.xlsx")
ui <- fluidPage(
  theme = shinytheme("cyborg"),
  #shinythemes::themeSelector(),
               navbarPage(
                  "Wikki Zygote",
                  tabPanel("Home",
                              sidebarPanel(
                                tags$h3("Input:"),
                                textInput("txt1", "Given Name:", ""),
                                textInput("txt2", "Surname:", ""),
                                tags$p("Play around this input boxes, its fun which covers concept of Reactive expressions in Shiny R")
                              ), #sidebar panel
                              mainPanel(
                                h1("Welcome to Wikki Zygote"),
                                verbatimTextOutput("txtout"),
                              ) #main panel
                  ), #panel 1 end 
                  tabPanel("Motor Sales India",
                           sidebarLayout(
                             sidebarPanel(
                               tags$p("This is a bar plot against Indian Motor sales from 2010 to 2019 using Shiny R library")
                             ),
                             mainPanel(
                               plotOutput(outputId = "distPlot")
                           ),
                           
                           )
                           ),
                  tabPanel("Dashboard", "This panel is under development"),
                  tabPanel("About me", 
                           "Wikki Zygote Web application using Shiny R")
                )
)

server <- function(input, output){
  output$txtout <- renderText({
    paste(input$txt1, input$txt2, sep = " ")
  })
  output$distPlot <- renderPlot({
    
#    x <- motor_data$`Total (million)`
#    bins <- seq(min(x), max(x), length.out = input$bins + 1)
    
#    hist(x, breaks = bins, col = "blue", border = "black",
#         xlab = "Sales",
#         main = "Histogram of Indian Motor Sales")
    
#    hist(x, 
#         main = "Histogram of Total Vehicle Production",
#         xlab = "Total Vehicle Production (Millions)",
#         col = "lightblue",
#         border = "black")
    
    #bar plot
    ggplot(motor_data, aes(x = Year, y = `Total (million)`)) +
      geom_bar(stat = "identity", fill = "steelblue") +
      scale_y_continuous(breaks = seq(0, 26, by = 2), labels = seq(0, 26, by = 2)) +
      labs(title = "Passenger Vehicle Production Over the Years",
           x = "Year",
           y = "Production (Millions)")
  })
}

shinyApp(ui = ui, server = server)