Skip to content

Scattermapbox BADNUM + [email protected] #1543

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

Closed
wants to merge 6 commits into from
Closed
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"gl-shader": "4.2.0",
"gl-spikes2d": "^1.0.1",
"gl-surface3d": "^1.3.0",
"mapbox-gl": "^0.22.0",
"mapbox-gl": "^0.33.1",
"mouse-change": "^1.4.0",
"mouse-wheel": "^1.0.2",
"ndarray": "^1.0.18",
Expand Down
2 changes: 1 addition & 1 deletion src/lib/geojson_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ exports.calcTraceToLineCoords = function(calcTrace) {
var calcPt = calcTrace[i];
var lonlat = calcPt.lonlat;

if(lonlat[0] !== BADNUM && lonlat[1] !== BADNUM) {
if(lonlat[0] !== BADNUM) {
lineString.push(lonlat);
} else if(!connectgaps && lineString.length > 0) {
coords.push(lineString);
Expand Down
2 changes: 1 addition & 1 deletion src/plots/mapbox/mapbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ proto.updateMap = function(calcData, fullLayout, resolve, reject) {
self.styleObj = styleObj;
map.setStyle(styleObj.style);

map.style.once('load', function() {
map.once('style.load', function() {

// need to rebuild trace layers on reload
// to avoid 'lost event' errors
Expand Down
5 changes: 1 addition & 4 deletions src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -2012,11 +2012,8 @@ plots.doCalcdata = function(gd, traces) {
//
// This ensures there is a calcdata item for every trace,
// even if cartesian logic doesn't handle it (for things like legends).
//
// Tag this artificial calc point with 'placeholder: true',
// to make it easier to skip over them in during the plot and hover step.
if(!Array.isArray(cd) || !cd[0]) {
cd = [{x: false, y: false, placeholder: true}];
cd = [{x: false, y: false}];
Copy link
Collaborator

Choose a reason for hiding this comment

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

should we turn this into [{x: BADNUM, y: BADNUM}] or are we not quite ready for that yet?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Let me try that!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in b5cd573

Didn't break any tests. The only place I can think of that this would impact in the legend code, but looks like it isn't making any assumptions on x / y here.

}

// add the trace-wide properties to the first point,
Expand Down
8 changes: 3 additions & 5 deletions src/traces/scattergeo/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ module.exports = function calc(gd, trace) {
if(hasLocationData) {
var loc = trace.locations[i];
calcPt.loc = typeof loc === 'string' ? loc : null;
}
else {
} else {
var lon = trace.lon[i];
var lat = trace.lat[i];
calcPt.lonlat = new Array(2);

calcPt.lonlat[0] = isNumeric(lon) ? +lon : BADNUM;
calcPt.lonlat[1] = isNumeric(lat) ? +lat : BADNUM;
if(isNumeric(lon) && isNumeric(lat)) calcPt.lonlat = [+lon, +lat];
else calcPt.lonlat = [BADNUM, BADNUM];
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/traces/scattergeo/hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module.exports = function hoverPoints(pointData) {
function distFn(d) {
var lonlat = d.lonlat;

if(lonlat[0] === BADNUM || lonlat[1] === BADNUM) return Infinity;
if(lonlat[0] === BADNUM) return Infinity;

if(geo.isLonLatOverEdges(lonlat)) return Infinity;

Expand Down
3 changes: 1 addition & 2 deletions src/traces/scattergeo/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ module.exports = function plot(geo, calcData) {
function keyFunc(d) { return d[0].trace.uid; }

function removeBADNUM(d, node) {
var lonlat = d.lonlat;
if(lonlat[0] === BADNUM || lonlat[1] === BADNUM) {
if(d.lonlat[0] === BADNUM) {
d3.select(node).remove();
}
}
Expand Down
101 changes: 0 additions & 101 deletions src/traces/scattermapbox/calc.js

This file was deleted.

Loading