Skip to content

Instantly share code, notes, and snippets.

@pssguy
Last active December 20, 2015 11:49

Revisions

  1. pssguy revised this gist Aug 1, 2013. 1 changed file with 11 additions and 35 deletions.
    46 changes: 11 additions & 35 deletions ui.R
    Original file line number Diff line number Diff line change
    @@ -9,59 +9,43 @@ shinyUI(pageWithSidebar(
    tags$link(rel = 'stylesheet', type = 'text/css', href = 'styles.css')),


    wellPanel(

    wellPanel(
    conditionalPanel(
    condition = "input.myPanel == 'World Rankings' && input.rankPanel == 'Player Timeline'",
    condition = "input.myPanel == 'World Rankings' && input.rankPanel == 1",
    helpText("World Ranking records of current Top 250"),
    selectInput("playerRankings","Select Player",rankingsChoice, selected="Phil Mickelson")


    ),
    conditionalPanel(
    condition = "input.myPanel == 'World Rankings' && input.rankPanel == 'Player Sequences'",
    condition = "input.myPanel == 'World Rankings' && input.rankPanel == 2",
    helpText("World Ranking records of current Top 250"),
    selectInput("playerRankings","Select Player",rankingsChoice, selected="Phil Mickelson")


    ),
    conditionalPanel(
    condition = "input.myPanel == 'World Rankings' && input.rankPanel == 'Weekly Rankings'",
    helpText("Select any Sunday back to Christmas 1988. N.B It will only show records for players
    condition = "input.myPanel == 'World Rankings' && input.rankPanel == 3",
    helpText("Select any Sunday back to Christmas 1988. N.B It will only show records for players
    still active"),
    dateInput("calendar","", value=latestDate,max=latestDate,min="1988-12-25")
    ),

    ),
    conditionalPanel(
    condition = "input.majorsPanel == 4",
    condition = "input.myPanel == 'Majors' && input.majorsPanel == 4",
    helpText("Majors Records for all 2400+ players since 1970"),
    selectInput("playerMajors2","Select Player",majorsChoice, selected="Tiger Woods")

    ),
    conditionalPanel(
    condition = "input.majorsPanel == 5",
    condition = "input.myPanel == 'Majors' && input.majorsPanel == 5",
    helpText("Majors Records for all 2400+ players since 1970"),
    selectInput("playerMajors2","Select Player",majorsChoice, selected="Tiger Woods")

    ),

    conditionalPanel(
    condition = "input.majorsPanel == 6",
    condition = "input.myPanel == 'Majors' && input.majorsPanel == 6",
    helpText("Track Players Performance by Round. Switch between position and stroke options"),
    selectInput("playerMajors","Select Player",majorsChoice, selected="Tiger Woods"),
    selectInput("tourney","Select tourney",tourneyChoice, selected="Masters") ,
    radioButtons(inputId="choice", label="Chart Type",choices=c("Stroke Difference","Position"))
    ),



    conditionalPanel(
    condition = "input.majorsPanel == 7",
    condition = "input.myPanel == 'Majors' && input.majorsPanel == 7",
    helpText("Majors LeaderBoards since 1970"),




    HTML("<table>"),
    HTML("<tr><td>"),
    selectInput("contest","",tourneyChoice, selected="Masters"),
    @@ -71,18 +55,10 @@ shinyUI(pageWithSidebar(
    numericInput("year","",2013,min=1970,max=2013 ),
    HTML("</td></tr>"),
    HTML("</table>"),

    actionButton("goButton", "New Leaderboard")
    )


    )),

    # conditionalPanel(
    # condition = "input.majorsPanel == 4",
    # chartOutput("summaryChart","highcharts"))
    #
    # ),


    mainPanel(
    tabsetPanel(
  2. pssguy revised this gist Aug 1, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions ui.R
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ shinyUI(pageWithSidebar(
    wellPanel(

    conditionalPanel(
    "input.myPanel == 'World Rankings' && input.rankPanel == 'Player Timeline'",
    condition = "input.myPanel == 'World Rankings' && input.rankPanel == 'Player Timeline'",
    helpText("World Ranking records of current Top 250"),
    selectInput("playerRankings","Select Player",rankingsChoice, selected="Phil Mickelson")

    @@ -26,7 +26,7 @@ shinyUI(pageWithSidebar(

    ),
    conditionalPanel(
    condition = "input.rankPanel == 3",
    condition = "input.myPanel == 'World Rankings' && input.rankPanel == 'Weekly Rankings'",
    helpText("Select any Sunday back to Christmas 1988. N.B It will only show records for players
    still active"),
    dateInput("calendar","", value=latestDate,max=latestDate,min="1988-12-25")
  3. pssguy revised this gist Aug 1, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ui.R
    Original file line number Diff line number Diff line change
    @@ -19,7 +19,7 @@ shinyUI(pageWithSidebar(

    ),
    conditionalPanel(
    condition = "input.rankPanel == 2",
    condition = "input.myPanel == 'World Rankings' && input.rankPanel == 'Player Sequences'",
    helpText("World Ranking records of current Top 250"),
    selectInput("playerRankings","Select Player",rankingsChoice, selected="Phil Mickelson")

  4. pssguy revised this gist Aug 1, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion ui.R
    Original file line number Diff line number Diff line change
    @@ -12,7 +12,7 @@ shinyUI(pageWithSidebar(
    wellPanel(

    conditionalPanel(
    "input.myPanel == 'World Rankings' && input.rankPanel == 'Player Timeline'"
    "input.myPanel == 'World Rankings' && input.rankPanel == 'Player Timeline'",
    helpText("World Ranking records of current Top 250"),
    selectInput("playerRankings","Select Player",rankingsChoice, selected="Phil Mickelson")

  5. pssguy revised this gist Aug 1, 2013. 1 changed file with 1 addition and 2 deletions.
    3 changes: 1 addition & 2 deletions ui.R
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,3 @@

    shinyUI(pageWithSidebar(


    @@ -13,7 +12,7 @@ shinyUI(pageWithSidebar(
    wellPanel(

    conditionalPanel(
    condition = "input.rankPanel == 1", # condition = "input.myPanel.rankPanel == 1" or myPanel=1 does not show, input.rankPanel == 1 does show but in conjunc with majprs 4/5
    "input.myPanel == 'World Rankings' && input.rankPanel == 'Player Timeline'"
    helpText("World Ranking records of current Top 250"),
    selectInput("playerRankings","Select Player",rankingsChoice, selected="Phil Mickelson")

  6. pssguy created this gist Jul 31, 2013.
    6 changes: 6 additions & 0 deletions server.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    require(shiny)

    shinyServer(function(input, output, session) {


    })
    124 changes: 124 additions & 0 deletions ui.R
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,124 @@

    shinyUI(pageWithSidebar(


    headerPanel(""),


    sidebarPanel(
    tags$head(
    tags$link(rel = 'stylesheet', type = 'text/css', href = 'styles.css')),


    wellPanel(

    conditionalPanel(
    condition = "input.rankPanel == 1", # condition = "input.myPanel.rankPanel == 1" or myPanel=1 does not show, input.rankPanel == 1 does show but in conjunc with majprs 4/5
    helpText("World Ranking records of current Top 250"),
    selectInput("playerRankings","Select Player",rankingsChoice, selected="Phil Mickelson")


    ),
    conditionalPanel(
    condition = "input.rankPanel == 2",
    helpText("World Ranking records of current Top 250"),
    selectInput("playerRankings","Select Player",rankingsChoice, selected="Phil Mickelson")


    ),
    conditionalPanel(
    condition = "input.rankPanel == 3",
    helpText("Select any Sunday back to Christmas 1988. N.B It will only show records for players
    still active"),
    dateInput("calendar","", value=latestDate,max=latestDate,min="1988-12-25")
    ),

    conditionalPanel(
    condition = "input.majorsPanel == 4",
    helpText("Majors Records for all 2400+ players since 1970"),
    selectInput("playerMajors2","Select Player",majorsChoice, selected="Tiger Woods")

    ),
    conditionalPanel(
    condition = "input.majorsPanel == 5",
    helpText("Majors Records for all 2400+ players since 1970"),
    selectInput("playerMajors2","Select Player",majorsChoice, selected="Tiger Woods")

    ),

    conditionalPanel(
    condition = "input.majorsPanel == 6",
    helpText("Track Players Performance by Round. Switch between position and stroke options"),
    selectInput("playerMajors","Select Player",majorsChoice, selected="Tiger Woods"),
    selectInput("tourney","Select tourney",tourneyChoice, selected="Masters") ,
    radioButtons(inputId="choice", label="Chart Type",choices=c("Stroke Difference","Position"))
    ),



    conditionalPanel(
    condition = "input.majorsPanel == 7",
    helpText("Majors LeaderBoards since 1970"),




    HTML("<table>"),
    HTML("<tr><td>"),
    selectInput("contest","",tourneyChoice, selected="Masters"),
    HTML("</td>"),
    # HTML("<td></td"), unsuccesful attempt to increase gap
    HTML("<td>"),
    numericInput("year","",2013,min=1970,max=2013 ),
    HTML("</td></tr>"),
    HTML("</table>"),

    actionButton("goButton", "New Leaderboard")
    )


    )),

    # conditionalPanel(
    # condition = "input.majorsPanel == 4",
    # chartOutput("summaryChart","highcharts"))
    #
    # ),

    mainPanel(
    tabsetPanel(
    tabPanel("World Rankings",
    tabsetPanel(
    tabPanel("Player Timeline", chartOutput("timeLineChart","highcharts"), value = 1),
    tabPanel("Player Sequences", chartOutput("rankChart","highcharts"), value = 2), # prob need to hae seperate conditional
    tabPanel("Weekly Rankings", chartOutput("weeklyTable","highcharts"), value = 3),
    id = "rankPanel"
    # should be datatables
    )



    ),


    tabPanel("Majors",
    tabsetPanel(
    tabPanel("Player Summaries", chartOutput("majorsTimeline","highcharts"), value = 4),
    tabPanel("Earnings", chartOutput("earningsChart","highcharts"), value = 5), # prob need to hae seperate conditional
    tabPanel("Bump Charts", chartOutput("pChart","highcharts"), value = 6),
    tabPanel("Leaderboards", h3(textOutput("lCaption")),chartOutput("leaderboard",'datatables'), value = 7),
    id = "majorsPanel"

    )



    ),


    id="myPanel"
    )

    )

    ))