swi_HTMLwidget: Helper functions for htmlwidget

Description Usage Arguments Examples

Description

Helper functions to create a container for htmlwidget with javascript library files

Usage

1
2
3
4
5
6
7
swi_widget(widget.html, output.html = "parset_swi.html", output = ".",
  source = "source:", author = " swissinfo.ch", h2 = "title",
  descr = "descriptive text", h3 = "subtitle", footer = "")

grab_widgetHTML(widget.html)

swi_libWidget_overwrite(dirPath = ".")

Arguments

widget.html, output.html

character file path to the input widget html and the output reponsive html

output

a path to a folder where the output html file and the js library folder will be saved

source, author, h2, descr, h3, footer

characters

dir

a path to a folder where all the js, css, ... assets on which the htmlwidget depends on

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## Not run: 
library(swiRcharts)
require(htmlwidgets)
require(parsetR)

widget <- parset(HairEyeColor, tension = 0.5)

tmp.dir <- tempdir()
widget.tmp.file <- paste0(tmp.dir, "/tmp.html")
widget.swi.file <- "output.html"
saveWidget(widget, file = widget.tmp.file, selfcontained = F, libdir = "js")
swi_widget(widget.tmp.file, widget.swi.file, output=tmp.dir)

viewer <- getOption("viewer")
viewer(widget.tmp.file)
viewer(paste0(tmp.dir, "/", widget.swi.file))

## End(Not run)

d-qn/swiRcharts documentation built on May 14, 2019, 3:04 p.m.