Title: | Interactive Color Gradient Picker Using 'htmlwidgets' and the Modified JS Script 'jquery-gradient-picker' |
---|---|
Description: | Widget for an interactive selection and modification of a color gradient. 'gradientPickerD3' allows addition, removement and replacement of color ticks. List of numeric values will automatically translate in their corresponding tick position within the numeric range. App returns a data.frame containing tick values, colors and the positions in percent (0.0 to 1.0) for each color tick in the gradient. The original JS 'jquery-gradient-picker' was implemented by Matt Crinklaw-Vogt (nick: tantaman) <https://github.com/tantaman/>. Widget and JS modifications were done by CD. Peikert. |
Authors: | Christian D. Peikert [aut, cre] |
Maintainer: | Christian D. Peikert <[email protected]> |
License: | GPL-3 |
Version: | 0.1.0.0 |
Built: | 2025-03-24 18:22:45 UTC |
Source: | https://github.com/cranhaven/cranhaven.r-universe.dev |
Creates a widget for an interactive selection and modification of a color gradient. gradientPickerD3 allows the addition, removement and replacement of color ticks. List of numeric values will automatically translate in its corresponding tick position within the numeric range. App returns a R data.frame containing tick values, colors and the positions in percent (0.0 to 1.0) for each color tick in the gradient. The original JS 'jquery-gradient-picker' was implemented by Matt Crinklaw-Vogt. Widget and JS modifications were done by CD. Peikert.
gradientPickerD3(payload, width = NULL, height = NULL, elementId = NULL, border_extensions = 0.001, decimal_places = 8)
gradientPickerD3(payload, width = NULL, height = NULL, elementId = NULL, border_extensions = 0.001, decimal_places = 8)
payload |
list containing 'ticks' and 'colors' to initialize the gradient. Ticks have to been numerical and in a logical order. Colors can be provided as R colors or HEX format. |
width , height
|
must be a valid CSS unit (like |
elementId |
|
border_extensions |
add to the min and max data range to cover the whole color spectrum |
decimal_places |
number of decimal places |
The interface was designed based on jquery-gradient-picker https://github.com/tantaman/jquery-gradient-picker, htmlwidgets and shiny
ticks <- c(-1.8740103, -0.0040747, 1.4022244, 2.2177949, 3.2116766) payload <- list( colors=c("purple","blue", "green", "yellow", "red"), ticks=ticks ) gradientPickerD3(payload)
ticks <- c(-1.8740103, -0.0040747, 1.4022244, 2.2177949, 3.2116766) payload <- list( colors=c("purple","blue", "green", "yellow", "red"), ticks=ticks ) gradientPickerD3(payload)
Creates an example shiny app which include the gradientPickerD3 and a rendered table for gradientPickerD3 return value. By clicking the reload button new random ticks will be generated.
gradientPickerD3_example()
gradientPickerD3_example()
Output and render functions for using gradientPickerD3 within Shiny applications and interactive Rmd documents.
gradientPickerD3Output(outputId, width = "100%", height = "100%") renderGradientPickerD3(expr, env = parent.frame(), quoted = FALSE)
gradientPickerD3Output(outputId, width = "100%", height = "100%") renderGradientPickerD3(expr, env = parent.frame(), quoted = FALSE)
outputId |
output variable to read from |
width , height
|
Must be a valid CSS unit (like |
expr |
An expression that generates a gradientPickerD3 |
env |
The environment in which to evaluate |
quoted |
Is |