Description Usage Arguments See Also Examples
SVG animation
1 2 3 |
target |
name of element to animate ("label", "grid", "point", "line", "bar", "slice") |
style |
name of style to animate ("x", "x1", "x2", "y", "y1", "y2", "opacity") |
easing |
name of an easing function in Chartist.Svg.Easing or an array with four numbers
specifying a cubic (e.g. |
delay |
delay between when one element animated and when the next element will animate (unit: ms) |
dur |
duration of animation (unit: ms) |
interval |
interval of animation (unit: ms) |
offset |
offset from the original value |
relative |
if the offset value is relative to each element's original value or absolute |
http://gionkunz.github.io/chartist-js/api-documentation.html#chartistsvg-function-animate
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 29 30 31 32 33 34 | ## Not run:
set.seed(324)
data <- data.frame(
day = paste0("day", 1:20),
A = runif(10, 0, 20),
B = runif(10, 0, 20),
C = runif(10, 0, 20),
D = runif(10, 0, 20),
E = runif(10, 0, 20),
stringsAsFactors = FALSE
)
# a simple example
chartist(data, day) + Point() +
SVG_animate(target = "point", offset = -30, style = "x1")
# `offset` is used as the absolute value when
# 1) relative = FALSE
# 2) style = "opacity"
chartist(data, day) +
SVG_animate(target = "line", offset = 0, style = "opacity")
# If you want to animate things sequentially, you can use `delay` parameter.
chartist(data, day) +
SVG_animate(target = "line", style = "opacity", offset = 0, delay = 300)
# You can even overlay animations.
chartist(data, day) +
Point() +
SVG_animate(target = "point", style = "x1", offset = -100, delay = 5) +
SVG_animate(target = "point", style = "y1", offset = 100, delay = 3) +
SVG_animate(target = "point", style = "opacity", offset = 0, delay = 5)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.