Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor parcoords - bug fixes - reuse axes ticktext - support pseudo html labels - features for label angle & position #3966

Merged
merged 70 commits into from
Jun 27, 2019
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
b050eec
refactor parcoords - lims > limits
archmoj May 28, 2019
57c0abd
refactor parcoords - replace Array.apply with simple fill method
archmoj May 29, 2019
321b73a
refactor parcoords - i > i0 - ii > i1
archmoj May 29, 2019
e7f18af
refactor parcoords - simplify plot sorter function
archmoj May 29, 2019
e5304b1
refactor parcoords - dim1 > dim0
archmoj May 29, 2019
dd65f3f
refactor parcoords - dim2 > dim1
archmoj May 29, 2019
be5df36
refactor parcoords - pass1 - add highp flags - move imports to the to…
archmoj May 29, 2019
55a5018
refactor parcoords - remove one more argument to position functions
archmoj May 29, 2019
9702db6
refactor parcoords - move axisY funcs to main shaders - remove unused…
archmoj May 29, 2019
0c1959c
refactor parcoords - avoid passing complex multi dim mat4 argument be…
archmoj May 29, 2019
51c59e8
refactor parcoords - no need to pass resolution to position functions
archmoj May 29, 2019
3b01429
refactor parcoords - now no need to pass dims to one axisY functions
archmoj May 29, 2019
562973d
refactor parcoords - combine pick and vertex shader programs
archmoj May 29, 2019
3516ba5
refactor parcoords - move position code to single location used now i…
archmoj May 29, 2019
b320638
refactor parcoords - removed many now unused passing arguments
archmoj May 29, 2019
48e091e
refactor parcoords - combine two mod functions into one
archmoj May 29, 2019
f127343
refactor parcoords - remove one more function and adjustment for perf…
archmoj May 29, 2019
947dbe7
refactor parcoords - add function to handle hide logic
archmoj May 29, 2019
fcd4bcb
refactor parcoords - rearrange indices and arguments in makeItem
archmoj May 29, 2019
ac1ace3
refactor parcoords - lint shaders
archmoj May 29, 2019
c05683f
refactor parcoords - remove unused variables and optimize within rast…
archmoj May 29, 2019
5464b4a
refactor parcoords - change functions from inside to outside
archmoj May 30, 2019
5280ce4
refactor parcoords - no need for extra clamping - already between 0 a…
archmoj May 30, 2019
ea6fbe4
refactor parcoords - simplify code
archmoj May 31, 2019
296859f
refactor parcoords - remove non-parametic constants
archmoj May 31, 2019
e89676a
refactor parcoords - cut long variable names and move item.count twea…
archmoj May 31, 2019
b326947
no need to offset texture inputs in vertex shader
archmoj May 31, 2019
592f56b
refactor parcoords - set color info outside position loop
archmoj Jun 1, 2019
b4e285e
bug fix issue 3749 parcoords outside range - add image tests
archmoj Jun 2, 2019
76667c9
refactor parcoords - remove unused colorClamp parameter
archmoj Jun 3, 2019
3a5b4ca
refactor parcoords - add test for 60 dimensions - clean up shader for…
archmoj Jun 3, 2019
286db3b
refactor parcoords - describe panels 1-60 in vertex shaders
archmoj Jun 3, 2019
40de5d9
add image test for parcoords with 256 colors
archmoj Jun 3, 2019
5dfe455
refactor parcoords - use general variable names in plot and base_plot
archmoj Jun 3, 2019
9937208
apply Cartesian axis tickText to format parcoords linear data
archmoj Jun 3, 2019
ca79f97
refactor parcoords - rm root unused variable
archmoj Jun 4, 2019
5cccd86
psuedo-html and mathjax formats in parcoords labels - fix for issue 3206
archmoj Jun 4, 2019
4e749bd
refactor parcoords - get rid of one extra dimension, complex indexing…
archmoj Jun 4, 2019
ccfc81e
improve test for parcoords with 60 dims
archmoj Jun 4, 2019
90c358d
fix mathjax show on image test
archmoj Jun 4, 2019
178273c
implement labelangle for parcoords
archmoj Jun 5, 2019
73f23de
revise various parcoords editType from calc to plot
archmoj Jun 5, 2019
8f23241
use tickvals and ticktext in new parcoords mock
archmoj Jun 5, 2019
b0d3bdd
added jasmine test for parcoords react with editType plot instead of …
archmoj Jun 5, 2019
cc580fe
refactor parcoords - use one vertex shader
archmoj Jun 6, 2019
369eb46
optimize for performance - now no need to update palette for every co…
archmoj Jun 6, 2019
213f965
move 3 functions outside line.js main
archmoj Jun 6, 2019
407d72a
refactor parcoords - using isContext and isPick instead of context & …
archmoj Jun 6, 2019
ebf57f0
apply per dimension tickformat in linear axes ticktext
archmoj Jun 6, 2019
48860c2
fixup tests to run on CI
archmoj Jun 6, 2019
9cbbcbf
dont touch trace data - move handeling of typedarrays from calc to pl…
archmoj Jun 6, 2019
3a4d428
add parcoords labelside (top|bottom) help display tilted labels with …
archmoj Jun 7, 2019
6aad768
revisit contextColor setup
archmoj Jun 7, 2019
6403347
refactor parcoords - better variable names in parcoords plot
archmoj Jun 7, 2019
b5d24e1
refactor parcoords - move nested functions outside plot callbacks
archmoj Jun 7, 2019
1b7c0ef
centralize functions in parcoords helpers
archmoj Jun 7, 2019
c4a7867
move function outside main block
archmoj Jun 7, 2019
8b88690
refactor parcoords - rename dd > e
archmoj Jun 7, 2019
643ba30
reduce number of passing argumnets to parcoords
archmoj Jun 10, 2019
5c5873d
add unselected lines color to constants
archmoj Jun 14, 2019
e79af84
parcoords refactor - rename glLayers
archmoj Jun 14, 2019
4e3452b
make parcoords pick layer totally invisible
archmoj Jun 14, 2019
75f692d
refactor parcoords - init with new Array and use set instead of push
archmoj Jun 17, 2019
11b9434
mock separated linear axes for every dimension
archmoj Jun 17, 2019
9e73c27
ticktext is now set for each parcoords dimension
archmoj Jun 18, 2019
a80bf49
implement cartesian axis for parcoords and change parcoords tickforma…
archmoj Jun 19, 2019
97f61b6
add noCI tags for two more parcoords tests
archmoj Jun 20, 2019
dea5317
Merge branch 'master' into refactor-parcoords-bug-fixes-labelangle-side
etpinard Jun 20, 2019
c8dedcb
coerce range then create axis
archmoj Jun 20, 2019
2228339
make parcoords + uirevision test pass on CI
etpinard Jun 25, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
260 changes: 128 additions & 132 deletions src/traces/parcoords/lines.js

