Pie: Pie chart

Description Usage Arguments See Also Examples

Description

The Chartist pie chart can be used to draw pie, donut or gauge charts.

Usage

1
2
3
4
Pie(width = NULL, height = NULL, chartPadding = NULL, classNames = NULL,
  startAngle = NULL, total = NULL, donut = NULL, donutWidth = NULL,
  showLabel = NULL, labelOffset = NULL, labelInterpolationFnc = NULL,
  labelDirection = NULL, responsiveQuery = NULL)

Arguments

width

fixed width for the chart as a string (i.e. '100px' or '50%')

height

fixed height for the chart as a string (i.e. '100px' or '50%')

chartPadding

padding of the chart drawing area to the container element and labels

classNames

Override the class names that get used to generate the SVG structure of the chart

startAngle

start angle of the pie chart in degrees where 0 points north

total

By specifying a total value, the sum of the values in the series must be this total in order to draw a full pie. You can use this parameter to draw only parts of a pie or gauge charts.

donut

if donut chart or not

donutWidth

donut stroke width

showLabel

if labels should be shown or not

labelOffset

offset of the each label (different from Line() and Bar(), labelOffset must be a single numeric value)

labelInterpolationFnc

JS function to intercept the value from labels

labelDirection

label direction. Possible values are 'neutral', 'explode' or 'implode'.

responsiveQuery

if specified, the options are used only when the query matches.

See Also

http://gionkunz.github.io/chartist-js/api-documentation.html#chartistpie-function-pie

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
## Not run: 
set.seed(324)
data <- data.frame(
  day = 1:20,
  A   = runif(20, 0, 10),
  B   = runif(20, 0, 10),
  C   = runif(20, 0, 10),
  D   = runif(20, 0, 10)
  )

# Only first data series is used for Pie(). So, these two draw the same chart.
interp <- JS_interp(prefix = "Item ")
chartist(data, day) + Pie(labelInterpolationFnc = interp)
chartist(subset(data, , 1), day) + Pie(labelInterpolationFnc = interp)

# responsive chart
chartist(data[1:4, ], day) +
  # by default, draw a donut chart
  Pie(donut = TRUE, donutWidth = 100) +
  # for smaller screens, draw a normal pie chart
  Pie(donut = FALSE, showLabel = FALSE, responsiveQuery = "screen and (max-width: 600px)")

# By default, Chartist knows only four colours
# (c.f. https://github.com/gionkunz/chartist-js/issues/79)
# Corrently Pie() cannot work well with data whose length is more than four
chartist(data, day) + Pie()

## End(Not run)

yutannihilation/chartist documentation built on May 4, 2019, 7:45 p.m.