peity: Converts an element's content into a svg mini chart

Description Usage Arguments Examples

View source: R/peity.R

Description

Easily converts an element's content into a svg mini pie, donut, line or bar chart. Peity function is a wrapper around peity.js and it is compatible with any browser that supports svg: Chrome, Firefox, IE9+, Opera, Safari. You can use peity() and specify the chart or use the chart name function. Ex.: peity(c(1, 2, 3), type = "bar") is similar to bar(c(1, 2, 3)).

Usage

1
2
3
4
5
6
7
8
9
peity(data, type = "bar", width = NULL, height = NULL, elementId = NULL, ...)

bar(data, width = NULL, height = NULL, elementId = NULL, ...)

line(data, width = NULL, height = NULL, elementId = NULL, ...)

pie(data, width = NULL, height = NULL, elementId = NULL, ...)

donut(data, width = NULL, height = NULL, elementId = NULL, ...)

Arguments

data

A vector specifying the values to the chart.

type

A string specifying the chart. The options are: "bar", "line", "pie" or "donut".

width

The chart width. The package already adjusts the chart to the line. Use it if you want a specific width.

height

The chart height. The package already adjusts the chart to the line. Use it if you want a specific height.

elementId

A string with the elementId. The package already generates this and you don't need to worry. Use this parameter if you need to pass a specific elementId.

...

A list of specific options to hte chart. See details in https://benpickles.github.io/peity/.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# generate an inline bar plot
bar1 <- peity(c(1, 2, 3), type = "bar")
bar2 <- bar(c(1, 2, 3))

## Not run: 
# if you want to see the result in your browser
bar1
bar2

## End(Not run)

samuelmacedo83/peity documentation built on Dec. 22, 2021, 10:14 p.m.