month = 0:10
dat <- data.frame(
month = month,
traj1 = rnorm(11),
traj2 = rnorm(11)
)
m1 <- mPlot(x = 'month', y = c('traj1', 'traj2'), data = dat, type = 'Line')
m1$set(parseTime = FALSE)
m1$set(hoverCallback = "#! function(index, options, content){
var row = options.data[index]
month = 'Month: ' + row.month
line1 = 'Traj1: ' + row.traj1
line2 = 'Traj2: ' + row.traj2
if (row.traj1 < row.traj2){
tmp = line1; line1 = line2; line2 = tmp;
}
return [month, line1, line2].join('<br/>')
} !#")
m1