Create a bar chart race.

barChartRace(
data,
x,
y,
time,
ease = "Linear",
frameDur = 500,
transitionDur = 500,
colorCategory = "Accent",
sort = "descending",
xFontSize = 10,
yFontSize = 10,
xticks = 10,
xtitle = NULL,
xtitleFontSize = 16,
ytitle = NULL,
ytitleFontSize = 14,
title = NULL,
titleFontSize = 22,
stroke = "black",
strokeWidth = NULL,
font = "Verdana, Geneva, Tahoma, sans-serif",
panelcol = "#EBEBEBFF",
xgridlinecol = "white",
opacity = 1,
timeLabel = TRUE,
timeLabelOpts = list(size = 32, prefix = "", suffix = "", xOffset = 0.5, yOffset = 1),
width = NULL,
height = NULL
)

## Arguments

data The data frame containing the variables to consider. The x-variable to consider. The y-variable to consider. The time variable to consider. The easing method, you can find more here . Defaults to 'Linear'. The time spent paused on each frame (time point) in milliseconds. The time spent transitioning between frames in milliseconds. A D3 categorical color scheme, you can find more here . Defaults to 'Accent'. Whether to sort or not the bars. Takes three values 'none' which is the default, 'ascending' or 'descending'. Defaults to 'descending'. The distance between each bar. The value goes from 0 to 0.99 included. Defaults to 0.1. the font size of the x-axis labels. Defaults to 10. the font size of the y-axis labels. Defaults to 10. the number of y-axis ticks to consider. Defaults to 10. Optional. The title of the x-axis. The font size of the x-axis title. Defaults to 16. Optional. The title of the y-axis. The font size of the y-axis title. Defaults to 14. Optional. The title of the plot. The font size of the plot title. Defaults to 22. The stroke color of the bars. Defaults to 'black'. Optional. the stroke width of the bars. The font family to consider for the titles. Defaults to "Verdana, Geneva, Tahoma, sans-serif". The background color of the SVG. Defaults to "#CAD0D3" HEX color. The background color of the panel. Defaults to "#EBEBEBFF" HEX color. The color of the x-axis grid lines. Defaults to 'white'. The color opacity of the bars (from 0 to 1). Defaults to 1. Whether to show a label for the value of the time variable. Defaults to TRUE. Options for labeling the value of the time variable. Takes a list specifying the size, prefix, suffix, xOffset, and yOffset. Offsets are scaled relative to the dimensions of the label, from the bottom-right corner of the panel. Optional. The width of the SVG output. Optional. The height of the SVG output.

## Value

An animated SVG bar chart race, wrapped in a div.

## Examples

data <- data.frame(
pop = c(57,66,76,88,101,114,129,143,156,
169,180,190,69,71,74,76,79,78,78,78,81,82,82,82,86,
92,96,101,107,114,118,122,124,126,127,127,30,35,
41,48,56,64,72,80,88,96,102,109,22,26,30,35,41,
47,53,60,67,75,83,91,26,29,34,39,45,51,56,63,70,
76,81,85),
year = c(1952L,1957L,1962L,1967L,1972L,1977L,
1982L,1987L,1992L,1997L,2002L,2007L,1952L,1957L,1962L,
1967L,1972L,1977L,1982L,1987L,1992L,1997L,2002L,2007L,
1952L,1957L,1962L,1967L,1972L,1977L,1982L,1987L,1992L,
1997L,2002L,2007L,1952L,1957L,1962L,1967L,1972L,1977L,
1982L,1987L,1992L,1997L,2002L,2007L,1952L,1957L,1962L,
1967L,1972L,1977L,1982L,1987L,1992L,1997L,2002L,2007L,
1952L,1957L,1962L,1967L,1972L,1977L,1982L,1987L,1992L,
1997L,2002L,2007L),
country = as.factor(c("Brazil","Brazil",
"Brazil","Brazil","Brazil","Brazil","Brazil",
"Brazil","Brazil","Brazil","Brazil","Brazil","Germany",
"Germany","Germany","Germany","Germany",
"Germany","Germany","Germany","Germany","Germany",
"Germany","Germany","Japan","Japan","Japan","Japan",
"Japan","Japan","Japan","Japan","Japan","Japan",
"Japan","Japan","Mexico","Mexico","Mexico",
"Mexico","Mexico","Mexico","Mexico","Mexico",
"Mexico","Mexico","Mexico","Mexico","Philippines",
"Philippines","Philippines","Philippines","Philippines",
"Philippines","Philippines","Philippines",
"Philippines","Philippines","Philippines","Philippines",
"Vietnam","Vietnam","Vietnam","Vietnam",
"Vietnam","Vietnam","Vietnam","Vietnam","Vietnam",
"Vietnam","Vietnam","Vietnam"))
)

barChartRace(
data = data,
x = "pop",
y = "country",
time = "year",
ytitle = "Country",
xtitle = "Population (in millions)",
title = "Bar chart race of country populations"
)