| hc_add_series_df {highcharter} | R Documentation |
Function to create chart from tidy data frames. As same as qplot you can use aesthetic including the group variable
hc_add_series_df(hc, data, type = NULL, ...)
hc |
A |
data |
A |
type |
The type of chart. Possible values are line, scatter, point, colum, columnrange, etc. See http://api.highcharts.com/highcharts#series. |
... |
Aesthetic mappings, |
The types supported are line, column, point, polygon, columrange, spline, areaspline among others.
Automatically parsed de data frame (to a list o series). You
you can use the default parameters of highcharts such as x, y,
z, color, name, low, high for
each series, for example check
http://api.highcharts.com/highcharts#series<bubble>.data.
## Not run:
require("dplyr")
n <- 50
df <- data_frame(
x = rnorm(n),
y = x * 2 + rnorm(n),
w = x^2
)
hc_add_series_df(highchart(), data = df, type = "point", x = x, y = y)
hc_add_series_df(highchart(), data = df, type = "point", color = w)
hc_add_series_df(highchart(), data = df, type = "point", color = w, size = y)
m <- 50
s <- cumsum(rnorm(m))
e <- 2 + rbeta(m, 2, 2)
df2 <- data_frame(
var = seq(m),
l = s - e,
h = s + e,
n = paste("I'm point ", var)
)
hc_add_series_df(highchart(), data = df2, type = "columnrange",
x = var, low = l, high = h, name = n, color = var)
hc_add_series_df(highchart(), iris, "point",
x = Sepal.Length, y = Sepal.Width, group = Species)
data(mpg, package = "ggplot2")
# point and scatter is the same
hc_add_series_df(highchart(), mpg, "scatter", x = displ, y = cty)
hc_add_series_df(highchart(), mpg, "point", x = displ, y = cty,
group = manufacturer)
mpgman <- count(mpg, manufacturer)
hc_add_series_df(highchart(), mpgman, "column", x = manufacturer, y = n) %>%
hc_xAxis(type = "category")
mpgman2 <- count(mpg, manufacturer, year)
hc_add_series_df(highchart(), mpgman2, "bar", x = manufacturer, y = n, group = year) %>%
hc_xAxis(type = "category")
data(economics, package = "ggplot2")
hc_add_series_df(highchart(), economics, "line", x = date, y = unemploy) %>%
hc_xAxis(type = "datetime")
data(economics_long, package = "ggplot2")
economics_long2 <- filter(economics_long,
variable %in% c("pop", "uempmed", "unemploy"))
hc_add_series_df(highchart(), economics_long2, "line", x = date,
y = value01, group = variable) %>%
hc_xAxis(type = "datetime")
## End(Not run)