require("dplyr")
n <- 100
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 <- 100
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")
Run the code above in your browser using DataLab