tau_tasks: Add post-render JavaScript tasks to taucharts

Description Usage Arguments Examples

View source: R/tasks.r

Description

Add post-render JavaScript tasks to taucharts

Usage

1
tau_tasks(tau, task = NULL)

Arguments

tau

taucharts object

task

either a character or JS representing a JavaScript function to run after a tauchart has been rendered. This provides the ability for advanced customization. The JavaScript function will be called so this.el will be the containing div element and this.chart will be the taucharts object.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
if (interactive()) {
tauchart(mtcars) %>%
  tau_point("mpg", "wt") %>%
  tau_tasks("function(){alert('I drew a chart')}") %>%
  tau_tasks(htmlwidgets::JS(
    "function(){alert('Yep, I really did.')}"
  )) %>%
  tau_tasks(
    "
function(){
  d3.select(this.el).selectAll('.tau-chart__dot')
    .transition().style('opacity',0.1)
    .transition().style('opacity',0.9)
    .transition().style('opacity',0.1)
    .transition().style('opacity',0.9);
}
"
 )
}

hrbrmstr/taucharts documentation built on May 18, 2018, 4:20 p.m.