-
Notifications
You must be signed in to change notification settings - Fork 150
/
Copy pathhc_boost.Rd
129 lines (126 loc) · 3.2 KB
/
hc_boost.Rd
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/highcharts-api.R
\name{hc_boost}
\alias{hc_boost}
\title{Boost options for highcharter objects}
\usage{
hc_boost(hc, ...)
}
\arguments{
\item{hc}{A \code{highchart} \code{htmlwidget} object.}
\item{...}{Arguments defined in \url{https://api.highcharts.com/highcharts/boost}.}
}
\description{
Options for the Boost module. The Boost module allows certain series types
to be rendered by WebGL instead of the default SVG. This allows hundreds of
thousands of data points to be rendered in milliseconds. In addition to the
WebGL rendering it saves time by skipping processing and inspection of the
data wherever possible. This introduces some limitations to what features are
available in boost mode. See the docs for
details.
In addition to the global boost option, each series has a
boostThreshold that defines when the
boost should kick in.
Requires the modules/boost.js module.
}
\examples{
# # Ex 1
# options(highcharter.rjson = FALSE)
#
# n <- 50000
#
# x <- sin(4*2*pi*seq(n)/n) + rnorm(n)/10
#
# x <- round(x, 3)
#
# plot(x)
#
# hc1 <- highchart() |>
# hc_chart(zoomType = "x") |>
# hc_add_series(data = x) |>
# hc_title(text = "No boost") |>
# hc_boost(
# enabled = FALSE # Default
# )
#
# hc1
#
# # Boost is a stripped-down renderer-in-a-module for Highcharts. It bypasses
# # some of the standard Highcharts features (such as animation), and focuses
# # on pushing as many points as possible as quickly as possible.
#
# hc2 <- highchart() |>
# hc_chart(zoomType = "x") |>
# hc_add_series(data = x) |>
# hc_title(text = "With boost") |>
# hc_boost(enabled = TRUE)
#
# hc2
#
#
# # # Ex 2
# # library(MASS)
# #
# # n <- 20000
# #
# # sigma <- matrix(c(10,3,3,2),2,2)
# # sigma
# #
# # mvr <- round(mvrnorm(n, rep(c(0, 0)), sigma), 2)
# #
# # vx <- ceiling(1+abs(max(mvr[, 1])))
# # vy <- ceiling(1+abs(max(mvr[, 2])))
# #
# # # unnamed list
# # ds <- list_parse2(as.data.frame(mvr))
# #
# # highchart() |>
# # hc_chart(zoomType = "xy") |>
# # hc_xAxis(min = -vx, max = vx) |>
# # hc_yAxis(min = -vy, max = vy) |>
# # hc_add_series(
# # data = ds, #list
# # type = "scatter",
# # name = "A lot of points!",
# # color = 'rgba(0,0,0,0.1)',
# # marker = list(radius = 2)
# # ) |>
# # hc_boost(
# # enabled = TRUE
# # )
# #
# # dat <- as.data.frame(mvr)
# # names(dat) <- c("x", "y")
# #
# # highchart() |>
# # hc_chart(zoomType = "xy") |>
# # hc_xAxis(min = -vx, max = vx) |>
# # hc_yAxis(min = -vy, max = vy) |>
# # hc_add_series(
# # data = dat,
# # type = "scatter",
# # hcaes(x, y),
# # name = "A lot of points!",
# # color = 'rgba(0,0,0,0.1)',
# # marker = list(radius = 2)
# # ) |>
# # hc_boost(enabled = TRUE)
# #
# # # Ex3
# # N <- 1000000
# # n <- 5
# # s <- seq(n)
# # s <- s/(max(s) + min(s))
# # s <- round(s, 2)
# #
# # series <- s |>
# # purrr::map(~ stats::arima.sim(round(N/n), model = list(ar = .x)) + .x * n * 20) |>
# # purrr::map(as.vector) |>
# # purrr::map(round, 2) |>
# # purrr::map(~ list(data = .x))
# #
# # highchart() |>
# # hc_add_series_list(series) |>
# # hc_chart(zoomType = "x") |>
# # hc_boost(enabled = TRUE)
}