Large diffs are not rendered by default.

24 changes: 12 additions & 12 deletions src/traces/parcoords/parcoords.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,17 +434,17 @@ module.exports = function(root, svg, parcoordsLineLayers, styledData, layout, ca
var panels = vm.panels || (vm.panels = []);
var dimData = yAxis.data();
var panelCount = dimData.length - 1;
for(var p = 0; p < panelCount; p++) {
var panel = panels[p] || (panels[p] = {});
var dim1 = dimData[p];
var dim2 = dimData[p + 1];
panel.dim1 = dim1;
panel.dim2 = dim2;
panel.canvasX = dim1.canvasX;
panel.panelSizeX = dim2.canvasX - dim1.canvasX;
panel.panelSizeY = vm.model.canvasHeight;
panel.y = 0;
panel.canvasY = 0;
for(var i = 0; i < panelCount; i++) {
var p = panels[i] || (panels[i] = {});
var dim0 = dimData[i];
var dim1 = dimData[i + 1];
p.dim0 = dim0;
p.dim1 = dim1;
p.canvasX = dim0.canvasX;
p.panelSizeX = dim1.canvasX - dim0.canvasX;
p.panelSizeY = vm.model.canvasHeight;
p.y = 0;
p.canvasY = 0;
}
}

Expand Down Expand Up @@ -497,7 +497,7 @@ module.exports = function(root, svg, parcoordsLineLayers, styledData, layout, ca
yAxis.filter(function(dd) { return Math.abs(d.xIndex - dd.xIndex) !== 0; })
.attr('transform', function(d) { return 'translate(' + d.xScale(d.xIndex) + ', 0)'; });
d3.select(this).attr('transform', 'translate(' + d.x + ', 0)');
yAxis.each(function(dd, i, ii) { if(ii === d.parent.key) p.dimensions[i] = dd; });
yAxis.each(function(dd, i0, i1) { if(i1 === d.parent.key) p.dimensions[i0] = dd; });
p.contextLayer && p.contextLayer.render(p.panels, false, !someFiltersActive(p));
p.focusLayer.render && p.focusLayer.render(p.panels);
})
Expand Down
7 changes: 4 additions & 3 deletions src/traces/parcoords/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,10 @@ module.exports = function plot(gd, cdparcoords) {

function sorter(orig) {
return function sorter(d1, d2) {
var i1 = newIdx(visibleIndices, orig, d1);
var i2 = newIdx(visibleIndices, orig, d2);
return i1 - i2;
return (
newIdx(visibleIndices, orig, d1) -
newIdx(visibleIndices, orig, d2)
);
};
}

Expand Down
60 changes: 34 additions & 26 deletions src/traces/parcoords/shaders/context_vertex.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,50 @@ precision highp float;
attribute vec4 p0, p1, p2, p3,
p4, p5, p6, p7,
p8, p9, pa, pb,
pc, pd, pe;
pc, pd, pe, pf;

attribute vec4 pf;

uniform mat4 dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D;

uniform vec2 resolution,
viewBoxPosition,
viewBoxSize;
uniform mat4 dim0A, dim1A, dim0B, dim1B, dim0C, dim1C, dim0D, dim1D;

uniform vec2 resolution, viewBoxPos, viewBoxSize, colorClamp;
uniform sampler2D palette;

uniform vec2 colorClamp;

varying vec4 fragColor;

#pragma glslify: unfilteredPosition = require("./unfiltered_position.glsl")
const vec4 unit = vec4(1.0, 1.0, 1.0, 1.0);

void main() {
float val(mat4 p, mat4 v) {
return dot(matrixCompMult(p, v) * unit, unit);
}

float prominence = abs(pf[3]);
float axisY(float ratio, mat4 A, mat4 B, mat4 C, mat4 D) {
float y1 = val(A, dim0A) + val(B, dim0B) + val(C, dim0C) + val(D, dim0D);
float y2 = val(A, dim1A) + val(B, dim1B) + val(C, dim1C) + val(D, dim1D);
return y1 * (1.0 - ratio) + y2 * ratio;
}

mat4 p[4];
p[0] = mat4(p0, p1, p2, p3);
p[1] = mat4(p4, p5, p6, p7);
p[2] = mat4(p8, p9, pa, pb);
p[3] = mat4(pc, pd, pe, abs(pf));
vec4 unfilteredPosition(float v, mat4 A, mat4 B, mat4 C, mat4 D) {
float x = 0.5 * sign(v) + 0.5;
float y = axisY(x, A, B, C, D);
float z = 1.0 - abs(v);

gl_Position = unfilteredPosition(
1.0 - prominence,
resolution, viewBoxPosition, viewBoxSize,
p,
sign(pf[3]),
dim1A, dim2A, dim1B, dim2B, dim1C, dim2C, dim1D, dim2D
return vec4(
2.0 * (vec2(x, y) * viewBoxSize + viewBoxPos) / resolution - 1.0,
z,
1.0
);
}

void main() {
mat4 A = mat4(p0, p1, p2, p3);
mat4 B = mat4(p4, p5, p6, p7);
mat4 C = mat4(p8, p9, pa, pb);
mat4 D = mat4(pc, pd, pe, abs(pf));

float v = pf[3];

gl_Position = unfilteredPosition(v, A, B, C, D);

float clampedColorIndex = clamp((prominence - colorClamp[0]) / (colorClamp[1] - colorClamp[0]), 0.0, 1.0);
fragColor = texture2D(palette, vec2((clampedColorIndex * 255.0 + 0.5) / 256.0, 0.5));
fragColor = texture2D(palette, vec2(
((abs(v) - colorClamp[0]) / (colorClamp[1] - colorClamp[0]) * 255.0 + 0.5) / 256.0, 0.5
));
}
2 changes: 1 addition & 1 deletion src/traces/parcoords/shaders/fragment.glsl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
precision lowp float;
precision highp float;

varying vec4 fragColor;

Expand Down
47 changes: 0 additions & 47 deletions src/traces/parcoords/shaders/pick_vertex.glsl

This file was deleted.

88 changes: 0 additions & 88 deletions src/traces/parcoords/shaders/position.glsl

This file was deleted.

24 changes: 0 additions & 24 deletions src/traces/parcoords/shaders/unfiltered_position.glsl

This file was deleted.