Title: | XY Controller for 'Shiny' |
---|---|
Description: | Provides an XY pad input for the 'Shiny' framework. An XY pad is like a bivariate slider. It allows to pick up a pair of numbers. |
Authors: | Stéphane Laurent [aut, cre], Anthony Terrien [cph] ('jqueryKontrol library') |
Maintainer: | Stéphane Laurent <[email protected]> |
License: | GPL-3 |
Version: | 0.2.0 |
Built: | 2024-11-17 03:39:32 UTC |
Source: | https://github.com/stla/shinyxypad |
Changes a XY pad input on the client.
updateXYpadInput( session, inputId, label = NULL, value = NULL, xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL, ndecimals = NULL, bgColor = NULL, pointColor = NULL, pointRadius = NULL )
updateXYpadInput( session, inputId, label = NULL, value = NULL, xmin = NULL, xmax = NULL, ymin = NULL, ymax = NULL, ndecimals = NULL, bgColor = NULL, pointColor = NULL, pointRadius = NULL )
session |
session object passed to the Shiny server function |
inputId |
id of the XY pad input |
label |
new label, or |
value |
new value, or |
xmin |
new |
xmax |
new |
ymin |
new |
ymax |
new |
ndecimals |
new |
bgColor |
new |
pointColor |
new |
pointRadius |
new |
No value is returned, called for side-effect.
library(shiny) library(shinyXYpad) ui <- fluidPage( fluidRow( column(6, XYpadInput("xy", onMove = TRUE, label = "XY pad")), column(6, verbatimTextOutput("xyvalue")) ), br(), actionButton("update", "Update") ) server <- function(input, output, session){ output[["xyvalue"]] <- renderPrint({ input[["xy"]] }) observeEvent(input[["update"]], { updateXYpadInput(session, "xy", value = list(x = 25, y = 25), bgColor = "chartreuse", pointColor = "yellow", pointRadius = 10, ndecimals = 3) }) } if(interactive()){ shinyApp(ui, server) }
library(shiny) library(shinyXYpad) ui <- fluidPage( fluidRow( column(6, XYpadInput("xy", onMove = TRUE, label = "XY pad")), column(6, verbatimTextOutput("xyvalue")) ), br(), actionButton("update", "Update") ) server <- function(input, output, session){ output[["xyvalue"]] <- renderPrint({ input[["xy"]] }) observeEvent(input[["update"]], { updateXYpadInput(session, "xy", value = list(x = 25, y = 25), bgColor = "chartreuse", pointColor = "yellow", pointRadius = 10, ndecimals = 3) }) } if(interactive()){ shinyApp(ui, server) }
Creates a XY pad controller to be included in a Shiny UI.
XYpadInput( inputId, label = NULL, value = list(x = 50, y = 50), xmin = 0, xmax = 100, ymin = 0, ymax = 100, ndecimals = 2, width = 200, height = 200, bgColor = "rgba(255,200,200,0.2)", xyColor = "blue", xySize = 11, xyStyle = "italic", coordsColor = xyColor, pointColor = "#16235a", pointRadius = 5, border = "2px solid #777CA8", x = "x", y = "y", displayPrevious = TRUE, displayXY = TRUE, onMove = FALSE )
XYpadInput( inputId, label = NULL, value = list(x = 50, y = 50), xmin = 0, xmax = 100, ymin = 0, ymax = 100, ndecimals = 2, width = 200, height = 200, bgColor = "rgba(255,200,200,0.2)", xyColor = "blue", xySize = 11, xyStyle = "italic", coordsColor = xyColor, pointColor = "#16235a", pointRadius = 5, border = "2px solid #777CA8", x = "x", y = "y", displayPrevious = TRUE, displayXY = TRUE, onMove = FALSE )
inputId |
the input slot that will be used to access the value |
label |
label for the XY pad, or |
value |
the initial value, a list of two numbers named |
xmin , xmax
|
minimal x-value and maximal x-value |
ymin , ymax
|
minimal y-value and maximal y-value |
ndecimals |
number of decimals of the displayed coordinates (if |
width |
a positive number, the width in pixels |
height |
a positive number, the height in pixels |
bgColor |
background color, a HTML color; you have to set some transparency in order to see the coordinates |
xyColor |
color of the labels of the coordinates (if |
xySize |
font size of the labels of the coordinates (if |
xyStyle |
font style of the labels of the coordinates (if |
coordsColor |
color of the displayed coordinates (if |
pointColor |
color of the point, a HTML color |
pointRadius |
radius of the point in pixels |
border |
CSS for the border of the XY pad |
x |
label of the x-coordinate (if |
y |
label of the y-coordinate (if |
displayPrevious |
logical, whether to display the previous position of the point |
displayXY |
logical, whether to display the coordinates |
onMove |
logical, whether to send value to server on mouse move
( |
A shiny.tag.list
object generating a XY pad input control that
can be added to a Shiny UI definition.
updateXYpadInput
for updating the XY pad on server-side.
library(shiny) library(shinyXYpad) ui <- fluidPage( fluidRow( column( 6, XYpadInput("xy1", onMove = TRUE, label = "XY pad - on move") ), column( 6, XYpadInput( "xy2", label = "XY pad - on release", displayXY = FALSE, displayPrevious = FALSE ) ) ), fluidRow( column(6, verbatimTextOutput("xy1value")), column(6, verbatimTextOutput("xy2value")) ) ) server <- function(input, output, session){ output[["xy1value"]] <- renderPrint({ input[["xy1"]] }) output[["xy2value"]] <- renderPrint({ input[["xy2"]] }) } if(interactive()){ shinyApp(ui, server) }
library(shiny) library(shinyXYpad) ui <- fluidPage( fluidRow( column( 6, XYpadInput("xy1", onMove = TRUE, label = "XY pad - on move") ), column( 6, XYpadInput( "xy2", label = "XY pad - on release", displayXY = FALSE, displayPrevious = FALSE ) ) ), fluidRow( column(6, verbatimTextOutput("xy1value")), column(6, verbatimTextOutput("xy2value")) ) ) server <- function(input, output, session){ output[["xy1value"]] <- renderPrint({ input[["xy1"]] }) output[["xy2value"]] <- renderPrint({ input[["xy2"]] }) } if(interactive()){ shinyApp(ui, server) }