rCharts nvd3 lineWithFocusChart自定义

我在rCharts上使用nvd3,并想知道是否有一种方法来自定义lineWithFocusChart上较低视图查找器graphics的坐标轴。 我在下面提供了一个可重现的例子,其中我自定义x和y轴以逗号分隔千位,但格式不显示在较低的取景器图表上。 这怎么解决? 谢谢!

library(rCharts) temp <- data.frame(x = 1:2000, y = 1:2000, z = c(rep(1,1000), rep(0,1000))) g <- nPlot(y ~ x, group = "z", data = temp, type = "lineWithFocusChart") g$templates$script <- "http://timelyportfolio.github.io/rCharts_nvd3_templates/chartWithTitle_styled.html" g$set(title = "Example") g$chart(transitionDuration = -1, tooltipContent = "#! function(key, x, y) { return 'z: ' + key + '<br/>' + 'x: ' + x + '<br/>' + 'y: ' + y }!#", showLegend = FALSE, margin = list(left = 200, right = 100, bottom = 100, top = 100)) g$xAxis(axisLabel = "x", tickFormat = "#!function(x) {return d3.format(',.0f')(x);}!#") g$yAxis(axisLabel = "y", width = 100, tickFormat = "#!function(y) {return d3.format(',.0f')(y);}!#", showMaxMin = FALSE) g 

我刚刚发现这个,因为我正在查看标有R未解答的问题。 对不起,我错过了。 rCharts已经停滞,但寻找基于更灵活的htmlwidgets基础设施的新版本。 我相信这个答案是太晚了,但我已经改变了模板,以允许格式为y2Axis

 # uncomment this to install the fix #devtools::install_github("timelyportfolio/rCharts") library(rCharts) temp <- data.frame(x = 1:2000, y = 1:2000, z = c(rep(1,1000), rep(0,1000))) g <- nPlot(y ~ x, group = "z", data = temp, type = "lineWithFocusChart") g$templates$script <- "c:/users/kent.tleavell_nt/dropbox/development/r/rCharts_nvd3_templates/chartWithTitle_styled.html" g$set(title = "Example") g$chart(transitionDuration = -1, tooltipContent = "#! function(key, x, y) { return 'z: ' + key + '<br/>' + 'x: ' + x + '<br/>' + 'y: ' + y }!#", showLegend = FALSE, margin = list(left = 200, right = 100, bottom = 100, top = 100)) g$xAxis(axisLabel = "x", tickFormat = "#!function(x) {return d3.format(',.0f')(x);}!#") g$yAxis(axisLabel = "y", width = 100, tickFormat = "#!function(y) {return d3.format(',.0f')(y);}!#", showMaxMin = FALSE) g$x2Axis(tickFormat = "#!function(x) {return d3.format('1.2s')(x);}!#") # now we have a new y2Axis function g$y2Axis( tickFormat = "#!function(y) {return d3.format('1.2s')(y);}!#" ) g