spk_chr: Character Version of Sparklines

Description Usage Arguments Examples

View source: R/sparkline.R

Description

Create a character version ofinteractive sparklines for use with other 'htmlwidgets' or tags.

Usage

1
2
spk_chr(values, ..., width = 60, height = 20, elementId = NULL,
  renderSelector = NULL)

Arguments

values

vector of values to visualize

...

additional options passed to jquery.sparkline; see jquery.sparkline docs

width

height and width of sparkline htmlwidget specified in any valid CSS size unit.

height

height and width of sparkline htmlwidget specified in any valid CSS size unit.

elementId

string id as a valid CSS element id.

renderSelector

string as CSS selector to render in a DOM element other than the htmlwidget container

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
## Not run: 
  #spk_chr works well with dplyr summarise
  
  library(dplyr)
  library(sparkline)
  library(formattable)
  
  mtcars %>%
    group_by(cyl) %>%
    summarise(
      hp = spk_chr(
        hp, type="box",
        chartRangeMin=0, chartRangeMax=max(mtcars$hp)
      ),
      mpg = spk_chr(
        mpg, type="box",
        chartRangeMin=0, chartRangeMax=max(mtcars$mpg)
      )
    ) %>%
    formattable() %>%
    formattable::as.htmlwidget() %>%
    spk_add_deps()

## End(Not run)

sparkline documentation built on May 30, 2017, 2:18 a.m.