Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
93f1781
Merge remote-tracking branch 'upstream/master'
mikolalysenko Mar 3, 2016
00109fd
Add surface intensity parameter
mikolalysenko Mar 4, 2016
52ab89c
rename zmin,zmax,zauto,intensity to cmin,cmax,cauto,surfacecolor
mikolalysenko Mar 10, 2016
4c4db95
upgrade gl-surface3d
mikolalysenko Mar 10, 2016
cf23c09
fix linter errors
mikolalysenko Mar 10, 2016
7f1371e
add baseline image for surface intensity test
mikolalysenko Mar 11, 2016
d7a3fe1
Merge remote-tracking branch 'upstream/master'
mikolalysenko Mar 15, 2016
e8b944d
Merge branch 'master' into surface-intensity
mikolalysenko Mar 15, 2016
70b31cc
fix issue with color levels being computed incorrectly
mikolalysenko Mar 16, 2016
78600b9
add test images
mikolalysenko Mar 16, 2016
608a706
fix path to image in gl3d test dashboard
etpinard Mar 17, 2016
3c26428
create choropleth-only calc step (can no longer re-use surface's)
etpinard Mar 17, 2016
b6d2a15
mv zmin/zmax/zauto backward compat mappings in surface defaults:
etpinard Mar 17, 2016
9d03cbf
bring back old 'zmin'/'zmax' mock
etpinard Mar 17, 2016
04a7f47
add 'cmin' and 'cmax' to surface intensity mock
etpinard Mar 17, 2016
579dcb2
pass cmin and cmax to gl-surface3d:
etpinard Mar 17, 2016
76a627e
move png baselines to baselines/
etpinard Mar 17, 2016
861197b
bring old baselines
etpinard Mar 17, 2016
63ea534
lint
etpinard Mar 21, 2016
863a6f5
bump gl-surface3d requirement
etpinard Mar 21, 2016
b07c429
update baselines
etpinard Mar 21, 2016
bf2658a
add surface defaults tests
etpinard Mar 21, 2016
15354d2
improve surface attribute descriptions
etpinard Mar 22, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add surface intensity parameter
  • Loading branch information
mikolalysenko committed Mar 4, 2016
commit 00109fd2ecfb7178269750aa6d11588791ac8b3a
1 change: 1 addition & 0 deletions devtools/test_dashboard/test_gl3d.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,6 @@ plots['scatter3d-colorscale'] = require('@mocks/gl3d_scatter3d-colorscale.json')
plots['autocolorscale'] = require('@mocks/gl3d_autocolorscale.json');
plots['nan-holes'] = require('@mocks/gl3d_nan-holes.json');
plots['tetrahedra'] = require('@mocks/gl3d_tet.json');
plots['surface-intensity'] = require('@mocks/gl3d_surface_intensity.json');

plotButtons(plots, figDir);
7 changes: 7 additions & 0 deletions src/traces/surface/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ module.exports = {
valType: 'data_array',
description: 'Sets the text elements associated with each z value.'
},
intensity: {
valType: 'data_array',
description: [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we have a more descriptive description? I'm still a little unclear on how this is used.

'Sets the surface intensity values,',
'used for setting a color scale independent of z'
].join(' ')
},
zauto: colorscaleAttrs.zauto,
zmin: colorscaleAttrs.zmin,
zmax: colorscaleAttrs.zmax,
Expand Down
6 changes: 5 additions & 1 deletion src/traces/surface/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,9 @@ var colorscaleCalc = require('../../components/colorscale/calc');

// Compute auto-z and autocolorscale if applicable
module.exports = function calc(gd, trace) {
colorscaleCalc(trace, trace.z, '', 'z');
if(trace.intensity) {
colorscaleCalc(trace, trace.intensity, '', 'intensity');
} else {
colorscaleCalc(trace, trace.z, '', 'z');
}
};
32 changes: 25 additions & 7 deletions src/traces/surface/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ var str2RgbaArray = require('../../lib/str2rgbarray');

var MIN_RESOLUTION = 128;


function SurfaceTrace(scene, surface, uid) {
this.scene = scene;
this.uid = uid;
Expand Down Expand Up @@ -136,7 +135,7 @@ function refine(coords) {
Math.floor((coords[0].shape[1]) * scaleF+1)|0 ];
var nsize = nshape[0] * nshape[1];

for(var i = 0; i < 3; ++i) {
for(var i = 0; i < coords.length; ++i) {
var padImg = padField(coords[i]);
var scaledImg = ndarray(new Float32Array(nsize), nshape);
homography(scaledImg, padImg, [scaleF, 0, 0,
Expand Down Expand Up @@ -230,9 +229,6 @@ proto.update = function(data) {
});
}

//Refine if necessary
this.dataScale = refine(coords);

var params = {
colormap: colormap,
levels: [[], [], []],
Expand All @@ -249,10 +245,30 @@ proto.update = function(data) {
dynamicColor: [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]],
dynamicWidth: [1, 1, 1],
dynamicTint: [1, 1, 1],
opacity: 1,
colorBounds: [data.zmin * scaleFactor[2], data.zmax * scaleFactor[2]]
opacity: 1
// TODO: Need to think about how to calculate this
/*
intensityBounds: [
data.zmin * scaleFactor[2],
data.zmax * scaleFactor[2]]
*/
};

//Refine if necessary
if('intensity' in data) {
var intensity = ndarray(
new Float32Array(xlen * ylen), [xlen, ylen]);
fill(intensity, function(row, col) {
return data.intensity[col][row];
});
coords.push(intensity);
}

this.dataScale = refine(coords);

if('intensity' in data) {
params.intensity = coords.pop();
}

if('opacity' in data) {
if(data.opacity < 1) {
Expand Down Expand Up @@ -300,6 +316,8 @@ proto.update = function(data) {
}

params.coords = coords;


surface.update(params);

surface.highlightEnable = highlightEnable;
Expand Down
2 changes: 2 additions & 0 deletions src/traces/surface/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
coerce('hidesurface');
coerce('opacity');

coerce('intensity');

coerce('colorscale');

var dims = ['x', 'y', 'z'];
Expand Down
254 changes: 254 additions & 0 deletions test/image/mocks/gl3d_surface_intensity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,254 @@
{
"data": [
{
"z": [
[
1,
1,
1,
1,
1,
1,
1,
1,
1,
1
],
[
0.955336489125606,
0.955336489125606,
0.955336489125606,
0.955336489125606,
0.955336489125606,
0.955336489125606,
0.955336489125606,
0.955336489125606,
0.955336489125606,
0.955336489125606
],
[
0.8253356149096783,
0.8253356149096783,
0.8253356149096783,
0.8253356149096783,
0.8253356149096783,
0.8253356149096783,
0.8253356149096783,
0.8253356149096783,
0.8253356149096783,
0.8253356149096783
],
[
0.6216099682706645,
0.6216099682706645,
0.6216099682706645,
0.6216099682706645,
0.6216099682706645,
0.6216099682706645,
0.6216099682706645,
0.6216099682706645,
0.6216099682706645,
0.6216099682706645
],
[
0.3623577544766736,
0.3623577544766736,
0.3623577544766736,
0.3623577544766736,
0.3623577544766736,
0.3623577544766736,
0.3623577544766736,
0.3623577544766736,
0.3623577544766736,
0.3623577544766736
],
[
0.0707372016677029,
0.0707372016677029,
0.0707372016677029,
0.0707372016677029,
0.0707372016677029,
0.0707372016677029,
0.0707372016677029,
0.0707372016677029,
0.0707372016677029,
0.0707372016677029
],
[
-0.2272020946930869,
-0.2272020946930869,
-0.2272020946930869,
-0.2272020946930869,
-0.2272020946930869,
-0.2272020946930869,
-0.2272020946930869,
-0.2272020946930869,
-0.2272020946930869,
-0.2272020946930869
],
[
-0.5048461045998576,
-0.5048461045998576,
-0.5048461045998576,
-0.5048461045998576,
-0.5048461045998576,
-0.5048461045998576,
-0.5048461045998576,
-0.5048461045998576,
-0.5048461045998576,
-0.5048461045998576
],
[
-0.7373937155412454,
-0.7373937155412454,
-0.7373937155412454,
-0.7373937155412454,
-0.7373937155412454,
-0.7373937155412454,
-0.7373937155412454,
-0.7373937155412454,
-0.7373937155412454,
-0.7373937155412454
],
[
-0.904072142017061,
-0.904072142017061,
-0.904072142017061,
-0.904072142017061,
-0.904072142017061,
-0.904072142017061,
-0.904072142017061,
-0.904072142017061,
-0.904072142017061,
-0.904072142017061
]
],
"intensity": [
[
10,
9,
8,
7,
6,
5,
6,
7,
8,
9
],
[
9,
8,
7,
6,
5,
4,
5,
6,
7,
8
],
[
8,
7,
6,
5,
4,
3,
4,
5,
6,
7
],
[
7,
6,
5,
4,
3,
2,
3,
4,
5,
6
],
[
6,
5,
4,
3,
2,
1,
2,
3,
4,
5
],
[
5,
4,
3,
2,
1,
0,
1,
2,
3,
4
],
[
6,
5,
4,
3,
2,
1,
2,
3,
4,
5
],
[
7,
6,
5,
4,
3,
2,
3,
4,
5,
6
],
[
8,
7,
6,
5,
4,
3,
4,
5,
6,
7
],
[
9,
8,
7,
6,
5,
4,
5,
6,
7,
8
]
],
"type": "surface"
}
],
"layout": {
"title": "Surface intensity test"
}
}