Вы можете создать настроенный valueFormatter
и использовать аргумент row
для захвата номера периода.
Вот пример:
library(dygraphs)
library(htmlwidgets)
lungDeaths <- cbind(mdeaths, fdeaths)
date_counter <- 'function(d,opts, seriesName, dygraph, row, col){
var monthNames = ["Jan", "Feb", "Mar", "Apr", "May", "Jun","Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
date = new Date(d);
return monthNames[date.getMonth()]+", " +date.getFullYear() + " (" + row.toString() + ")";
}'
dygraph(lungDeaths) %>%
dyAxis("x",valueFormatter=JS(date_counter))