I have the following code:
library(rCharts)
C <- 1000
R <- 0.02
t <- 10
PV <- sapply(c(1:t), function(x) C*(1+R)^(-1*x))
TotPV <- sum(PV)
PVs <- data.frame(Time = c(1:t),PV)
h1 <- hPlot(x = 'Time', y = 'PV', data = PVs, type = 'line')
h1$tooltip(formatter = "#! function(){return('<b>t: </b>' + this.x + '<br/>' + '<b>PV: </b>' + this.y);} !#")
h1$colors(list('red'))
# h1$title(text = '')
# h1$xAxis(title = list(text = ''))
# h1$yAxis(title = list(text = 'PV'))
# h1$params$width <-200
# h1$params$height <- 200
h1
The problem is that the line color is not red but transparent. If I comment out the colors attribute, the line color changes to default (light blue). Anyone an idea?
Instead of:
h1$colors(list('red'))
You can try adding:
h1$plotOptions(series = list(color = 'red'))