Skip to content

Edits for no unwarranted colorscale or related data on parcoords trace/fullTrace #1509

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
9 changes: 8 additions & 1 deletion src/traces/parcoords/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,20 @@

var hasColorscale = require('../../components/colorscale/has_colorscale');
var calcColorscale = require('../../components/colorscale/calc');
var Lib = require('../../lib');


module.exports = function calc(gd, trace) {
var cs = !!trace.line.colorscale && Lib.isArray(trace.line.color);
var color = cs ? trace.line.color : Array.apply(0, Array(trace.dimensions.reduce(function(p, n) {return Math.max(p, n.values.length);}, 0))).map(function() {return 0.5;});
var cscale = cs ? trace.line.colorscale : [[0, trace.line.color], [1, trace.line.color]];

if(hasColorscale(trace, 'line')) {
calcColorscale(trace, trace.line.color, 'line', 'c');
}

return [{}];
return [{
lineColor: color,
cscale: cscale
}];
};
13 changes: 5 additions & 8 deletions src/traces/parcoords/parcoords.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,18 +115,15 @@ function unwrap(d) {
}

function model(layout, d, i) {
var trace = unwrap(d).trace,
var cd0 = unwrap(d),
trace = cd0.trace,
lineColor = cd0.lineColor,
cscale = cd0.cscale,
line = trace.line,
domain = trace.domain,
dimensions = trace.dimensions,
width = layout.width;

var cs = !!trace.line.colorscale && Lib.isArray(trace.line.color);
var lineColor = cs ?
trace.line.color :
Array.apply(0, Array(trace.dimensions.reduce(function(p, n) {return Math.max(p, n.values.length);}, 0))).map(function() {return 0.5;});
var lineColorScale = cs ? trace.line.colorscale : [[0, trace.line.color], [1, trace.line.color]];

var lines = Lib.extendDeep({}, line, {
color: lineColor.map(domainToUnitScale({values: lineColor, range: [line.cmin, line.cmax]})),
blockLineCount: c.blockLineCount,
Expand All @@ -145,7 +142,7 @@ function model(layout, d, i) {
colCount: dimensions.filter(visible).length,
dimensions: dimensions,
tickDistance: c.tickDistance,
unitToColor: unitToColorScale(lineColorScale),
unitToColor: unitToColorScale(cscale),
lines: lines,
translateX: domain.x[0] * width,
translateY: layout.height - domain.y[1] * layout.height,
Expand Down