dreamRs / esquisse

RStudio add-in to make plots interactively with ggplot2
https://dreamrs.github.io/esquisse
Other
1.78k stars 229 forks source link

[Feature Request] dragulaInput arrange outputs in grid #123

Closed JamesBrownSEAMS closed 3 years ago

JamesBrownSEAMS commented 4 years ago

It would be useful to be able to specify how many rows the outputs of the dragulaInput module were spread over to avoid overcrowding the UI element. In a recent example I had 8 outputs but I was not able to assign useful names without them being obscured by the decreased width of each box. It would be ideal to be able to split them over multiple rows to avoid this issue. For example, convert this: image to this: image From a visual perspective in the case of uneven contents of each row, consistent box dimentions would be prefereable, for example: image Rather than: image

pvictor commented 4 years ago

Hello,

Very interesting, this should be doable with a CSS grid (https://cssgrid-generator.netlify.app/), I'll look into it.

Victor

pvictor commented 4 years ago

Hello,

If you install dev version, you can try:

library(shiny)
library(esquisse)

ui <- fluidPage(
  tags$h2("Demo dragulaInput"),
  tags$br(),
  fluidRow(
    column(
      width = 6,

      dragulaInput(
        inputId = "dad1",
        label = "Default:",
        sourceLabel = "Source",
        targetsLabels = c("Target 1", "Target 2"),
        choices = month.abb,
        width = "100%"
      ),
      verbatimTextOutput(outputId = "result1"),

      tags$br(),

      dragulaInput(
        inputId = "dad3",
        label = "On same row:",
        sourceLabel = "Source",
        targetsLabels = c("Target 1", "Target 2"),
        choices = month.abb,
        width = "100%",
        ncolSource = 1,
        ncolGrid = 3
      ),
      verbatimTextOutput(outputId = "result3")
    ),

    column(
      width = 6,
      dragulaInput(
        inputId = "dad2",
        label = "Two rows:",
        sourceLabel = "Source",
        targetsLabels = c("x", "y", "color", "fill", "size", "facet"),
        choices = names(mtcars),
        width = "100%",
        ncolGrid = 3
      ),
      verbatimTextOutput(outputId = "result2"),

      tags$br(),

      dragulaInput(
        inputId = "dad4",
        label = "Two rows not filled:",
        sourceLabel = "Source",
        targetsLabels = c("x", "y", "color", "fill", "size"),
        choices = names(mtcars),
        width = "100%",
        ncolGrid = 3
      ),
      verbatimTextOutput(outputId = "result4")
    )
  )
)

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

  output$result1 <- renderPrint(str(input$dad1))

  output$result2 <- renderPrint(str(input$dad2))

  output$result3 <- renderPrint(str(input$dad3))

  output$result4 <- renderPrint(str(input$dad4))

}

if (interactive())
  shinyApp(ui = ui, server = server)

Which gives:

image

Victor

JamesBrownSEAMS commented 4 years ago

This is great, I'll download the dev version and see how it integrates into my application.

Thanks for the update