Skip to content

Commit 40c7fb6

Browse files
committed
improved log mock
1 parent 6d61e43 commit 40c7fb6

File tree

2 files changed

+33
-22
lines changed

2 files changed

+33
-22
lines changed

src/traces/isosurface/convert.js

+22-11
Original file line numberDiff line numberDiff line change
@@ -819,28 +819,40 @@ function generateIsosurfaceMesh(data) {
819819
);
820820
}
821821
} else {
822-
if(e === 'x') indices = createRange(1, width - 1);
823-
if(e === 'y') indices = createRange(1, height - 1);
824-
if(e === 'z') indices = createRange(1, depth - 1);
822+
if(e === 'x') {
823+
indices = createRange(1, width - 1);
824+
} else if(e === 'y') {
825+
indices = createRange(1, height - 1);
826+
} else {
827+
indices = createRange(1, depth - 1);
828+
}
825829
}
826830

827-
if(e === 'x') drawSlicesX(activeStyle, indices, activeMin, activeMax);
828-
if(e === 'y') drawSlicesY(activeStyle, indices, activeMin, activeMax);
829-
if(e === 'z') drawSlicesZ(activeStyle, indices, activeMin, activeMax);
831+
if(e === 'x') {
832+
drawSlicesX(activeStyle, indices, activeMin, activeMax);
833+
} else if(e === 'y') {
834+
drawSlicesY(activeStyle, indices, activeMin, activeMax);
835+
} else {
836+
drawSlicesZ(activeStyle, indices, activeMin, activeMax);
837+
}
830838
}
831839

832840
// draw caps
833841
var cap = data.caps[e];
834842
if(cap.show && cap.fill) {
835843
setFill(cap.fill);
836-
if(e === 'x') drawSlicesX(activeStyle, [0, width - 1], activeMin, activeMax);
837-
if(e === 'y') drawSlicesY(activeStyle, [0, height - 1], activeMin, activeMax);
838-
if(e === 'z') drawSlicesZ(activeStyle, [0, depth - 1], activeMin, activeMax);
844+
if(e === 'x') {
845+
drawSlicesX(activeStyle, [0, width - 1], activeMin, activeMax);
846+
} else if(e === 'y') {
847+
drawSlicesY(activeStyle, [0, height - 1], activeMin, activeMax);
848+
} else {
849+
drawSlicesZ(activeStyle, [0, depth - 1], activeMin, activeMax);
850+
}
839851
}
840852
}
841853
});
842854

843-
// remove vertices arrays (i.e. grid points) in case no faces was created created.
855+
// remove vertices arrays (i.e. grid points) in case no face was created.
844856
if(numFaces === 0) {
845857
emptyVertices();
846858
}
@@ -853,7 +865,6 @@ function generateIsosurfaceMesh(data) {
853865
data.y = allYs;
854866
data.z = allZs;
855867
data.intensity = allVs;
856-
857868
}
858869

859870
voidMain();

test/image/mocks/gl3d_isosurface_log-axis_slices_surface-fill.json

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
{
22
"data": [{
33
"type": "isosurface",
4-
"colorscale": "Portland",
4+
"colorscale": "Rainbow",
55
"reversescale": false,
6-
"surface": { "show": true, "fill": 0.8 },
6+
"surface": { "show": true, "fill": 1 },
77
"spaceframe": { "show": false },
88
"slices": {
9-
"x": { "show": true, "fill": 1, "locations": [0, -0.45, -0.9, -1.8] },
9+
"x": { "show": true, "fill": 1, "locations": [-0.9, -0.6, 0] },
1010
"y": { "show": false },
1111
"z": { "show": true, "fill": 1 }
1212
},
@@ -19,10 +19,10 @@
1919
"show": true,
2020
"width": 4
2121
},
22-
"x": [ -4.500, -4.050, -3.600, -3.150, -2.700, -2.250, -1.800, -1.350, -0.900, -0.450, 0.000, 0.450, 0.900, 1.350, 1.800, 2.250, 2.700, 3.150, 3.600, 4.050, 4.500 ],
23-
"y": [ -4.500, -4.050, -3.600, -3.150, -2.700, -2.250, -1.800, -1.350, -0.900, -0.450, 0.000, 0.450, 0.900, 1.350, 1.800, 2.250, 2.700, 3.150, 3.600, 4.050, 4.500 ],
24-
"z": [ 1.000, 1.450, 1.900, 2.350, 2.800, 3.250, 3.700, 4.150, 4.600, 5.050, 5.500, 5.950, 6.400, 6.850, 7.300, 7.750, 8.200, 8.650, 9.100, 9.550, 10.000 ],
25-
"isomin": 250,
22+
"x": [ -4.5, -4.05, -3.6, -3.15, -2.7, -2.25, -1.8, -1.35, -0.9, -0.45, 0, 0.45, 0.9, 1.35, 1.8, 2.25, 2.7, 3.15, 3.6, 4.05, 4.5 ],
23+
"y": [ -4.5, -4.05, -3.6, -3.15, -2.7, -2.25, -1.8, -1.35, -0.9, -0.45, 0, 0.45, 0.9, 1.35, 1.8, 2.25, 2.7, 3.15, 3.6, 4.05, 4.5 ],
24+
"z": [ 1, 1.45, 1.9, 2.35, 2.8, 3.25, 3.7, 4.15, 4.6, 5.05, 5.5, 5.95, 6.4, 6.85, 7.3, 7.75, 8.2, 8.65, 9.1, 9.55, 10 ],
25+
"isomin": 200,
2626
"isomax": 500,
2727
"value": [
2828
750, 703, 660, 623, 590, 563, 540, 523, 510, 502, 500, 502, 510, 523, 540, 563, 590, 623, 660, 702, 750,
@@ -502,7 +502,7 @@
502502
}],
503503
"layout": {
504504
"title": {
505-
"text": "Spherical isosurface trace on logarithmic axes with horizontal caps & slices as well as vertical slices on desired locations"
505+
"text": "Spherical isosurface trace on logarithmic axes with horizontal caps & slices as well as 3 vertical slices on desired locations"
506506
},
507507
"width": 1200,
508508
"height": 900,
@@ -512,9 +512,9 @@
512512
"zaxis": { "nticks": 12, "type": "log", "title" : { "text": "Logarithmic axis" }},
513513
"camera": {
514514
"eye": {
515-
"x": -1.5,
516-
"y": -1.0,
517-
"z": 0.25
515+
"x": 0.75,
516+
"y": -1.75,
517+
"z": 0.2
518518
}
519519
}
520520
}

0 commit comments

Comments
 (0)