8000 scattergl lines fixes for opacity and connectgaps by etpinard · Pull Request #589 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

scattergl lines fixes for opacity and connectgaps #589

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 3 commits into from
Jun 1, 2016
Merged
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
Prev Previous commit
Next Next commit
fix is-fancy logic:
- if trace has markers and any array style attr -> fancy
- if trace has markers and a non-circle symbol -> fancy
- if trace has lines and connecgaps false -> fancy
  • Loading branch information
etpinard committed May 31, 2016
commit 0f35746b6fb81b05989ad33c045aa9519265d78b
30 changes: 17 additions & 13 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,8 +488,8 @@ proto.updateLines = function(options, positions) {
linePositions[p++] = y[i];
}
}
this.lineOptions.positions = linePositions;

this.lineOptions.positions = linePositions;

var lineColor = convertColor(options.line.color, options.opacity, 1),
lineWidth = Math.round(0.5 * this.lineOptions.width),
Expand Down
0