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
35 changes: 19 additions & 16 deletions src/traces/scattergl/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ var proto = LineWithMarkers.prototype;

proto.handlePick = function(pickResult) {
var index = pickResult.pointId;

if(pickResult.object !== this.line || this.connectgaps) {
index = this.idToIndex[pickResult.pointId];
}
Expand Down Expand Up @@ -136,19 +137,20 @@ proto.isFancy = function(options) {

if(!options.x || !options.y) return true;

var marker = options.marker || {};
if(Array.isArray(marker.symbol) ||
marker.symbol !== 'circle' ||
Array.isArray(marker.size) ||
Array.isArray(marker.line.width) ||
Array.isArray(marker.opacity)
) return true;

var markerColor = marker.color;
if(Array.isArray(markerColor)) return true;
if(this.hasMarkers) {
var marker = options.marker || {};

if(Array.isArray(marker.symbol) ||
marker.symbol !== 'circle' ||
Array.isArray(marker.size) ||
Array.isArray(marker.color) ||
Array.isArray(marker.line.width) ||
Array.isArray(marker.line.color) ||
Array.isArray(marker.opacity)
) return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Eeek.

}

var lineColor = Array.isArray(marker.line.color);
if(Array.isArray(lineColor)) return true;
if(this.hasLines && !this.connectgaps) return true;

if(this.hasErrorX) return true;
if(this.hasErrorY) return true;
Expand Down Expand Up @@ -471,8 +473,10 @@ proto.updateFancy = function(options) {

proto.updateLines = function(options, positions) {
var i;

if(this.hasLines) {
var linePositions = positions;

if(!options.connectgaps) {
var p = 0;
var x = this.xData;
Expand All @@ -484,12 +488,11 @@ proto.updateLines = function(options, positions) {
linePositions[p++] = y[i];
}
}
this.lineOptions.positions = linePositions;

var lineColor = str2RGBArray(options.line.color);
if(this.hasMarkers) lineColor[3] *= options.marker.opacity;
this.lineOptions.positions = linePositions;

var lineWidth = Math.round(0.5 * this.lineOptions.width),
var lineColor = convertColor(options.line.color, options.opacity, 1),
lineWidth = Math.round(0.5 * this.lineOptions.width),
dashes = (DASHES[options.line.dash] || [1]).slice();

for(i = 0; i < dashes.length; ++i) dashes[i] *= lineWidth;
Expand Down
44 changes: 44 additions & 0 deletions test/image/mocks/gl2d_line_opacity.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"data": [
{
"x": [
1,
2,
null,
4,
5
],
"y": [
1,
2,
null,
4,
5
],
"connectgaps": false,
"type": "scattergl",
"opacity": 0.4
}
],
"layout": {
"xaxis": {
"type": "linear",
"range": [
0.9867209252516599,
5.01327907474834
],
"autorange": true
},
"yaxis": {
"type": "linear",
"range": [
0.9529946929492039,
5.047005307050796
],
"autorange": true
},
"height": 450,
"width": 1100,
"autosize": true
}
}