Skip to content
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
6 changes: 5 additions & 1 deletion src/traces/parcoords/parcoords.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
'use strict';

var d3 = require('d3');
var rgba = require('color-rgba');

var Lib = require('../../lib');
var Drawing = require('../../components/drawing');
Expand Down Expand Up @@ -102,7 +103,10 @@ function ordinalScale(dimension) {

function unitToColorScale(cscale) {
var colorStops = cscale.map(function(d) { return d[0]; });
var colorTuples = cscale.map(function(d) { return d3.rgb(d[1]); });
var colorTuples = cscale.map(function(d) {
var RGBA = rgba(d[1]);
return d3.rgb('rgb(' + RGBA[0] + ',' + RGBA[1] + ',' + RGBA[2] + ')');
});
var prop = function(n) { return function(o) { return o[n]; }; };

// We can't use d3 color interpolation as we may have non-uniform color palette raster
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 47 additions & 0 deletions test/image/mocks/gl2d_parcoords_rgba_colorscale.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"data": [
{
"dimensions": [
{
"values": [
0,
1
]
},
{
"values": [
1,
0
]
}
],
"line": {
"cmax": 1,
"cmin": 0,
"color": [
0,
1
],
"colorscale": [
[
0,
"rgba(255,0,0,1)"
],
[
1,
"rgba(0,0,255,1)"
]
],
"showscale": true
},
"type": "parcoords"
}
],
"layout": {
"width": 400,
"height": 400,
"title": {
"text": "should work with rgba colorscale"
}
}
}