Skip to content

Commit 3e192e0

Browse files
committed
adding focusopacity attribute for symmetry
(cherry picked from commit f2a79a6)
1 parent 346a24d commit 3e192e0

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

src/traces/parcoords/attributes.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ module.exports = {
155155
description: 'Opacity of the context lines, on a scale of 0 (invisible) to 1 (fully opaque).'
156156
},
157157

158+
focusopacity: {
159+
valType: 'number',
160+
dflt: 1,
161+
min: 0,
162+
max: 1,
163+
role: 'style',
164+
description: 'Opacity of the focus lines, on a scale of 0 (invisible) to 1 (fully opaque).'
165+
},
166+
158167
pixelratio: {
159168
valType: 'number',
160169
dflt: 1,

src/traces/parcoords/defaults.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
8484
coerce('domain.y');
8585

8686
coerce('line.color');
87+
coerce('line.focusopacity');
8788
coerce('line.contextopacity');
8889
coerce('line.pixelratio');
8990
coerce('line.focusalphablending');

src/traces/parcoords/lines.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ function adjustDepth(d) {
8989
return Math.max(depthLimitEpsilon, Math.min(1 - depthLimitEpsilon, d));
9090
}
9191

92-
function palette(unitToColor, context, contextOpacity) {
92+
function palette(unitToColor, context, opacity) {
9393
var result = [];
9494
for(var j = 0; j < 256; j++) {
9595
var c = unitToColor(j / 255);
96-
result.push((context ? contextColor : c).concat([context ? Math.round(contextOpacity * 255) : 255]));
96+
result.push((context ? contextColor : c).concat(opacity));
9797
}
9898

9999
return result;
@@ -158,7 +158,7 @@ module.exports = function(canvasGL, lines, canvasWidth, canvasHeight, dimensions
158158
var dimensionCount = dimensions.length;
159159
var sampleCount = dimensions[0].values.length;
160160

161-
var focusAlphaBlending = context; // controlConfig.focusAlphaBlending;
161+
var focusAlphaBlending = context || lines.focusalphablending;
162162

163163
var canvasPanelSizeY = canvasHeight;
164164

@@ -183,7 +183,7 @@ module.exports = function(canvasGL, lines, canvasWidth, canvasHeight, dimensions
183183
type: 'uint8',
184184
mag: 'nearest',
185185
min: 'nearest',
186-
data: palette(unitToColor, context, lines.contextopacity)
186+
data: palette(unitToColor, context, Math.round((context ? lines.contextopacity : lines.focusopacity) * 255))
187187
});
188188

189189
var glAes = regl({

test/jasmine/tests/parcoords_test.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)