radarchart (version 0.3.1)

chartJSRadar: Make a ChartJS Radar Plot

Description

R bindings to the radar plot in the chartJS library

Usage

chartJSRadar(scores, labs, width = NULL, height = NULL, main = NULL, maxScale = NULL, scaleStepWidth = NULL, scaleStartValue = 0, responsive = TRUE, labelSize = 18, showLegend = TRUE, addDots = TRUE, colMatrix = NULL, polyAlpha = 0.2, lineAlpha = 0.8, showToolTipLabel = TRUE, ...)

Arguments

scores
Data frame or named list of scores for each axis. If labs is not specified then labels are taken from the first column (or element).
labs
Labels for each axis. If left unspecified labels are taken from the scores data set. If set to NA then labels are left blank.
width
Width of output plot
height
Height of output plot
main
Character: Title to be displayed
maxScale
Max value on each axis
scaleStepWidth
Spacing between rings on radar
scaleStartValue
Value at the centre of the radar
responsive
Logical. whether or not the chart should be responsive and resize when the browser does
labelSize
Numeric. Point label font size in pixels
showLegend
Logical whether to show the legend
addDots
Logical. Whether to show a dot for each point
colMatrix
Numeric matrix of rgb colour values. If NULL defaults are used
polyAlpha
Alpha value for the fill of polygons
lineAlpha
Alpha value for the outlines
showToolTipLabel
Logical. If TRUE then data set labels are shown in the tooltip hover over
...
Extra options passed straight to chart.js. Names must match existing options http://www.chartjs.org/docs/#getting-started-global-chart-configuration

Examples

Run this code
# Using the data frame interface
chartJSRadar(scores=skills)

# Or using a list interface
labs <- c("Communicator", "Data Wangler", "Programmer", "Technologist",  "Modeller", "Visualizer")

scores <- list("Rich" = c(9, 7, 4, 5, 3, 7),
 "Andy" = c(7, 6, 6, 2, 6, 9),
 "Aimee" = c(6, 5, 8, 4, 7, 6))

# Default settings
chartJSRadar(scores=scores, labs=labs)

# Fix the max score
chartJSRadar(scores=scores, labs=labs, maxScale=10)

# Fix max and spacing
chartJSRadar(scores=scores, labs=labs, maxScale=12, scaleStepWidth = 2)

# Change title and remove legend
chartJSRadar(scores=scores, labs=labs, main = "Data Science Radar", showLegend = FALSE)

# Add pass through settings for extra options
chartJSRadar(scores=scores, labs=labs, maxScale =10, scaleLineWidth=5)

Run the code above in your browser using DataCamp Workspace