animLineChart {ddplot} | R Documentation |
Create an animated line chart
Description
Create an animated line chart
Usage
animLineChart(
data,
x,
y,
curve = "curveLinear",
duration = 5000,
stroke = "crimson",
strokeWidth = 1.5,
xticks = NULL,
yticks = NULL,
xtitle = NULL,
xtitleFontSize = 16,
ytitle = NULL,
ytitleFontSize = 16,
title = NULL,
titleFontSize = 22,
font = "Verdana, Geneva, Tahoma, sans-serif",
bgcol = "#CAD0D3",
opacity = 1,
axisCol = "black",
width = NULL,
height = NULL
)
Arguments
data |
The data frame containing the variables to consider. |
x |
The x-variable to consider. Must be a date variable in 'yyyy-mm-dd' format. |
y |
The y-variable to consider. |
curve |
Optional. The line's curve type to render. A complete list can be found here <https://github.com/d3/d3-shape#curves>. Defaults to 'curveLinear'. |
duration |
The duration in Milliseconds of the animation. Defaults to 5000. |
stroke |
The color of the line. Defaults to 'crimson'. |
strokeWidth |
The width of the line. Defaults to 1.5. |
xticks |
Optional. the number of x-axis ticks to consider. |
yticks |
Optional. The number of y-axis ticks to consider. |
xtitle |
Optional. The title of the x-axis. |
xtitleFontSize |
The font size of the x-axis title. Defaults to 16. |
ytitle |
Optional. The title of the y-axis. |
ytitleFontSize |
The font size of the y-axis title. Defaults to 16. |
title |
Optional. The title of the plot. |
titleFontSize |
The font size of the plot title. Defaults to 22. |
font |
The font family to consider for the titles. Defaults to "Verdana, Geneva, Tahoma, sans-serif". |
bgcol |
The background color of the SVG. Defaults to "#CAD0D3" HEX color. |
opacity |
The color opacity of the bars (from 0 to 1). Defaults to 1. |
axisCol |
the color of the x and y axis. It includes the ticks, the labels and titles. Defaults to 'black'. |
width |
Optional. The width of the SVG output. |
height |
Optional. The height of the SVG output. |
Value
An animated SVG line chart.
Examples
airpassengers <- data.frame(
passengers = as.matrix(AirPassengers),
date= zoo::as.Date(time(AirPassengers))
)
animLineChart(
data = airpassengers,
x = "date",
y = "passengers",
duration = 10000 # in milliseconds (10 seconds)
)