spk_composite: Add a Composite to an Existing Sparkline

Description Usage Arguments Value Examples

View source: R/composite.R

Description

Add a Composite to an Existing Sparkline

Usage

1
spk_composite(sparkline = NULL, sparklineToAdd = NULL, ...)

Arguments

sparkline

sparkline to which we would like to add a composite.

sparklineToAdd

sparkline to add to another sparkline

...

extra arguments to modify sparklineToAdd or define a sparkline.

Value

sparkline object

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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
library(sparkline)

sl1 <- sparkline(
  c(5,4,5,-2,0,3),
  type='bar',
  barColor="#aaf",
  chartRangeMin=-5,
  chartRangeMax=10,
  # set an id that will make it easier to refer
  #  in the next sparkline
  elementId="sparkline-for-composite"
)

sl2 <- sparkline(
  c(4,1,5,7,9,9,8,7,6,6,4,7,8,4,3,2,2,5,6,7),
  type="line",
  fillColor = FALSE,
  lineColor ='red',
  chartRangeMin = -5,
  chartRangeMax = 10
)

# add sparkline as a composite
spk_composite(sl1, sl2)

# add values and options as a composite
spk_composite(
  sl1,
  values=c(4,1,5,7,9,9,8,7,6,6,4,7,8,4,3,2,2,5,6,7),
  options = list(
    type="line",
    fillColor = FALSE,
    lineColor ='red',
    chartRangeMin = -5,
    chartRangeMax = 10
  )
)

# add combination of sparkline and options as a composite
spk_composite(
  sl1,
  sl2,
  options = list(
    type="box"
  )
)

Example output



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