title: RCharts lineChart Features
body: <p>I am trying to embed an RChart into a shiny app. Specifically, working with the function <code>nPlot</code> and the <code>type=lineChart</code> NVD3 feature. I am trying to plot 3 density curves for simulated Normal data. I am trying to achieve some of the functionality described in the example below:</p>
  
  <p><a href="http://nvd3.org/ghpages/line.html" rel="nofollow">http://nvd3.org/ghpages/line.html</a></p>
  
  <p>My issues:</p>
  
  <ol>
  <li>How to have different colours for different density curves?</li>
  <li>How to have the feature to click on group variable (1), (2), (3) to effectively remove the selected density. Similar to clicking on "Sine Wave" (top right) in the example to remove the orange sine curve?</li>
  <li>How to add x-axis and y-axis labels? My <code>$params$xAxis=</code> call does not work.</li>
  </ol>
  
  <p>Below are my server.R and ui.R files:</p>
  
  <pre><code>## server.r
  library(rCharts)
  library(shiny)
  
  x &lt;-rnorm(1000,0,1)
  y &lt;-rnorm(1000,1,1)
  z &lt;-rnorm(1000,2,1)
  out &lt;- c(x,y,z)
  grp &lt;- c(rep(0,1000),rep(1,1000),rep(2,1000))
  data &lt;- as.data.frame(cbind(out,grp))
  dens &lt;- by(data$out, data$grp, density)
  d &lt;- unlist(c(dens[[1]][1][1], dens[[2]][1][1], dens[[3]][1][1]))
  support &lt;- unlist(c(dens[[1]][2][1], dens[[2]][2][1], dens[[3]][2][1]))
  grpvar &lt;- c(rep(0,length(unlist(dens[[1]][1][1]))), rep(1,length(unlist(dens[[2]][1][1]))), rep(2,length(unlist(dens[[3]][1][1]))))
  dat &lt;- as.data.frame(cbind(d,support,grpvar))
  
  
  shinyServer(function(input, output) {
  
  output$myChart &lt;- renderChart({
  
  p1 &lt;- nPlot(support~d, group=grpvar, data = dat, type = "lineChart")
  
  p1$addParams(dom = 'myChart')
  p1$params$width = 600
  p1$params$height = 400
  
  p1$params$xAxis = "Support"
  p1$params$yAxis = "Density"
  
  p1$chart(tooltipContent = "#! function(key, x, y, e){
  return '&lt;b&gt;Group&lt;/b&gt;: ' + e.point.grpvar
  } !#")
  
  return(p1)
  })
  })
  
  
  ## ui.R
  library(rCharts)
  library(shiny)
  
  shinyUI(pageWithSidebar(
  headerPanel("rCharts: Interactive Charts from R using NVD3.js"),
  
  sidebarPanel(
  
  wellPanel(
      helpText(   "Look at the pretty graph"
      )
      ),
  
  wellPanel(
      helpText(   "Look at the pretty graph"
      )
      ),
  
  wellPanel(
      helpText(   "Look at the pretty graph"
      )
      )
  
  ),
  
  
  mainPanel(
  div(class='wrapper',
  tags$style(".Nvd3{ height: 600px;}"),
  showOutput("myChart","Nvd3")
  )
  
  )
  ))
  </code></pre>
  
  <p>Thanks in advance for any help/advice you can provide.</p>