R shiny / rCharts / nvd3:覆盖固定宽度和高度?

R shiny / rCharts / nvd3 : override fixed width and height?

我意识到我为我的 nvd3 图表(包括添加我自己的 css)设置宽度和高度的所有尝试都被破坏了通过一些内联 css:

<style>
.rChart {width: 800px; height: 400px}
</style>

怎么办?我不知道这是从哪里来的,也不知道如何阻止它被输出。此外,我想不出任何人为什么会首先为情节设置 固定 维度的任何原因...

更新:我不知道下面的每个评论都有一个 renderChart2()。我试过如下:

  output$testChart <- renderChart2({

    n1 <- nPlot(xxx~yyy, data = xyz, type = 'discreteBarChart')
    n1$xAxis(axisLabel = "Heading")
    #bug with nv.d3.js - without width, the ylabel is off the chart area and invisible?
    n1$yAxis(axisLabel = "label", width = 40)
    n1$set(title = "Title")
    n1$chart(width=1600, height=800, tooltipContent = "#! function(key, x, y, e){ 
  return 'x: ' + e.point.x+ '<br/>  y: ' + y 
} !#")
    n1$addParams(dom = 'testChart') #need this line, else it doesn't get rendered in dom!
    return(n1)

  })

我在 html 输出中得到了这个(用 firebug 检查):

<div class="shiny-html-output rChart Nvd3 shiny-bound-output" id="testChart"><style>.rChart {width: 800px; height: 400px} </style>

<div class="rChart nvd3" id="testChart"></div>
<script type="text/javascript">
 $(document).ready(function(){
      drawtestChart()
    });
    function drawtestChart(){  
      var opts = {
 "dom": "testChart",
"width":    800,
"height":    400,
...(etc)...

环境:

> sessionInfo()
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] markdown_0.7.4   knitr_1.8        rCharts_0.4.5    plyr_1.8.1       ggplot2_1.0.0   
[6] gplots_2.16.0    data.table_1.9.4 shiny_0.11      

是的,我有点不知所云..

尝试更改:

n1$chart(width=1600, height=800, tooltipContent = "#! function(key, x, y, e)

至:

n1$set(width=1600, height=800, tooltipContent = "#! function(key, x, y, e)