Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 3 additions & 2 deletions src/components/colorbar/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ function makeColorBarData(gd) {
var moduleOpts = trace._module.colorbar;

if(trace.visible === true && moduleOpts) {
var cbOpts = Array.isArray(moduleOpts) ? moduleOpts : [moduleOpts];
var allowsMultiplotCbs = Array.isArray(moduleOpts);
var cbOpts = allowsMultiplotCbs ? moduleOpts : [moduleOpts];

for(var j = 0; j < cbOpts.length; j++) {
var cbOpt = cbOpts[j];
Expand All @@ -90,7 +91,7 @@ function makeColorBarData(gd) {

if(cont && cont.showscale) {
var opts = cont.colorbar;
opts._id = 'cb' + trace.uid;
opts._id = 'cb' + trace.uid + (allowsMultiplotCbs && contName ? '-' + contName : '');
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This commits essentially resolves #3555

I didn't add support for marker.line. colorbars (yet) - let me know you think that's a good idea.

opts._traceIndex = trace.index;
opts._propPrefix = (contName ? contName + '.' : '') + 'colorbar.';

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 39 additions & 0 deletions test/image/mocks/gl3d_scatter3d-colorscale-marker-and-line.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"data": [
{
"x": [1, 2, 4, 8, 16],
"y": [-1, -2, -4, -8, -16],
"z": [0, 1, 0, 1, 0],
"type": "scatter3d",
"mode": "lines+markers",
"line": {
"color": [0, 0.25, 0.5, 0.75, 1.0],
"width": 10,
"colorscale": "Blues",
"colorbar": {
"len": 0.5,
"y": 1,
"yanchor": "top",
"title": {"text": "line colorscale", "side": "right"}
}
},
"marker": {
"color": [1.0, 0.75, 0.5, 0.25, 0],
"size": 10,
"colorscale": "Reds",
"colorbar": {
"len": 0.5,
"y": 0,
"yanchor": "bottom",
"title": {"text": "marker colorscale", "side": "right"}
}

}
}
],
"layout": {
"title": "Scatter3d show line AND marker color scales",
"width": 600,
"height": 600
}
}