Skip to content

Commit dc0d9cb

Browse files
committed
removed d3.time now switch to use d3-time
1 parent 785f128 commit dc0d9cb

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

package-lock.json

Lines changed: 9 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
]
6767
},
6868
"dependencies": {
69-
"@plotly/d3": "git://github.com/plotly/d3.git#3fc195e30e85b008238783379d2aa067c737e636",
69+
"@plotly/d3": "git://github.com/plotly/d3.git#40bd18923ece4b1d761a35721008db6f1dbbe6b2",
7070
"@plotly/d3-sankey": "0.7.2",
7171
"@plotly/d3-sankey-circular": "0.33.1",
7272
"@plotly/point-cluster": "^3.1.9",
@@ -82,11 +82,12 @@
8282
"convex-hull": "^1.0.3",
8383
"country-regex": "^1.1.0",
8484
"d3-force": "^1.2.1",
85+
"d3-format": "^1.4.5",
8586
"d3-geo": "^1.12.1",
8687
"d3-geo-projection": "^2.9.0",
87-
"d3-format": "^1.4.5",
8888
"d3-hierarchy": "^1.1.9",
8989
"d3-interpolate": "^1.4.0",
90+
"d3-time": "^1.1.0",
9091
"d3-time-format": "^2.2.3",
9192
"delaunay-triangulate": "^1.1.6",
9293
"fast-isnumeric": "^1.1.4",

src/components/rangeselector/get_update_object.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22

3-
var d3 = require('@plotly/d3');
3+
var d3Time = require('d3-time');
44

55
module.exports = function getUpdateObject(axisLayout, buttonLayout) {
66
var axName = axisLayout._name;
@@ -22,18 +22,24 @@ function getXRange(axisLayout, buttonLayout) {
2222
var currentRange = axisLayout.range;
2323
var base = new Date(axisLayout.r2l(currentRange[1]));
2424
var step = buttonLayout.step;
25+
26+
var utcStep = d3Time['utc' +
27+
// Capitalized and pluralized step e.g. month -> Months
28+
(step.charAt(0).toUpperCase() + step.slice(1))
29+
];
30+
2531
var count = buttonLayout.count;
2632
var range0;
2733

2834
switch(buttonLayout.stepmode) {
2935
case 'backward':
30-
range0 = axisLayout.l2r(+d3.time[step].utc.offset(base, -count));
36+
range0 = axisLayout.l2r(+utcStep.offset(base, -count));
3137
break;
3238

3339
case 'todate':
34-
var base2 = d3.time[step].utc.offset(base, -count);
40+
var base2 = utcStep.offset(base, -count);
3541

36-
range0 = axisLayout.l2r(+d3.time[step].utc.ceil(base2));
42+
range0 = axisLayout.l2r(+utcStep.ceil(base2));
3743
break;
3844
}
3945

0 commit comments

Comments
 (0)