gradientPickerD3: gradientPickerD3

Description Usage Arguments Source See Also Examples

View source: R/gradientPickerD3.R

Description

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.

Usage

1
2
gradientPickerD3(payload, width = NULL, height = NULL, elementId = NULL,
  border_extensions = 0.001, decimal_places = 8)

Arguments

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 '100%')

elementId

string id as a valid CSS element id

border_extensions

add to the min and max data range to cover the whole color spectrum

decimal_places

number of decimal places

Source

The interface was designed based on jquery-gradient-picker https://github.com/tantaman/jquery-gradient-picker, htmlwidgets and shiny

See Also

gradientPickerD3_example

Examples

1
2
3
4
5
6
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)

Example output



gradientPickerD3 documentation built on May 1, 2019, 8:41 p.m.