Skip to content

Commit

Permalink
Turn off save as png for charts
Browse files Browse the repository at this point in the history
  • Loading branch information
cjrace committed Jul 20, 2024
1 parent 02ed547 commit 992aa4d
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 67 deletions.
12 changes: 9 additions & 3 deletions server.R
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ server <- function(input, output, session) {
renderGirafe({
girafe(
ggobj = create_avg_rev_timeseries(reactive_rev_bal(), input$selectArea),
options = list(opts_sizing(rescale = TRUE, width = 1.0)),
options = list(
opts_sizing(rescale = TRUE, width = 1.0),
opts_toolbar(saveaspng = FALSE)
),
width_svg = 9.6,
height_svg = 5.0
)
Expand Down Expand Up @@ -213,7 +216,10 @@ server <- function(input, output, session) {
renderGirafe({
girafe(
ggobj = plot_avg_rev_benchmark(reactive_benchmark()),
options = list(opts_sizing(rescale = TRUE, width = 1.0)),
options = list(
opts_sizing(rescale = TRUE, width = 1.0),
opts_toolbar(saveaspng = FALSE)
),
width_svg = 5.0,
height_svg = 5.0
)
Expand Down Expand Up @@ -425,7 +431,7 @@ server <- function(input, output, session) {
paste0("Current selections: ", input$selectPhase, ", ", input$selectArea)
})

# Stop app -------------------------------------------------------------------
# Stop app ------------------------------------------------------------------

session$onSessionEnded(function() {
stopApp()
Expand Down
99 changes: 46 additions & 53 deletions tests/testthat/test-Server-01-reactive_benchmark.R
Original file line number Diff line number Diff line change
@@ -1,53 +1,46 @@
# # -----------------------------------------------------------------------------
# # This is an example integration test file
# #
# # Integration tests in Shiny allow you to test the server.R reactivity without
# # needing to load a full app and interact with the UI.
# #
# # This makes integration tests faster to run than UI tests and makes them a
# # more efficient alternative if you don't need to interact with the UI to test
# # what you want to.
# #
# # These examples show some ways you can make use of integration tests.
# #
# # Add more scripts and checks as appropriate for your app.
# # -----------------------------------------------------------------------------
# testServer(expr = {
# # Give the inputs expected on initial load
# session$setInputs(
# navlistPanel = "dashboard",
# region = "England",
# selectPhase = "All local authority maintained schools",
# tabsetpanels = "Benchmark example",
# selectBenchLAs = ""
# )
#
# # Check the reactive benchmark value is a valid number
# #expect_true(grepl("^\\d*$", reactive_benchmark()))
#
# # Check the output has expected number of rows for benchmark table
# #expect_equal(nrow(output$tabBenchmark), 1)
#
# # Change to a different dropdown selection
# session$setInputs(
# navlistPanel = "dashboard",
# region = "North East",
# selectPhase = "Secondary",
# tabsetpanels = "Benchmarking example",
# selectBenchLAs = c("Barnsley", "Doncaster")
# )
#
#
# # Check the reactive benchmark table is a valid number
# # expect_true(grepl("^\\d*$", reactive_benchmark()))
#
# print(reactive_benchmark())
# print(output$tabBenchmark)
#
# reac_benc_tab <<- output$tabBenchmark
#
# # Check the output has expected number of rows for benchmark table
# expect_equal(nrow(reactive_benchmark()), 3)
#
#
# })
# -----------------------------------------------------------------------------
# This is an example integration test file
#
# Integration tests in Shiny allow you to test the server.R reactivity without
# needing to load a full app and interact with the UI.
#
# This makes integration tests faster to run than UI tests and makes them a
# more efficient alternative if you don't need to interact with the UI to test
# what you want to.
#
# These examples show some ways you can make use of integration tests.
#
# Add more scripts and checks as appropriate for your app.
# -----------------------------------------------------------------------------
testServer(expr = {
# Give the inputs expected on initial load
session$setInputs(
navlistPanel = "dashboard",
region = "England",
selectPhase = "All local authority maintained schools",
tabsetpanels = "Benchmark example",
selectBenchLAs = ""
)

# Check the reactive benchmark value is a valid number
# not currently running expect_true(grepl("^\\d*$", reactive_benchmark()))

# Check the output has expected number of rows for benchmark table
# not currently running expect_equal(nrow(output$tabBenchmark), 1)

# Change to a different dropdown selection
session$setInputs(
navlistPanel = "dashboard",
region = "North East",
selectPhase = "Secondary",
tabsetpanels = "Benchmarking example",
selectBenchLAs = c("Barnsley", "Doncaster")
)


# Check the reactive benchmark table is a valid number
# not currently running expect_true(grepl("^\\d*$", reactive_benchmark()))

# Check the output has expected number of rows for benchmark table
# not currently running expect_equal(nrow(reactive_benchmark()), 3)
})
13 changes: 2 additions & 11 deletions ui.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,10 @@
#
# http://shiny.rstudio.com/
#
# -----------------------------------------------------------------------------

#
# This is the user-interface definition of a Shiny web application. You can
# run the application by clicking 'Run App' above.
#
# Find out more about building applications with Shiny here:
#
# http://shiny.rstudio.com/
#
# The documentation for this GOVUK components can be found at:
# The documentation for GOV.UK components can be found at:
#
# https://github.com/moj-analytical-services/shinyGovstyle
#
# -----------------------------------------------------------------------------
ui <- function(input, output, session) {
fluidPage(
Expand Down

0 comments on commit 992aa4d

Please sign in to comment.