canvas: Htmlwidget reactive canvas

Description Usage Arguments Details Examples

Description

Creates a htmlwidget that shows a two dimensional interactive space with data points with an interpolation can be fit. Points can be moved, added and removed, and interpolation updates automatically. The main objective is to create a new object for Shiny that represents a functional slider extending the one dimensional sliderInput.

Usage

1
canvas(obj, ..., width = NULL, height = NULL, elementId = NULL)

Arguments

obj

data.frame that contains coordinates x,y

...

options to pass to widget, see details

width, height

Must be a valid CSS unit (like '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended.

elementId

The input slot that will be used to access the element.

Details

When deployed in Shiny the location of points and location of anitmation is observed by Shiny. This information is used as a reactive elements to control other input/ui objects. It is also possible to sample from the interpolation function, as a function of the interpolate and ease settings.

Options to pass to canvas via ... :

animate: boolean, turns on animation, Default: FALSE

duration: numeric, duration which is the speed which the animation moves, Default: 10000 (ms)

loop: boolean, automatically restarts the animation when it reaches the end, Default: True

ease: character, function that controls how the animation progresses, Default: 'quadInOut'

interpolate: character, initial interpolation function to apply, Default: 'linear'

pathRadius: numeric, set the size of the circle that moves along the interpolated curve, Default: 10

selectLabel: boolean, controls if the dropdown select is shown, Default: TRUE

xlim,ylim: numeric, limits to pass to x/y-axis, Default: NULL

x_angle: numeric, angle to rotate x axis tick labels, Default: NULL

interpolation options: ( "linear","linear-closed", "step-before","step-after", "basis","basis-open","basis-closed", "cardinal","cardinal-open","cardinal-closed", "bundle", "monotone")

ease options: ( "linear", "quadIn","quadOut","quadInOut", "cubicIn","cubicOut","cubicInOut", "polyIn","polyOut","polyInOut", "sinIn","sinOut","sinInOut", "expIn","expOut","expInOut", "circleIn","circleOut","circleInOut", "bounceIn","bounceOut","bounceInOut", "backIn","backOut","backInOut", "elasticIn","elasticOut","elasticInOut")

Examples

1
2
3
4
5
6
7
8
if(interactive()){

set.seed(123)

dat <- data.frame(x=1:10,y=sort(rexp(10,rate = 2),decreasing = TRUE))

canvas(obj=dat,animate=TRUE,duration=1000,interpolate='basis')
} 

metrumresearchgroup/fluidSpline documentation built on May 22, 2019, 7:51 p.m.