I am running into a problem where I cannot color different sections of a graph I am working on. I want to change the color based on the threshold on the y axis. It seems easy from looking at the documentation from the high charts javascript, but it fails when I try to translate it into R to use rCharts. Here is what I have, with an example data frame called final.
library(rCharts)
final <- data.frame(x = c(1,2,3,4,5), y = c(15,17,20,21,22), radius = rep(3,5))
temp <- apply(final[,c("x","y","radius"])], 1, as.list)
a <- Highcharts$new()
a$series(animation = FALSE, name = "placeholder", data = temp, type = "scatter",
lineWidth = 1, zoneAxis = "y", zones = list(list(value = 20,
color = "rgba(223, 83, 83, 0.5)"),
list(color = "rgba(50, 205, 50, 0.5)")))
This does not change the plot from the default color, so I'm very confused and would greatly appreciate any help or possibly another solution. Thanks!
This is modeled off of the documentation for zones here: http://www.highcharts.com/docs/chart-concepts/series#4aaN
Here are the points I do not understand: This code has a
]
inside thec()
without a sense;Your intent I guess, was to select all columns, which can be achieved with a simple:
But this code also seems to be strange for me because the same results can be obtained with just:
If of course you wanted that.
Edit: Color changed (another approach)
I changed the color even though I have to admit I achieved this solution due to my ignorance of which package the
rgba
functions belongs to. I change thergba
torgb
, I have unquoted it (are you sure it should be quoted?) and I set themax = 255
to thergb
. Here is the code.