d3_rails 2.8.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.DS_Store +0 -0
- data/README.md +27 -5
- data/lib/d3_rails/version.rb +1 -1
- data/vendor/.DS_Store +0 -0
- data/vendor/assets/.DS_Store +0 -0
- data/vendor/assets/javascripts/.DS_Store +0 -0
- data/vendor/assets/javascripts/d3.v2.js +99 -80
- data/vendor/assets/javascripts/morris.js +1 -0
- data/vendor/assets/javascripts/morris/.DS_Store +0 -0
- data/vendor/assets/javascripts/morris/Makefile +10 -0
- data/vendor/assets/javascripts/morris/README.md +87 -0
- data/vendor/assets/javascripts/morris/examples/_template.html +18 -0
- data/vendor/assets/javascripts/morris/examples/days.html +36 -0
- data/vendor/assets/javascripts/morris/examples/decimal.html +31 -0
- data/vendor/assets/javascripts/morris/examples/lib/example.css +13 -0
- data/vendor/assets/javascripts/morris/examples/lib/example.js +4 -0
- data/vendor/assets/javascripts/morris/examples/lib/prettify.css +1 -0
- data/vendor/assets/javascripts/morris/examples/lib/prettify.js +28 -0
- data/vendor/assets/javascripts/morris/examples/months-no-smooth.html +37 -0
- data/vendor/assets/javascripts/morris/examples/negative.html +35 -0
- data/vendor/assets/javascripts/morris/examples/non-date.html +36 -0
- data/vendor/assets/javascripts/morris/examples/quarters.html +53 -0
- data/vendor/assets/javascripts/morris/examples/timestamps.html +37 -0
- data/vendor/assets/javascripts/morris/examples/weeks.html +52 -0
- data/vendor/assets/javascripts/morris/morris.coffee +444 -0
- data/vendor/assets/javascripts/morris/morris.js +493 -0
- data/vendor/assets/javascripts/morris/morris.min.js +1 -0
- data/vendor/assets/javascripts/tesseract.js +1 -0
- data/vendor/assets/javascripts/tesseract/.gitignore +2 -0
- data/vendor/assets/javascripts/tesseract/LICENSE +12 -0
- data/vendor/assets/javascripts/tesseract/Makefile +48 -0
- data/vendor/assets/javascripts/tesseract/README.md +11 -0
- data/vendor/assets/javascripts/tesseract/index.js +1 -0
- data/vendor/assets/javascripts/tesseract/lib/dart/AUTHORS +9 -0
- data/vendor/assets/javascripts/tesseract/lib/dart/LICENSE +25 -0
- data/vendor/assets/javascripts/tesseract/lib/dart/dual_pivot_quicksort.dart +342 -0
- data/vendor/assets/javascripts/tesseract/package.json +11 -0
- data/vendor/assets/javascripts/tesseract/src/array.js +32 -0
- data/vendor/assets/javascripts/tesseract/src/bisect.js +44 -0
- data/vendor/assets/javascripts/tesseract/src/filter.js +19 -0
- data/vendor/assets/javascripts/tesseract/src/heap.js +44 -0
- data/vendor/assets/javascripts/tesseract/src/heapselect.js +36 -0
- data/vendor/assets/javascripts/tesseract/src/identity.js +3 -0
- data/vendor/assets/javascripts/tesseract/src/insertionsort.js +18 -0
- data/vendor/assets/javascripts/tesseract/src/null.js +3 -0
- data/vendor/assets/javascripts/tesseract/src/package.js +14 -0
- data/vendor/assets/javascripts/tesseract/src/permute.js +8 -0
- data/vendor/assets/javascripts/tesseract/src/quicksort.js +282 -0
- data/vendor/assets/javascripts/tesseract/src/reduce.js +19 -0
- data/vendor/assets/javascripts/tesseract/src/tesseract.js +663 -0
- data/vendor/assets/javascripts/tesseract/src/version.js +1 -0
- data/vendor/assets/javascripts/tesseract/src/zero.js +3 -0
- data/vendor/assets/javascripts/tesseract/tesseract.js +1177 -0
- data/vendor/assets/javascripts/tesseract/tesseract.min.js +1 -0
- data/vendor/assets/javascripts/tesseract/test/benchmark.js +177 -0
- data/vendor/assets/javascripts/tesseract/test/bisect-test.js +206 -0
- data/vendor/assets/javascripts/tesseract/test/heap-test.js +44 -0
- data/vendor/assets/javascripts/tesseract/test/permute-test.js +51 -0
- data/vendor/assets/javascripts/tesseract/test/select-test.js +63 -0
- data/vendor/assets/javascripts/tesseract/test/sort-test.js +83 -0
- data/vendor/assets/javascripts/tesseract/test/tesseract-test.js +655 -0
- data/vendor/assets/javascripts/tesseract/test/version-test.js +16 -0
- metadata +63 -8
data/.DS_Store
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
**D3_Rails** is a small, lightweight gem which allows you to include any
|
4
4
|
and all of D3 Javascripts into your 3.1 Rails application, merely by
|
5
|
-
including any desired D3 files into your application.js manifest.
|
5
|
+
including any desired D3 files into your application.js manifest. You can
|
6
|
+
also include supplemental libraries to your rails app, such as 'morris.js'
|
7
|
+
and 'tesseract.js' by including them in your manifest.
|
6
8
|
|
7
9
|
# About D3
|
8
10
|
|
@@ -14,8 +16,8 @@ or you can use it to build dynamic pages (like jQuery).
|
|
14
16
|
|
15
17
|
# D3 Version
|
16
18
|
|
17
|
-
The current release of this gem is using **D3 v=2.8** (though for convenience I have left version 2.7.5 in the gem so you can still include your modules manually since rails will compile your javascripts into one file in the end anyway)
|
18
|
-
**Last Updated
|
19
|
+
The current release of this gem is using **D3 v=2.8.1** (though for convenience I have left version 2.7.5 in the gem so you can still include your modules manually since rails will compile your javascripts into one file in the end anyway)
|
20
|
+
**Last Updated 3-22-2012**
|
19
21
|
|
20
22
|
# Included Javascripts
|
21
23
|
**minified js files are not included, since the rails asset pipeline sorta necessitates the compiling (and likely minifying) your js files for production**
|
@@ -32,7 +34,15 @@ The current release of this gem is using **D3 v=2.8** (though for convenience I
|
|
32
34
|
science.lin.js
|
33
35
|
science.stats.js
|
34
36
|
|
35
|
-
|
37
|
+
## Additional modules:
|
38
|
+
|
39
|
+
There are a few additional modules/js libraries included for convenience in this gem:
|
40
|
+
|
41
|
+
morris.js
|
42
|
+
tesseract.js
|
43
|
+
d3 charting module
|
44
|
+
|
45
|
+
## D3 charting module
|
36
46
|
|
37
47
|
** D3 charts can be be included in your rails application by including the following line in your javascripts manifest **
|
38
48
|
|
@@ -45,7 +55,19 @@ This will include the following javascripts to your application:
|
|
45
55
|
chart.js
|
46
56
|
horizon.js
|
47
57
|
qq.js
|
48
|
-
|
58
|
+
|
59
|
+
## Tesseract
|
60
|
+
|
61
|
+
** Tesseract can be be included in your rails application by including the following line in your javascripts manifest **
|
62
|
+
|
63
|
+
//= require tesseract
|
64
|
+
|
65
|
+
## Morris
|
66
|
+
|
67
|
+
** Morris can also be included in your application with the following additional line of code for your javascripts manifest.
|
68
|
+
|
69
|
+
//= require morris
|
70
|
+
|
49
71
|
### Installation
|
50
72
|
|
51
73
|
This gem should work out of the box. All you have to do is add the gem to your Gemfile:
|
data/lib/d3_rails/version.rb
CHANGED
data/vendor/.DS_Store
CHANGED
Binary file
|
data/vendor/assets/.DS_Store
CHANGED
Binary file
|
Binary file
|
@@ -10,7 +10,7 @@ try {
|
|
10
10
|
d3_style_setProperty.call(this, name, value + "", priority);
|
11
11
|
};
|
12
12
|
}
|
13
|
-
d3 = {version: "2.8.
|
13
|
+
d3 = {version: "2.8.1"}; // semver
|
14
14
|
function d3_class(ctor, properties) {
|
15
15
|
try {
|
16
16
|
for (var key in properties) {
|
@@ -2041,11 +2041,11 @@ d3_selectionPrototype.transition = function() {
|
|
2041
2041
|
for (var j = -1, m = this.length; ++j < m;) {
|
2042
2042
|
subgroups.push(subgroup = []);
|
2043
2043
|
for (var group = this[j], i = -1, n = group.length; ++i < n;) {
|
2044
|
-
subgroup.push((node = group[i]) ? {node: node, delay:
|
2044
|
+
subgroup.push((node = group[i]) ? {node: node, delay: d3_transitionDelay, duration: d3_transitionDuration} : null);
|
2045
2045
|
}
|
2046
2046
|
}
|
2047
2047
|
|
2048
|
-
return d3_transition(subgroups,
|
2048
|
+
return d3_transition(subgroups, d3_transitionId || ++d3_transitionNextId, Date.now());
|
2049
2049
|
};
|
2050
2050
|
var d3_selectionRoot = d3_selection([[document]]);
|
2051
2051
|
|
@@ -2173,9 +2173,9 @@ function d3_transition(groups, id, time) {
|
|
2173
2173
|
|
2174
2174
|
if (t >= 1) {
|
2175
2175
|
stop();
|
2176
|
-
|
2176
|
+
d3_transitionId = id;
|
2177
2177
|
event.end.call(node, d, i);
|
2178
|
-
|
2178
|
+
d3_transitionId = 0;
|
2179
2179
|
return 1;
|
2180
2180
|
}
|
2181
2181
|
}
|
@@ -2217,14 +2217,21 @@ function d3_transitionTween(name, b) {
|
|
2217
2217
|
}
|
2218
2218
|
|
2219
2219
|
var d3_transitionPrototype = [],
|
2220
|
+
d3_transitionNextId = 0,
|
2220
2221
|
d3_transitionId = 0,
|
2221
|
-
|
2222
|
-
|
2222
|
+
d3_transitionDefaultDelay = 0,
|
2223
|
+
d3_transitionDefaultDuration = 250,
|
2224
|
+
d3_transitionDefaultEase = d3.ease("cubic-in-out"),
|
2225
|
+
d3_transitionDelay = d3_transitionDefaultDelay,
|
2226
|
+
d3_transitionDuration = d3_transitionDefaultDuration,
|
2227
|
+
d3_transitionEase = d3_transitionDefaultEase;
|
2223
2228
|
|
2224
2229
|
d3_transitionPrototype.call = d3_selectionPrototype.call;
|
2225
2230
|
|
2226
|
-
d3.transition = function() {
|
2227
|
-
return
|
2231
|
+
d3.transition = function(selection) {
|
2232
|
+
return arguments.length
|
2233
|
+
? (d3_transitionId ? selection.transition() : selection)
|
2234
|
+
: d3_selectionRoot.transition();
|
2228
2235
|
};
|
2229
2236
|
|
2230
2237
|
d3.transition.prototype = d3_transitionPrototype;
|
@@ -2335,12 +2342,28 @@ d3_transitionPrototype.duration = function(value) {
|
|
2335
2342
|
: (value = Math.max(1, value | 0), function(d, i, j) { groups[j][i].duration = value; }));
|
2336
2343
|
};
|
2337
2344
|
function d3_transition_each(callback) {
|
2345
|
+
var id = d3_transitionId,
|
2346
|
+
ease = d3_transitionEase,
|
2347
|
+
delay = d3_transitionDelay,
|
2348
|
+
duration = d3_transitionDuration;
|
2349
|
+
|
2350
|
+
d3_transitionId = this.id;
|
2351
|
+
d3_transitionEase = this.ease();
|
2338
2352
|
for (var j = 0, m = this.length; j < m; j++) {
|
2339
2353
|
for (var group = this[j], i = 0, n = group.length; i < n; i++) {
|
2340
2354
|
var node = group[i];
|
2341
|
-
if (node)
|
2355
|
+
if (node) {
|
2356
|
+
d3_transitionDelay = this[j][i].delay;
|
2357
|
+
d3_transitionDuration = this[j][i].duration;
|
2358
|
+
callback.call(node = node.node, node.__data__, i, j);
|
2359
|
+
}
|
2342
2360
|
}
|
2343
2361
|
}
|
2362
|
+
|
2363
|
+
d3_transitionId = id;
|
2364
|
+
d3_transitionEase = ease;
|
2365
|
+
d3_transitionDelay = delay;
|
2366
|
+
d3_transitionDuration = duration;
|
2344
2367
|
return this;
|
2345
2368
|
}
|
2346
2369
|
d3_transitionPrototype.transition = function() {
|
@@ -4026,24 +4049,10 @@ d3.svg.axis = function() {
|
|
4026
4049
|
tickFormat_,
|
4027
4050
|
tickSubdivide = 0;
|
4028
4051
|
|
4029
|
-
function axis(
|
4030
|
-
|
4052
|
+
function axis(g) {
|
4053
|
+
g.each(function() {
|
4031
4054
|
var g = d3.select(this);
|
4032
4055
|
|
4033
|
-
// If selection is a transition, create subtransitions.
|
4034
|
-
var transition = selection.delay ? function(o) {
|
4035
|
-
var id = d3_transitionInheritId;
|
4036
|
-
try {
|
4037
|
-
d3_transitionInheritId = selection.id;
|
4038
|
-
return o.transition()
|
4039
|
-
.delay(selection[j][i].delay)
|
4040
|
-
.duration(selection[j][i].duration)
|
4041
|
-
.ease(selection.ease());
|
4042
|
-
} finally {
|
4043
|
-
d3_transitionInheritId = id;
|
4044
|
-
}
|
4045
|
-
} : Object;
|
4046
|
-
|
4047
4056
|
// Ticks, or domain values for ordinal scales.
|
4048
4057
|
var ticks = tickValues == null ? (scale.ticks ? scale.ticks.apply(scale, tickArguments_) : scale.domain()) : tickValues,
|
4049
4058
|
tickFormat = tickFormat_ == null ? (scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments_) : String) : tickFormat_;
|
@@ -4052,21 +4061,21 @@ d3.svg.axis = function() {
|
|
4052
4061
|
var subticks = d3_svg_axisSubdivide(scale, ticks, tickSubdivide),
|
4053
4062
|
subtick = g.selectAll(".minor").data(subticks, String),
|
4054
4063
|
subtickEnter = subtick.enter().insert("line", "g").attr("class", "tick minor").style("opacity", 1e-6),
|
4055
|
-
subtickExit = transition(subtick.exit()).style("opacity", 1e-6).remove(),
|
4056
|
-
subtickUpdate = transition(subtick).style("opacity", 1);
|
4064
|
+
subtickExit = d3.transition(subtick.exit()).style("opacity", 1e-6).remove(),
|
4065
|
+
subtickUpdate = d3.transition(subtick).style("opacity", 1);
|
4057
4066
|
|
4058
4067
|
// Major ticks.
|
4059
4068
|
var tick = g.selectAll("g").data(ticks, String),
|
4060
4069
|
tickEnter = tick.enter().insert("g", "path").style("opacity", 1e-6),
|
4061
|
-
tickExit = transition(tick.exit()).style("opacity", 1e-6).remove(),
|
4062
|
-
tickUpdate = transition(tick).style("opacity", 1),
|
4070
|
+
tickExit = d3.transition(tick.exit()).style("opacity", 1e-6).remove(),
|
4071
|
+
tickUpdate = d3.transition(tick).style("opacity", 1),
|
4063
4072
|
tickTransform;
|
4064
4073
|
|
4065
4074
|
// Domain.
|
4066
4075
|
var range = d3_scaleRange(scale),
|
4067
4076
|
path = g.selectAll(".domain").data([0]),
|
4068
4077
|
pathEnter = path.enter().append("path").attr("class", "domain"),
|
4069
|
-
pathUpdate = transition(path);
|
4078
|
+
pathUpdate = d3.transition(path);
|
4070
4079
|
|
4071
4080
|
// Stash a snapshot of the new scale, and retrieve the old snapshot.
|
4072
4081
|
var scale1 = scale.copy(),
|
@@ -4235,10 +4244,11 @@ function d3_svg_axisSubdivide(scale, ticks, m) {
|
|
4235
4244
|
}
|
4236
4245
|
d3.svg.brush = function() {
|
4237
4246
|
var event = d3_eventDispatch(brush, "brushstart", "brush", "brushend"),
|
4238
|
-
x, // x-scale, optional
|
4239
|
-
y, // y-scale, optional
|
4247
|
+
x = null, // x-scale, optional
|
4248
|
+
y = null, // y-scale, optional
|
4240
4249
|
resizes = d3_svg_brushResizes[0],
|
4241
|
-
extent = [[0, 0], [0, 0]]
|
4250
|
+
extent = [[0, 0], [0, 0]], // [x0, y0], [x1, y1], in pixels (integers)
|
4251
|
+
extentDomain; // the extent in data space, lazily created
|
4242
4252
|
|
4243
4253
|
function brush(g) {
|
4244
4254
|
g.each(function() {
|
@@ -4428,7 +4438,7 @@ d3.svg.brush = function() {
|
|
4428
4438
|
// Final redraw and notify listeners.
|
4429
4439
|
if (moved) {
|
4430
4440
|
redraw(g);
|
4431
|
-
event_({type: "brush"});
|
4441
|
+
event_({type: "brush", mode: dragging ? "move" : "resize"});
|
4432
4442
|
}
|
4433
4443
|
}
|
4434
4444
|
|
@@ -4469,6 +4479,7 @@ d3.svg.brush = function() {
|
|
4469
4479
|
|
4470
4480
|
// Update the stored bounds.
|
4471
4481
|
if (extent[0][i] !== min || extent[1][i] !== max) {
|
4482
|
+
extentDomain = null;
|
4472
4483
|
extent[0][i] = min;
|
4473
4484
|
extent[1][i] = max;
|
4474
4485
|
return true;
|
@@ -4513,39 +4524,50 @@ d3.svg.brush = function() {
|
|
4513
4524
|
|
4514
4525
|
// Invert the pixel extent to data-space.
|
4515
4526
|
if (!arguments.length) {
|
4527
|
+
z = extentDomain || extent;
|
4516
4528
|
if (x) {
|
4517
|
-
x0 =
|
4518
|
-
if (
|
4519
|
-
|
4529
|
+
x0 = z[0][0], x1 = z[1][0];
|
4530
|
+
if (!extentDomain) {
|
4531
|
+
x0 = extent[0][0], x1 = extent[1][0];
|
4532
|
+
if (x.invert) x0 = x.invert(x0), x1 = x.invert(x1);
|
4533
|
+
if (x1 < x0) t = x0, x0 = x1, x1 = t;
|
4534
|
+
}
|
4520
4535
|
}
|
4521
4536
|
if (y) {
|
4522
|
-
y0 =
|
4523
|
-
if (
|
4524
|
-
|
4537
|
+
y0 = z[0][1], y1 = z[1][1];
|
4538
|
+
if (!extentDomain) {
|
4539
|
+
y0 = extent[0][1], y1 = extent[1][1];
|
4540
|
+
if (y.invert) y0 = y.invert(y0), y1 = y.invert(y1);
|
4541
|
+
if (y1 < y0) t = y0, y0 = y1, y1 = t;
|
4542
|
+
}
|
4525
4543
|
}
|
4526
4544
|
return x && y ? [[x0, y0], [x1, y1]] : x ? [x0, x1] : y && [y0, y1];
|
4527
4545
|
}
|
4528
4546
|
|
4529
4547
|
// Scale the data-space extent to pixels.
|
4548
|
+
extentDomain = [[0, 0], [0, 0]];
|
4530
4549
|
if (x) {
|
4531
4550
|
x0 = z[0], x1 = z[1];
|
4532
4551
|
if (y) x0 = x0[0], x1 = x1[0];
|
4552
|
+
extentDomain[0][0] = x0, extentDomain[1][0] = x1;
|
4533
4553
|
if (x.invert) x0 = x(x0), x1 = x(x1);
|
4534
4554
|
if (x1 < x0) t = x0, x0 = x1, x1 = t;
|
4535
|
-
extent[0][0] = x0, extent[1][0] = x1;
|
4555
|
+
extent[0][0] = x0 | 0, extent[1][0] = x1 | 0;
|
4536
4556
|
}
|
4537
4557
|
if (y) {
|
4538
4558
|
y0 = z[0], y1 = z[1];
|
4539
4559
|
if (x) y0 = y0[1], y1 = y1[1];
|
4560
|
+
extentDomain[0][1] = y0, extentDomain[1][1] = y1;
|
4540
4561
|
if (y.invert) y0 = y(y0), y1 = y(y1);
|
4541
4562
|
if (y1 < y0) t = y0, y0 = y1, y1 = t;
|
4542
|
-
extent[0][1] = y0, extent[1][1] = y1;
|
4563
|
+
extent[0][1] = y0 | 0, extent[1][1] = y1 | 0;
|
4543
4564
|
}
|
4544
4565
|
|
4545
4566
|
return brush;
|
4546
4567
|
};
|
4547
4568
|
|
4548
4569
|
brush.clear = function() {
|
4570
|
+
extentDomain = null;
|
4549
4571
|
extent[0][0] =
|
4550
4572
|
extent[0][1] =
|
4551
4573
|
extent[1][0] =
|
@@ -8640,16 +8662,18 @@ d3_time_utc.prototype = {
|
|
8640
8662
|
getTime: function() { return this._.getTime(); },
|
8641
8663
|
getTimezoneOffset: function() { return 0; },
|
8642
8664
|
valueOf: function() { return this._.valueOf(); },
|
8643
|
-
setDate: function(
|
8644
|
-
setDay: function(
|
8645
|
-
setFullYear: function(
|
8646
|
-
setHours: function(
|
8647
|
-
setMilliseconds: function(
|
8648
|
-
setMinutes: function(
|
8649
|
-
setMonth: function(
|
8650
|
-
setSeconds: function(
|
8651
|
-
setTime: function(
|
8652
|
-
};
|
8665
|
+
setDate: function() { d3_time_prototype.setUTCDate.apply(this._, arguments); },
|
8666
|
+
setDay: function() { d3_time_prototype.setUTCDay.apply(this._, arguments); },
|
8667
|
+
setFullYear: function() { d3_time_prototype.setUTCFullYear.apply(this._, arguments); },
|
8668
|
+
setHours: function() { d3_time_prototype.setUTCHours.apply(this._, arguments); },
|
8669
|
+
setMilliseconds: function() { d3_time_prototype.setUTCMilliseconds.apply(this._, arguments); },
|
8670
|
+
setMinutes: function() { d3_time_prototype.setUTCMinutes.apply(this._, arguments); },
|
8671
|
+
setMonth: function() { d3_time_prototype.setUTCMonth.apply(this._, arguments); },
|
8672
|
+
setSeconds: function() { d3_time_prototype.setUTCSeconds.apply(this._, arguments); },
|
8673
|
+
setTime: function() { d3_time_prototype.setTime.apply(this._, arguments); }
|
8674
|
+
};
|
8675
|
+
|
8676
|
+
var d3_time_prototype = Date.prototype;
|
8653
8677
|
d3.time.format = function(template) {
|
8654
8678
|
var n = template.length;
|
8655
8679
|
|
@@ -8673,15 +8697,16 @@ d3.time.format = function(template) {
|
|
8673
8697
|
}
|
8674
8698
|
|
8675
8699
|
format.parse = function(string) {
|
8676
|
-
var
|
8677
|
-
i = d3_time_parse(
|
8700
|
+
var d = {y: 1900, m: 0, d: 1, H: 0, M: 0, S: 0, L: 0},
|
8701
|
+
i = d3_time_parse(d, template, string, 0);
|
8678
8702
|
if (i != string.length) return null;
|
8679
|
-
|
8680
|
-
|
8681
|
-
|
8682
|
-
|
8683
|
-
|
8684
|
-
|
8703
|
+
|
8704
|
+
// The am-pm flag is 0 for AM, and 1 for PM.
|
8705
|
+
if ("p" in d) d.H = d.H % 12 + d.p * 12;
|
8706
|
+
|
8707
|
+
var date = new d3_time();
|
8708
|
+
date.setFullYear(d.y, d.m, d.d);
|
8709
|
+
date.setHours(d.H, d.M, d.S, d.L);
|
8685
8710
|
return date;
|
8686
8711
|
};
|
8687
8712
|
|
@@ -8752,7 +8777,7 @@ var d3_time_parsers = {
|
|
8752
8777
|
d: d3_time_parseDay,
|
8753
8778
|
e: d3_time_parseDay,
|
8754
8779
|
H: d3_time_parseHour24,
|
8755
|
-
I:
|
8780
|
+
I: d3_time_parseHour24,
|
8756
8781
|
// j: function(d, s, i) { /*TODO day of year [001,366] */ return i; },
|
8757
8782
|
L: d3_time_parseMilliseconds,
|
8758
8783
|
m: d3_time_parseMonthNumber,
|
@@ -8789,7 +8814,7 @@ var d3_time_weekdayAbbrevRe = /^(?:sun|mon|tue|wed|thu|fri|sat)/i,
|
|
8789
8814
|
|
8790
8815
|
function d3_time_parseMonthAbbrev(date, string, i) {
|
8791
8816
|
var n = d3_time_monthAbbrevLookup.get(string.substring(i, i += 3).toLowerCase());
|
8792
|
-
return n == null ? -1 : (date.
|
8817
|
+
return n == null ? -1 : (date.m = n, i);
|
8793
8818
|
}
|
8794
8819
|
|
8795
8820
|
var d3_time_monthAbbrevLookup = d3.map({
|
@@ -8810,7 +8835,7 @@ var d3_time_monthAbbrevLookup = d3.map({
|
|
8810
8835
|
function d3_time_parseMonth(date, string, i) {
|
8811
8836
|
d3_time_monthRe.lastIndex = 0;
|
8812
8837
|
var n = d3_time_monthRe.exec(string.substring(i, i + 12));
|
8813
|
-
return n ? (date.
|
8838
|
+
return n ? (date.m = d3_time_monthLookup.get(n[0].toLowerCase()), i += n[0].length) : -1;
|
8814
8839
|
}
|
8815
8840
|
|
8816
8841
|
var d3_time_monthRe = /^(?:January|February|March|April|May|June|July|August|September|October|November|December)/ig;
|
@@ -8860,13 +8885,13 @@ function d3_time_parseLocaleTime(date, string, i) {
|
|
8860
8885
|
function d3_time_parseFullYear(date, string, i) {
|
8861
8886
|
d3_time_numberRe.lastIndex = 0;
|
8862
8887
|
var n = d3_time_numberRe.exec(string.substring(i, i + 4));
|
8863
|
-
return n ? (date.
|
8888
|
+
return n ? (date.y = +n[0], i += n[0].length) : -1;
|
8864
8889
|
}
|
8865
8890
|
|
8866
8891
|
function d3_time_parseYear(date, string, i) {
|
8867
8892
|
d3_time_numberRe.lastIndex = 0;
|
8868
8893
|
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
|
8869
|
-
return n ? (date.
|
8894
|
+
return n ? (date.y = d3_time_century() + +n[0], i += n[0].length) : -1;
|
8870
8895
|
}
|
8871
8896
|
|
8872
8897
|
function d3_time_century() {
|
@@ -8876,44 +8901,38 @@ function d3_time_century() {
|
|
8876
8901
|
function d3_time_parseMonthNumber(date, string, i) {
|
8877
8902
|
d3_time_numberRe.lastIndex = 0;
|
8878
8903
|
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
|
8879
|
-
return n ? (date.
|
8904
|
+
return n ? (date.m = n[0] - 1, i += n[0].length) : -1;
|
8880
8905
|
}
|
8881
8906
|
|
8882
8907
|
function d3_time_parseDay(date, string, i) {
|
8883
8908
|
d3_time_numberRe.lastIndex = 0;
|
8884
8909
|
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
|
8885
|
-
return n ? (date.
|
8910
|
+
return n ? (date.d = +n[0], i += n[0].length) : -1;
|
8886
8911
|
}
|
8887
8912
|
|
8888
|
-
// Note: we don't validate that the hour is in the range [0,23].
|
8913
|
+
// Note: we don't validate that the hour is in the range [0,23] or [1,12].
|
8889
8914
|
function d3_time_parseHour24(date, string, i) {
|
8890
8915
|
d3_time_numberRe.lastIndex = 0;
|
8891
8916
|
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
|
8892
|
-
return n ? (date.
|
8893
|
-
}
|
8894
|
-
|
8895
|
-
// Note: we don't validate that the hour is in the range [1,12].
|
8896
|
-
function d3_time_parseHour12(date, string, i) {
|
8897
|
-
date.hour12 = true;
|
8898
|
-
return d3_time_parseHour24(date, string, i);
|
8917
|
+
return n ? (date.H = +n[0], i += n[0].length) : -1;
|
8899
8918
|
}
|
8900
8919
|
|
8901
8920
|
function d3_time_parseMinutes(date, string, i) {
|
8902
8921
|
d3_time_numberRe.lastIndex = 0;
|
8903
8922
|
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
|
8904
|
-
return n ? (date.
|
8923
|
+
return n ? (date.M = +n[0], i += n[0].length) : -1;
|
8905
8924
|
}
|
8906
8925
|
|
8907
8926
|
function d3_time_parseSeconds(date, string, i) {
|
8908
8927
|
d3_time_numberRe.lastIndex = 0;
|
8909
8928
|
var n = d3_time_numberRe.exec(string.substring(i, i + 2));
|
8910
|
-
return n ? (date.
|
8929
|
+
return n ? (date.S = +n[0], i += n[0].length) : -1;
|
8911
8930
|
}
|
8912
8931
|
|
8913
8932
|
function d3_time_parseMilliseconds(date, string, i) {
|
8914
8933
|
d3_time_numberRe.lastIndex = 0;
|
8915
8934
|
var n = d3_time_numberRe.exec(string.substring(i, i + 3));
|
8916
|
-
return n ? (date.
|
8935
|
+
return n ? (date.L = +n[0], i += n[0].length) : -1;
|
8917
8936
|
}
|
8918
8937
|
|
8919
8938
|
// Note: we don't look at the next directive.
|
@@ -8921,7 +8940,7 @@ var d3_time_numberRe = /\s*\d+/;
|
|
8921
8940
|
|
8922
8941
|
function d3_time_parseAmPm(date, string, i) {
|
8923
8942
|
var n = d3_time_amPmLookup.get(string.substring(i, i += 2).toLowerCase());
|
8924
|
-
return n == null ? -1 : (date.
|
8943
|
+
return n == null ? -1 : (date.p = n, i);
|
8925
8944
|
}
|
8926
8945
|
|
8927
8946
|
var d3_time_amPmLookup = d3.map({
|