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
use snapper to save to png? #392
Comments
It may be that the layers of svg are getting ignored. I had a similar issue when snapping leaflets. This was my solution there: snapper::preview_button(
ui = '#myMap',
opts = snapper::config(
allowTaint = TRUE,
useCORS = TRUE)
) |
this works fine for me library(shiny)
library(DiagrammeR)
library(snapper)
ui = fluidPage(
snapper::load_snapper(),
snapper::preview_button(
ui = '#diagram',
opts = snapper::config(scale = 1)
),
grVizOutput('diagram'),
snapper::snapper_div()
)
server = function(input, output) {
output$diagram <- renderGrViz({
grViz("digraph {A;}")
})
}
shinyApp(ui, server)
ui2 <- fluidPage(
snapper::load_snapper(),
snapper::preview_button(ui = '#dg',opts = snapper::config(scale = 1)),
grVizOutput("dg"),
verbatimTextOutput("print"),
snapper::snapper_div()
)
server2 <- function(input, output, session) {
output$dg <- renderGrViz({
grViz("
digraph a_nice_graph {
# node definitions with substituted label text
node [fontname = Helvetica]
a [label = '@@1']
b [label = '@@2-1']
c [label = '@@2-2']
d [label = '@@2-3']
e [label = '@@2-4']
f [label = '@@2-5']
g [label = '@@2-6']
h [label = '@@2-7']
i [label = '@@2-8']
j [label = '@@2-9']
# edge definitions with the node IDs
a -> {b c d e f g h i j}
}
[1]: 'top'
[2]: 10:20
")
})
txt <- reactive({
req(input$dg_click)
nodeval <- input$dg_click$nodeValues[[1]]
return(paste(nodeval, " is clicked"))
})
output$print <- renderPrint({
txt()
})
}
shinyApp(ui2, server2) |
Thanks @yonicd! I mainly use the
|
these look like similar issues |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In case you haven't seen it yet, snapper looks like a really cool package that creates png screenshots of shiny-apps and, hopefully, Diagrammer plots (incl. mermaid). It doesn't quit seem to be working correctly with SVG but perhaps you have some suggestions?
cc-ing @yonicd
The text was updated successfully, but these errors were encountered: