X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph-range-selector.js;h=fe6986491ef3c3db42b08fd80367c5e7df76747a;hb=3c10a0f3519355ee651d04bf2972bd31298eff18;hp=18eeee03f29ee4d7e931d1a68a692bd82e9573a7;hpb=758a629f806fa73483f730fb343013acd0ace078;p=dygraphs.git diff --git a/dygraph-range-selector.js b/dygraph-range-selector.js index 18eeee0..fe69864 100644 --- a/dygraph-range-selector.js +++ b/dygraph-range-selector.js @@ -466,17 +466,24 @@ DygraphRangeSelector.prototype.computeCombinedSeriesAndLimits_ = function() { var sum; var count; var yVal, y; - var mutipleValues = typeof data[0][1] != 'number'; + var mutipleValues; var i, j, k; - if (mutipleValues) { - sum = []; - count = []; - for (k = 0; k < data[0][1].length; k++) { - sum.push(0); - count.push(0); + // Find out if data has multiple values per datapoint. + // Go to first data point that actually has values (see http://code.google.com/p/dygraphs/issues/detail?id=246) + for (i = 0; i < data.length; i++) { + if (data[i].length > 1 && data[i][1] != null) { + mutipleValues = typeof data[i][1] != 'number'; + if (mutipleValues) { + sum = []; + count = []; + for (k = 0; k < data[i][1].length; k++) { + sum.push(0); + count.push(0); + } + } + break; } - mutipleValues = true; } for (i = 0; i < data.length; i++) {