From: Neal Nelson Date: Tue, 7 Dec 2010 13:37:49 +0000 (+0100) Subject: Merge branch 'master' of http://github.com/danvk/dygraphs X-Git-Tag: v1.0.0~536^2~1^2~13 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=a593879d42f14356ba6ff9c213d9d64f32d1714c;hp=57baab0329f90475370bce7b76a6720a7f73e4f1;p=dygraphs.git Merge branch 'master' of github.com/danvk/dygraphs Conflicts: tests/zoom.html --- diff --git a/README b/README index e800692..f219587 100644 --- a/README +++ b/README @@ -1,6 +1,7 @@ dygraphs JavaScript charting library Copyright (c) 2006-, Dan Vanderkam. +Documentation: http://dygraphs.com/ Support: http://groups.google.com/group/dygraphs-users Source: http://github.com/danvk/dygraphs Issues: http://code.google.com/p/dygraphs/ @@ -19,7 +20,7 @@ Features - Compatible with the Google Visualization API Demo -For a gallery and documentation, see http://danvk.org/dygraphs/ +For a gallery and documentation, see http://dygraphs.com/ Minimal Example diff --git a/docs/index.html b/docs/index.html index adc7c15..b9eff54 100644 --- a/docs/index.html +++ b/docs/index.html @@ -625,9 +625,9 @@ perl -ne 'BEGIN{print "Month,Nominal,Real\n"} chomp; ($m,$cpi,$low,$close,$high) zoomCallback - function(minDate,
maxDate,
minValue,
maxValue){}
+ function(minDate,
maxDate,
yRanges){}
null - A function to call when the zoom window is changed (either by zooming in or out). minDate and maxDate are milliseconds since epoch. minValue and maxValue are y-axis range values. + A function to call when the zoom window is changed (either by zooming in or out). minDate and maxDate are milliseconds since epoch. yRanges is an array of [bottom, top] pairs, one for each y-axis.
Tests: callback zoom
diff --git a/dygraph-combined.js b/dygraph-combined.js index d051df1..e6380de 100644 --- a/dygraph-combined.js +++ b/dygraph-combined.js @@ -1,5 +1,5 @@ This is not the file you are looking for. -A reasonably up-to-date version can be found at http://danvk.org/dygraphs/dygraph-combined.js +A reasonably up-to-date version can be found at http://dygraphs.com/dygraph-combined.js dygraph-combined.js is a "packed" version of the larger dygraphs JS files. It is smaller and loads more quickly, but is harder to debug. diff --git a/dygraph.js b/dygraph.js index f63fbc7..40a43c8 100644 --- a/dygraph.js +++ b/dygraph.js @@ -37,7 +37,7 @@ And error bars will be calculated automatically using a binomial distribution. - For further documentation and examples, see http://www.danvk.org/dygraphs + For further documentation and examples, see http://dygraphs.com/ */ @@ -1099,8 +1099,7 @@ Dygraph.prototype.doZoomXDates_ = function(minDate, maxDate) { this.zoomed_x_ = true; this.drawGraph_(); if (this.attr_("zoomCallback")) { - var yRange = this.yAxisRange(); - this.attr_("zoomCallback")(minDate, maxDate, yRange[0], yRange[1]); + this.attr_("zoomCallback")(minDate, maxDate, this.yAxisRanges()); } }; @@ -2446,7 +2445,8 @@ Dygraph.prototype.parseCSV_ = function(data) { // Parse the x as a float or return null if it's not a number. var parseFloatOrNull = function(x) { var val = parseFloat(x); - return isNaN(val) ? null : val; + // isFinite() returns false for NaN and +/-Infinity. + return isFinite(val) ? val : null; }; var xParser; @@ -2678,6 +2678,11 @@ Dygraph.prototype.parseDataTable_ = function(data) { if (ret.length > 0 && row[0] < ret[ret.length - 1][0]) { outOfOrder = true; } + + // Strip out infinities, which give dygraphs problems later on. + for (var j = 0; j < row.length; j++) { + if (!isFinite(row[j])) row[j] = null; + } ret.push(row); } diff --git a/gadget.xml b/gadget.xml index 3cca999..83a793c 100644 --- a/gadget.xml +++ b/gadget.xml @@ -6,7 +6,7 @@ description="Interactive, zoomable chart" author="Dan Vanderkam" author_email="danvdk@gmail.com" - thumbnail="http://danvk.org/dygraphs/thumbnail.png" + thumbnail="http://dygraphs.com/thumbnail.png" > - +
diff --git a/tests/callback.html b/tests/callback.html index 04ed8ea..3a14ff3 100644 --- a/tests/callback.html +++ b/tests/callback.html @@ -81,8 +81,8 @@ s.innerHTML += "Point Click " + p.name + ": " + p.x + "
"; }, - zoomCallback: function(minX, maxX) { - s.innerHTML += "Zoom [" + minX + ", " + maxX + "]
"; + zoomCallback: function(minX, maxX, yRanges) { + s.innerHTML += "Zoom [" + minX + ", " + maxX + ", [" + yRanges + "]]
"; }, drawCallback: function(g) { diff --git a/tests/gviz-infinity.html b/tests/gviz-infinity.html new file mode 100644 index 0000000..9361a97 --- /dev/null +++ b/tests/gviz-infinity.html @@ -0,0 +1,62 @@ + + + gviz + + + + + + + + + +

This tests that infinite values don't break dygraphs.

+

gviz line chart:

+
+ +

same data drawn using dygraphs:

+ date column: +
+ + diff --git a/tests/zoom.html b/tests/zoom.html index d428d19..d37a26d 100644 --- a/tests/zoom.html +++ b/tests/zoom.html @@ -46,8 +46,8 @@ document.getElementById("div_g"), NoisyData, { errorBars: true, - zoomCallback : function(a,b,c,d) { - showDimensions(a,b,c,d); + zoomCallback : function(minDate, maxDate, yRange) { + showDimensions(minDate, maxDate, yRange); }, drawCallback: function(me, initial) { document.getElementById("zoomed").innerHTML = "" + me.isZoomed(); @@ -63,13 +63,12 @@ // Pull an initial value for logging. var minDate = g.xAxisRange()[0]; var maxDate = g.xAxisRange()[1]; - var minValue = g.yAxisRange()[0]; - var maxValue = g.yAxisRange()[1]; - showDimensions(minDate, maxDate, minValue, maxValue); + var minValue = g.yAxisRange(); + showDimensions(minDate, maxDate, yAxisRange); - function showDimensions(minDate, maxDate, minValue, maxValue) { - showXDimensions(minDate, maxDate); - showYDimensions(minValue, maxValue); + function showDimensions(minDate, maxDate, yAxisRange) { + showXDimensions(minDate, maxDate); + showYDimensions(yAxisRange); } function showXDimensions(first, second) { @@ -77,23 +76,23 @@ elem.innerHTML = "dateWindow : [" + first + ", "+ second + "]"; } - function showYDimensions(first, second) { + function showYDimensions(range) { var elem = document.getElementById("ydimensions"); - elem.innerHTML = "valueRange : [" + first + ", "+ second + "]"; + elem.innerHTML = "valueRange : [" + range + "]"; } function zoomGraphX(minDate, maxDate) { g.updateOptions({ dateWindow: [minDate, maxDate] }); - showXDimensions(minDate, maxDate); + showXDimensions(minDate, maxDate); } function zoomGraphY(minValue, maxValue) { g.updateOptions({ valueRange: [minValue, maxValue] }); - showYDimensions(minValue, maxValue); + showYDimensions(minValue, maxValue); } function unzoomGraph() {