library(ggvis)
library(DT)
library(shinydashboard)
library(shiny)
library(dplyr)
#########################################################
#Loading R data
########################################################
load("packagedetail.Rdata")
#########################################################
#begin ui
#########################################################
ui <- dashboardPage(dashboardHeader(dropdownMenuOutput("bigSizeAlert"),title="Package Cycle Time",titleWidth=400),
dashboardSidebar(
br(),
dateRangeInput('dateRange',
label = 'Date range input: yyyy-mm-dd',
start = Sys.Date() - 2, end = Sys.Date() + 2
),
selectizeInput("parentcompany", "ParentCo", choices=unique(as.character(mydfsummary$parentcompany)),multiple=FALSE,selected = "" ),
selectizeInput("brand", "Brand", choices=unique(as.character(mydfsummary$brand)),multiple=TRUE,selected = "" ),
selectizeInput("State","State", choices=unique(as.character(mydfsummary$State)),multiple=TRUE,selected = "" ),
selectizeInput("ShippingZone", "Shipping Zone", choices=unique(as.character(mydfsummary$ShippingZone)),multiple=TRUE,selected = "" ),
width=400),
# guess I spoke too soon when I said couldn't be the hr()!!
# hr(),
dashboardBody(
tags$head(
tags$link(rel = "stylesheet", type = "text/css", href = "custom.css")
),
fluidRow(
box(
tags$img(src="NGS_logo.png",height="57px")
,width=3, height="100%",background = "black",solidHeader = TRUE)
),
fluidRow( tabBox(
tabPanel("Package Detail"
, ggvisOutput("ggvis_deliverydata")
),
title="",id="mainBox",width=12, height = 500
)
)
)
)
#)
#################################################################################
# Enter Svr Fuction
#################################################################################
server <- shinyServer(function(input, output) {
options(shiny.error=recover)
#
# ## i think i want this to be a reactive function
deliverydata <- reactive({
deliverydatadf <- mydfsummary %>%
filter(parentcompany == "test"
,brand == "test"
,State == "test"
,ShippingZone == "test"
)
return(deliverydatadf)
})
#################################################################################
# Basic Stacked Bar Chart Delivered versus non-delivered
#################################################################################
ggvis_deliverydata <- renderPlot({
deliverydatadf() %>%
ggvis( y = ~PackageCounter
, x = ~InductionScanDateKey2
, fill = ~PackageStatus
) %>%
group_by(PackageStatus) %>%
layer_bars() %>%
set_options(width = 300, height = 300) %>%
bind_shiny("ggvis_deliverydata")
})
###########################################################################
## this is the end of the ouput function ################
###########################################################################
})
shinyApp(ui=ui,server=server)