title: dygraph bar charts with negative values in R
body: <p>I have time-series data that I would like to plot in R with <code>dygraphs</code> with bars as opposed to lines.  I am using the following <code>plotter</code> suggestion from the <a href="https://rstudio.github.io/dygraphs/gallery-custom-plotters.html" rel="nofollow noreferrer">dygraphs documentation</a>.</p>
  
  <pre><code>dyBarChart &lt;- function(dygraph) {
    dyPlotter(dygraph = dygraph,
              name = "BarChart",
              path = system.file("plotters/barchart.js",
                                 package = "dygraphs"))
  }
  </code></pre>
  
  <p>The problem I am having is representing negative values.<br>
  With a line plot, this <code>dygraph()</code> works as it should:</p>
  
  <pre><code>dygraph(test)
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/LBv0Om.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/LBv0Om.png" alt="enter image description here"></a></p>
  
  <p>However, when we add the bar chart, nothing is plotted and warnings are returned:</p>
  
  <pre><code>dygraph(z)  %&gt;%  dyBarChart() 
  There were 14 warnings (use warnings() to see them)
  &gt; warnings()
  
  Warning messages:
  1: In normalizePath(path) : path[1]="": No such file or directory
  2: In file.copy(from, to, overwrite = TRUE, recursive = isdir) : too deep nesting
  3: In file.copy(from, to, overwrite = TRUE, recursive = isdir) : too deep nesting...
  </code></pre>
  
  <p>Is there a known workaround for plotting negative values in R dygraph barcharts? </p>
  
  <p>Here is the sample data:</p>
  
  <pre><code>&gt; dput(test)
  structure(c(-6L, 0L, -4L, -1L, 2L, 0L, 18L, -3L, -2L, -1L, -2L, 
  1L, -22L, -5L, -1L, 3L, 11L, 2L, -2L, 5L, -3L, -1L, -2L, 0L, 
  12L), index = structure(c(1521217200, 1521217800, 1521218400, 
  1521219000, 1521219600, 1521220200, 1521220800, 1521221400, 1521222000, 
  1521222600, 1521223200, 1521223800, 1521224400, 1521225000, 1521225600, 
  1521226200, 1521226800, 1521227400, 1521228000, 1521228600, 1521229200, 
  1521229800, 1521230400, 1521231000, 1521231600), class = c("POSIXct", 
  "POSIXt"), tzone = ""), class = "zoo")
  </code></pre>