Change color on single-series line chart using rCharts and Highcharts?
- by Sharon
Is it possible to change the color of a line using rCharts and Highcharts so that the line color changes depending on a factor? I've done this with ggplot2 but would like to make an interactive version if possible. I've tried
h1 <- Highcharts$new()
h1$chart(type="line")
h1$series(data=mydf$myvalue, name="", groups = c("myfactor"))
h1$xAxis(tickInterval = 4, categories = mydf$myXaxis)
but that's not working, line stays the same color. Sample data
myvalue <- c(16, 18, 5, 14, 10)
myXaxis <- c(1,2,3,4,5)
myfactor <- c("old", "old", "old", "new", "new")
mydf <- data.frame(myvalue, myXaxis, myfactor)
Thanks for any suggestions.