I am new to highcharts and R highcharter. I have a dataframe like this
tmp <- data.frame(x = 1:5, y = rnorm(5), color = c("green", "red", "green", "orange", "red"))
# x y color
# 1 0.4421 green
# 2 -0.8924 red
# 3 0.8264 green
# 4 0.6695 orange
# 5 -0.0966 red
I want to draw it using highcharter.
For the point color, I want to make the point color to be the corresponding color in the data frame.
What should I do? Even though it is R codes, any solutions in JS would be appreciate it because I can rewrite it in R.
A slightly improved solution:
set.seed(1)
tmp <- data.frame(x = 1:5, y = rnorm(5),
color = c("green", "red", "green", "orange", "red"))
dummy <- "two"
library(highcharter)
hchart(tmp, type="scatter", hcaes(x=x, y=y, color=color),
marker=list(symbol='circle', radius=5), zIndex=1) %>%
hc_add_series(tmp, type="line", color="lightblue", zIndex=0)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.