Skip to content

Commit 86b31ea

Browse files
committed
fix gl3d with world calendars
1 parent 165125b commit 86b31ea

File tree

7 files changed

+143
-17
lines changed

7 files changed

+143
-17
lines changed

src/traces/mesh3d/defaults.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
2020
}
2121

2222
// read in face/vertex properties
23-
function readComponents(array) {
23+
function readComponents(array, doCalendar) {
2424
var ret = array.map(function(attr) {
2525
var result = coerce(attr);
2626

27+
if(doCalendar) coerce(attr + 'calendar', layout.calendar);
28+
2729
if(result && Array.isArray(result)) return result;
2830
return null;
2931
});
@@ -33,7 +35,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3335
}) && ret;
3436
}
3537

36-
var coords = readComponents(['x', 'y', 'z']);
38+
var coords = readComponents(['x', 'y', 'z'], true);
3739
var indices = readComponents(['i', 'j', 'k']);
3840

3941
if(!coords) {

src/traces/scatter3d/defaults.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
2626
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
2727
}
2828

29-
var len = handleXYZDefaults(traceIn, traceOut, coerce);
29+
var len = handleXYZDefaults(traceIn, traceOut, coerce, layout);
3030
if(!len) {
3131
traceOut.visible = false;
3232
return;
@@ -66,12 +66,16 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
6666
errorBarsSupplyDefaults(traceIn, traceOut, defaultColor, {axis: 'x', inherit: 'z'});
6767
};
6868

69-
function handleXYZDefaults(traceIn, traceOut, coerce) {
69+
function handleXYZDefaults(traceIn, traceOut, coerce, layout) {
7070
var len = 0,
7171
x = coerce('x'),
7272
y = coerce('y'),
7373
z = coerce('z');
7474

75+
coerce('xcalendar', layout.calendar);
76+
coerce('ycalendar', layout.calendar);
77+
coerce('zcalendar', layout.calendar);
78+
7579
if(x && y && z) {
7680
len = Math.min(x.length, y.length, z.length);
7781
if(len < x.length) traceOut.x = x.slice(0, len);

src/traces/surface/defaults.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3434
coerce('x');
3535
coerce('y');
3636

37+
coerce('xcalendar', layout.calendar);
38+
coerce('ycalendar', layout.calendar);
39+
coerce('zcalendar', layout.calendar);
40+
3741
if(!Array.isArray(traceOut.x)) {
3842
// build a linearly scaled x
3943
traceOut.x = [];
-22.1 KB
Binary file not shown.
56.3 KB
Loading

test/image/mocks/gl3d_scatter-date.json

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
{
2+
"data": [
3+
{
4+
"i": [
5+
0,
6+
0,
7+
0,
8+
1
9+
],
10+
"j": [
11+
1,
12+
2,
13+
3,
14+
2
15+
],
16+
"k": [
17+
2,
18+
3,
19+
1,
20+
3
21+
],
22+
"facecolor": [
23+
"rgb(0, 0, 0)",
24+
"rgb(255,0,0)",
25+
"rgb(0,255,0)",
26+
"rgb(0,0,255)"
27+
],
28+
"type": "mesh3d",
29+
"x": [
30+
"2000-01-01",
31+
"2000-02-01",
32+
"2000-03-01",
33+
"2000-01-01"
34+
],
35+
"xcalendar": "ethiopian",
36+
"y": [
37+
"0100-01-01",
38+
"0100-01-01",
39+
"0100-02-01",
40+
"0100-03-01"
41+
],
42+
"ycalendar": "taiwan",
43+
"z": [
44+
"2550-01-01",
45+
"2550-03-01",
46+
"2550-01-01",
47+
"2550-02-01"
48+
],
49+
"zcalendar": "thai"
50+
},
51+
{
52+
"x": [
53+
"2000-01-01",
54+
"2000-01-01",
55+
"2000-03-01",
56+
"2000-03-01"
57+
],
58+
"xcalendar": "ethiopian",
59+
"y": [
60+
"0100-01-01",
61+
"0100-03-01",
62+
"0100-01-01",
63+
"0100-03-01"
64+
],
65+
"ycalendar": "taiwan",
66+
"z": [
67+
"2550-01-01",
68+
"2550-03-01",
69+
"2550-03-01",
70+
"2550-01-01"
71+
],
72+
"zcalendar": "thai",
73+
"type": "scatter3d"
74+
},
75+
{
76+
"x": [
77+
"2000-01-01",
78+
"2000-03-01"
79+
],
80+
"xcalendar": "ethiopian",
81+
"y": [
82+
"0100-01-01",
83+
"0100-03-01"
84+
],
85+
"ycalendar": "taiwan",
86+
"z": [
87+
[
88+
"2550-01-25",
89+
"2550-02-10"
90+
],
91+
[
92+
"2550-02-10",
93+
"2550-01-25"
94+
]
95+
],
96+
"zcalendar": "thai",
97+
"type": "surface",
98+
"showscale": false,
99+
"surfacecolor": [[0, 1],[2, 3]]
100+
}
101+
],
102+
"layout": {
103+
"scene": {
104+
"xaxis": {
105+
"title": "taiwan",
106+
"calendar": "taiwan",
107+
"type": "date"
108+
},
109+
"yaxis": {
110+
"title": "gregorian",
111+
"type": "date"
112+
},
113+
"zaxis": {
114+
"title": "ethiopian",
115+
"calendar": "ethiopian",
116+
"type": "date"
117+
},
118+
"camera": {
119+
"eye": {
120+
"x": -1.8,
121+
"y": 1.38,
122+
"z": 0.75
123+
}
124+
}
125+
},
126+
"width": 800,
127+
"height": 700
128+
}
129+
}

0 commit comments

Comments
 (0)