From: Dan Vanderkam Date: Sun, 23 Nov 2014 05:25:49 +0000 (-0500) Subject: use " " instead of " " X-Git-Tag: v1.1.0~9^2~3 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=0b85865a8b8c34b1d63f11bad02360e96ad8e02a;p=dygraphs.git use " " instead of " " --- diff --git a/auto_tests/tests/Util.js b/auto_tests/tests/Util.js index d8d94fc..305ed47 100644 --- a/auto_tests/tests/Util.js +++ b/auto_tests/tests/Util.js @@ -16,7 +16,7 @@ Util.getYLabels = function(axis_num, parent) { var y_labels = parent.getElementsByClassName("dygraph-axis-label-y" + axis_num); var ary = []; for (var i = 0; i < y_labels.length; i++) { - ary.push(y_labels[i].innerHTML.replace(/ /g, ' ')); + ary.push(y_labels[i].innerHTML.replace(/ | /g, ' ')); } return ary; }; @@ -31,7 +31,7 @@ Util.getXLabels = function(parent) { var x_labels = parent.getElementsByClassName("dygraph-axis-label-x"); var ary = []; for (var i = 0; i < x_labels.length; i++) { - ary.push(x_labels[i].innerHTML.replace(/ /g, ' ')); + ary.push(x_labels[i].innerHTML.replace(/ | /g, ' ')); } return ary; }; diff --git a/auto_tests/tests/date_ticker.js b/auto_tests/tests/date_ticker.js index 3773970..6150490 100644 --- a/auto_tests/tests/date_ticker.js +++ b/auto_tests/tests/date_ticker.js @@ -28,11 +28,11 @@ DateTickerTestCase.prototype.createOptionsViewForAxis = function(axis, dict) { }; }; -// Change ' ' to ' ' in all labels. Cleans up expected values. +// Change ' ' (non-breaking space) to ' ' in all labels. Cleans up expected values. function changeNbspToSpace(ticks) { for (var i = 0; i < ticks.length; i++) { if (ticks[i].label) { - ticks[i].label = ticks[i].label.replace(/ /g, ' '); + ticks[i].label = ticks[i].label.replace(/ /g, ' '); } } } diff --git a/dygraph.js b/dygraph.js index cf13a59..d1d4a5d 100644 --- a/dygraph.js +++ b/dygraph.js @@ -226,12 +226,12 @@ Dygraph.dateAxisLabelFormatter = function(date, granularity, opts) { if (granularity >= Dygraph.DECADAL) { return '' + year; } else if (granularity >= Dygraph.MONTHLY) { - return Dygraph.SHORT_MONTH_NAMES_[month] + ' ' + year; + return Dygraph.SHORT_MONTH_NAMES_[month] + ' ' + year; } else { var frac = hours * 3600 + mins * 60 + secs + 1e-3 * millis; if (frac === 0 || granularity >= Dygraph.DAILY) { // e.g. '21 Jan' (%d%b) - return Dygraph.zeropad(day) + ' ' + Dygraph.SHORT_MONTH_NAMES_[month]; + return Dygraph.zeropad(day) + ' ' + Dygraph.SHORT_MONTH_NAMES_[month]; } else { return Dygraph.hmsString_(hours, mins, secs); }