I am a simple R coder with almost no experience coding in HTML of javascript, so I'm having a hard time understanding the wrappers for the tool tip customization code.
I have 2 time series that I've plotted with rCharts lineWithFocusChart, now I want to customize the tooltip to look like this: http://shiny.rstudio.com/gallery/nvd3-line-chart-output.html
Here is my code so far:
shinyServer(function(input, output) {
output$myChart <- renderChart({
select<-as.numeric(input$radioTS)
out <- data.frame(Actuals[,select], Fits[,select], mmmyyyy)
colnames(out) <- c("Actuals","Fits","Date")
data<-melt(out,id.vars = 'Date')
data$Date <- as.numeric(as.POSIXct(data$Date)) * 1000
p1 <- nPlot(
value ~ Date,
group = 'variable',
data = data,
type = 'lineWithFocusChart',
width = 650,
height = 500
)
p1$addParams(dom = 'myChart')
p1$xAxis(tickFormat = "#!function(d) {return d3.time.format('%b %Y')(new Date(d))}!#")
p1$x2Axis(tickFormat = "#!function(d) {return d3.time.format('%Y')(new Date(d))}!#")
p1$yAxis(tickFormat = "#!function(d) {return d3.format('0,.0')(d)}!#")
return(p1)
})
})