Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nanoplots do not shade area beneath when on second tab #1601

Open
joeycouse opened this issue Mar 7, 2024 · 1 comment
Open

Nanoplots do not shade area beneath when on second tab #1601

joeycouse opened this issue Mar 7, 2024 · 1 comment

Comments

@joeycouse
Copy link

Bug where nanoplots area are not shaded when on the second tab. Believe the issue is related to the fill = url(#area-pattern) argument not being found when the plot is a on a separate tab.

library(shiny)
library(bslib)
#> 
#> Attaching package: 'bslib'
#> The following object is masked from 'package:utils':
#> 
#>     page
library(gt)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union


# Define the UI
ui <- fluidPage(
      navset_card_underline(
        nav_panel("table1",gt_output("table1")),
        nav_panel("table2",gt_output("table2"))
      )
)


# Define the server code
server <- function(input, output) {
  
  output$table1 <- render_gt(
    mtcars |> 
      head(10) |> 
      mutate(hp_1 = hp +1,
             hp_2 = hp + 3) |> 
      gt() |> 
      cols_nanoplot(columns = starts_with("hp"))
  )

  output$table2 <- render_gt(
    mtcars |> 
      head(10) |> 
      mutate(hp_1 = hp +1,
             hp_2 = hp + 3) |> 
      gt() |> 
      cols_nanoplot(columns = starts_with("hp"))
  )
  
}

# Return a Shiny app object
shinyApp(ui = ui, server = server)
Shiny applications not supported in static R Markdown documents

Created on 2024-03-07 with reprex v2.0.2

Screen.Recording.2024-03-07.at.11.12.48.AM.mov
@rich-iannone
Copy link
Member

Thank you for reporting this issue! I could definitely add a fix for this quite soon. Note to self: it probably would be best to have a uniquely generated ID for each instance of the the fill pattern (then refer to that ID within the SVG content).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Next / Ready for Dev
Development

No branches or pull requests

2 participants