var y = data[1];
rollingData[i] = [originalData[i][0], [y, y - data[0], data[2] - y]];
- if (y && !isNaN(y)) {
+ if (y != null && !isNaN(y)) {
low += data[0];
mid += y;
high += data[2];
}
if (i - rollPeriod >= 0) {
var prev = originalData[i - rollPeriod];
- if (prev[1][1] && !isNaN(prev[1][1])) {
+ if (prev[1][1] != null && !isNaN(prev[1][1])) {
low -= prev[1][0];
mid -= prev[1][1];
high -= prev[1][2];
var num_ok = 0;
for (var j = Math.max(0, i - rollPeriod + 1); j < i + 1; j++) {
var y = originalData[j][1];
- if (!y || isNaN(y)) continue;
+ if (y == null || isNaN(y)) continue;
num_ok++;
sum += originalData[j][1];
}
var num_ok = 0;
for (var j = Math.max(0, i - rollPeriod + 1); j < i + 1; j++) {
var y = originalData[j][1][0];
- if (!y || isNaN(y)) continue;
+ if (y == null || isNaN(y)) continue;
num_ok++;
sum += originalData[j][1][0];
variance += Math.pow(originalData[j][1][1], 2);
--- /dev/null
+<html>
+ <head>
+ <title>zero series</title>
+ <!--[if IE]>
+ <script type="text/javascript" src="excanvas.js"></script>
+ <![endif]-->
+ <script type="text/javascript" src="../dygraph-combined.js"></script>
+ <script type="text/javascript" src="../dygraph-canvas.js"></script>
+ <script type="text/javascript" src="../dygraph.js"></script>
+ </head>
+ <body>
+ <p>Custom bars with a completely zero series. Both Y1 and Y2 should show.</p>
+
+ <div id="data" style="display:none">X,Y1,Y2
+1,1;2;3,0;0;0
+2,2;3;4,0;0;0
+3,1;3;5,0;0;0
+</div>
+
+ <div id="graphdiv" style="width:600px; height:300px;"></div>
+ <script type="text/javascript">
+ new Dygraph(document.getElementById("graphdiv"),
+ document.getElementById("data").innerHTML,
+ {
+ customBars: true
+ });
+ </script>
+ </body>
+</html>