Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 911796c

Browse filesBrowse files
committed
lint: gl-vis --> plotly.js
1 parent b6df8ab commit 911796c
Copy full SHA for 911796c

File tree

Expand file treeCollapse file tree

2 files changed

+44
-47
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+44
-47
lines changed

‎src/traces/scatter3d/calc_errors.js

Copy file name to clipboardExpand all lines: src/traces/scatter3d/calc_errors.js
+28-34Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,37 +10,31 @@
1010
'use strict';
1111

1212
function calculateAxisErrors(data, params) {
13-
if(!params || !params.visible) {
14-
return null;
15-
}
13+
if(!params || !params.visible) return null;
1614

1715
function option(name, value) {
18-
if(name in params) {
19-
return params[name];
20-
}
16+
if(name in params) return params[name];
2117
return value;
2218
}
2319

24-
var result = new Array(data.length);
25-
var type = option('type', 'percent');
26-
var symmetric = option('symmetric', true);
27-
var value = +option('value', 10);
28-
var minusValue = +option('valueminus', 10);
29-
var error = option('array', null);
30-
var minusError = option('arrayminus', null);
31-
var x, h, l, r, i;
20+
var result = new Array(data.length),
21+
type = option('type', 'percent'),
22+
symmetric = option('symmetric', true),
23+
value = +option('value', 10),
24+
minusValue = +option('valueminus', 10),
25+
error = option('array', null),
26+
minusError = option('arrayminus', null);
3227

3328
if(symmetric) {
3429
minusValue = value;
3530
minusError = error;
3631
}
3732

38-
if(type === 'data' && (!error || !minusError)) {
39-
return null;
40-
}
33+
if(type === 'data' && (!error || !minusError)) return null;
34+
35+
for(var i = 0; i < data.length; i++) {
36+
var x = +data[i];
4137

42-
for(i=0; i<data.length; ++i) {
43-
x = +data[i];
4438
switch(type) {
4539
case 'percent':
4640
h = Math.abs(x) * value / 100.0;
@@ -67,10 +61,8 @@ function calculateAxisErrors(data, params) {
6761
}
6862

6963
function dataLength(array) {
70-
for(var i=0; i<array.length; ++i) {
71-
if(array[i]) {
72-
return array[i].length;
73-
}
64+
for(var i = 0; i < array.length; i++) {
65+
if(array[i]) return array[i].length;
7466
}
7567
return 0;
7668
}
@@ -80,24 +72,26 @@ function calculateErrors(data) {
8072
calculateAxisErrors(data.x, data.error_x),
8173
calculateAxisErrors(data.y, data.error_y),
8274
calculateAxisErrors(data.z, data.error_z) ],
83-
errorBounds,
84-
n = dataLength(errors),
85-
i, j, k, bound;
86-
if(n === 0) {
87-
return null;
88-
}
89-
errorBounds = new Array(n);
90-
for(i=0; i<n; ++i) {
91-
bound = [[0,0,0],[0,0,0]];
92-
for(j=0; j<3; ++j) {
75+
76+
var n = dataLength(errors);
77+
if(n === 0) return null;
78+
79+
var errorBounds = new Array(n);
80+
81+
for(var i = 0; i < n; i++) {
82+
var bound = [[0,0,0], [0,0,0]];
83+
84+
for(var j = 0; j < 3; j++) {
9385
if(errors[j]) {
94-
for(k=0; k<2; ++k) {
86+
for(var k = 0; k < 2; k++) {
9587
bound[k][j] = errors[j][i][k];
9688
}
9789
}
9890
}
91+
9992
errorBounds[i] = bound;
10093
}
94+
10195
return errorBounds;
10296
}
10397

‎src/traces/scatter3d/convert.js

Copy file name to clipboardExpand all lines: src/traces/scatter3d/convert.js
+16-13Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -106,20 +106,23 @@ function constructDelaunay(points, color, axis) {
106106

107107
function calculateErrorParams(errors) {
108108
/*jshint camelcase: false */
109-
var capSize = [0.0, 0.0, 0.0], i, e;
110-
var color = [[0,0,0],[0,0,0],[0,0,0]];
111-
var lineWidth = [0.0, 0.0, 0.0];
112-
for(i=0; i<3; ++i) {
113-
e = errors[i];
114-
if (e && e.copy_zstyle !== false) {
115-
e = errors[2];
116-
}
109+
110+
var capSize = [0.0, 0.0, 0.0],
111+
color = [[0,0,0], [0,0,0], [0,0,0]],
112+
lineWidth = [0.0, 0.0, 0.0];
113+
114+
for(var i = 0; i < 3; i++) {
115+
var e = errors[i];
116+
117+
if(e && e.copy_zstyle !== false) e = errors[2];
117118
if(!e) continue;
119+
118120
capSize[i] = e.width / 100.0; //Ballpark rescaling, attempt to make consistent with plot.ly
119121
color[i] = str2RgbaArray(e.color);
120122
lineWidth = e.thickness;
121123

122124
}
125+
123126
return {capSize: capSize, color: color, lineWidth: lineWidth};
124127
}
125128

@@ -173,7 +176,6 @@ function convertPlotlyOptions(scene, data) {
173176
zaxis = sceneLayout.zaxis,
174177
marker = data.marker,
175178
line = data.line,
176-
errorParams = calculateErrorParams([ data.error_x, data.error_y, data.error_z ]),
177179
xc, x = data.x || [],
178180
yc, y = data.y || [],
179181
zc, z = data.z || [],
@@ -242,12 +244,13 @@ function convertPlotlyOptions(scene, data) {
242244
}
243245

244246
params.errorBounds = calculateError(data);
245-
params.errorColor = errorParams.color;
247+
var errorParams = calculateErrorParams([data.error_x, data.error_y, data.error_z]);
248+
params.errorColor = errorParams.color;
246249
params.errorLineWidth = errorParams.lineWidth;
247-
params.errorCapSize = errorParams.capSize;
250+
params.errorCapSize = errorParams.capSize;
248251

249-
params.delaunayAxis = data.surfaceaxis;
250-
params.delaunayColor = str2RgbaArray(data.surfacecolor);
252+
params.delaunayAxis = data.surfaceaxis;
253+
params.delaunayColor = str2RgbaArray(data.surfacecolor);
251254

252255
return params;
253256
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.