tests/general_tests.R

library(shiny)
library(ECShiny)

df <- data.frame(
  ano = c(2000:2004),
  total = runif(5)
)

ui <- fluidPage(

  fluidRow(
    column(4,
      echartOutput("b1",height = 350)
    ),
    column(4,
           echartOutput("b2",height = 350)
    ),
    column(4,
           echartOutput("b3",height = 350)
    ),
    column(6,
           echartOutput("b4",height = 500)
    ),
    column(6,
           echartOutput("b5",height = 500)
    ),
    column(12,
           echartOutput("b6")
    )
  )

)

server <- function(input, output, session) {

  output$b1 <- renderEchart({

    eBar(
      data = df,
      x = "ano",
      xdate = "text",
      y = "total",
      yaxis = "value",
      label = list(show=TRUE,position="top"),
      yformat = list(prefix="R$ ",decimals=2),
      slider=list(x=TRUE),
      title = "Título",
      subtitle = "subtítulo"
    )

  })

  output$b2 <- renderEchart({

    eBar(
      data = df,
      x = "ano",
      xdate = "text",
      y = "total",
      yaxis = "value",
      label = list(show=TRUE,position="top"),
      yformat = list(prefix="R$ ",decimals=2),
      slider=list(x=TRUE),
      title = "Título",
      subtitle = "subtítulo"
    )

  })

  output$b3 <- renderEchart({

    eBar(
      data = df,
      x = "ano",
      xdate = "text",
      y = "total",
      yaxis = "value",
      label = list(show=TRUE,position="top"),
      yformat = list(prefix="R$ ",decimals=2),
      slider=list(x=TRUE),
      title = "Título",
      subtitle = "subtítulo"
    )

  })

  output$b4 <- renderEchart({

    eBar(
      data = df,
      x = "ano",
      xdate = "text",
      y = "total",
      yaxis = "value",
      label = list(show=TRUE,position="top"),
      yformat = list(prefix="R$ ",decimals=2),
      slider=list(x=TRUE),
      title = "Título",
      subtitle = "subtítulo"
    )

  })

  output$b5 <- renderEchart({

    eBar(
      data = df,
      x = "ano",
      xdate = "text",
      y = "total",
      yaxis = "value",
      label = list(show=TRUE,position="top"),
      yformat = list(prefix="R$ ",decimals=2),
      slider=list(x=TRUE),
      title = "Título",
      subtitle = "subtítulo"
    )

  })

  output$b6 <- renderEchart({

    eBar(
      data = df,
      x = "ano",
      xdate = "text",
      y = "total",
      yaxis = "value",
      label = list(show=TRUE,position="top"),
      yformat = list(prefix="R$ ",decimals=2),
      slider=list(x=TRUE),
      title = "Título",
      subtitle = "subtítulo"
    )

  })



}

shinyApp(ui, server)
lemaufpb/ECShiny documentation built on July 20, 2018, 3:37 p.m.