8000 Scattermapbox BADNUM (w/o upgrading mapbox-gl) by etpinard · Pull Request #1564 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content
< 8000 h1 class="gh-header-title mb-2 lh-condensed f1 mr-0 flex-auto wb-break-word"> Scattermapbox BADNUM (w/o upgrading mapbox-gl) #1564
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 6 commits into from
Apr 7, 2017
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
Prev Previous commit
Next Next commit
🔪 scattermapbox/calc.js | ♻️ scattergeo/calc.js
  • Loading branch information
etpinard committed Apr 7, 2017
commit 1abbd90fee804c8111ba340c440f60b1a1817387
101 changes: 0 additions & 101 deletions src/traces/scattermapbox/calc.js

This file was deleted.

2 changes: 1 addition & 1 deletion src/traces/scattermapbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var ScatterMapbox = {};
ScatterMapbox.attributes = require('./attributes');
ScatterMapbox.supplyDefaults = require('./defaults');
ScatterMapbox.colorbar = require('../scatter/colorbar');
ScatterMapbox.calc = require('./calc');
ScatterMapbox.calc = require('../scattergeo/calc');
ScatterMapbox.hoverPoints = require('./hover');
ScatterMapbox.eventData = require('./event_data');
ScatterMapbox.plot = require('./plot');
Expand Down
137 changes: 0 additions & 137 deletions test/jasmine/tests/scattermapbox_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,143 +112,6 @@ describe('scattermapbox defaults', function() {
});
});

describe('scattermapbox calc', function() {
'use strict';

function _calc(trace) {
var gd = { data: [trace] };

Plots.supplyDefaults(gd);

var fullTrace = gd._fullData[0];
return ScatterMapbox.calc(gd, fullTrace);
}

var base = { type: 'scattermapbox' };

it('should place lon/lat data in lonlat pairs', function() {
var calcTrace = _calc(Lib.extendFlat({}, base, {
lon: [10, 20, 30],
lat: [20, 30, 10]
}));

expect(calcTrace).toEqual([
{ lonlat: [10, 20] },
{ lonlat: [20, 30] },
{ lonlat: [30, 10] }
]);
});

it('should coerce numeric strings lon/lat data into numbers', function() {
var calcTrace = _calc(Lib.extendFlat({}, base, {
lon: [10, 20, '30', '40'],
lat: [20, '30', 10, '50']
}));

expect(calcTrace).toEqual([
{ lonlat: [10, 20] },
{ lonlat: [20, 30] },
{ lonlat: [30, 10] },
{ lonlat: [40, 50] }
]);
});

it('should keep track of gaps in data', function() {
var calcTrace = _calc(Lib.extendFlat({}, base, {
lon: [null, 10, null, null, 20, '30', null, '40', null, 10],
lat: [10, 20, '30', null, 10, '50', null, 60, null, null]
}));

expect(calcTrace).toEqual([
{ lonlat: [10, 20], gapAfter: true },
{ lonlat: [20, 10] },
{ lonlat: [30, 50], gapAfter: true },
{ lonlat: [40, 60], gapAfter: true }
]);
});

it('should fill array text (base case)', function() {
var calcTrace = _calc(Lib.extendFlat({}, base, {
lon: [10, 20, 30],
lat: [20, 30, 10],
text: ['A', 'B', 'C']
}));

expect(calcTrace).toEqual([
{ lonlat: [10, 20], tx: 'A' },
{ lonlat: [20, 30], tx: 'B' },
{ lonlat: [30, 10], tx: 'C' }
]);
});

it('should fill array text (invalid entry case)', function() {
var calcTrace = _calc(Lib.extendFlat({}, base, {
lon: [10, 20, 30],
lat: [20, 30, 10],
text: ['A', 'B', null]
}));

expect(calcTrace).toEqual([
{ lonlat: [10, 20], tx: 'A' },
{ lonlat: [20, 30], tx: 'B' },
{ lonlat: [30, 10], tx: '' }
]);
});

it('should fill array marker attributes (base case)', function() {
var calcTrace = _calc(Lib.extendFlat({}, base, {
lon: [10, 20, null, 30],
lat: [20, 30, null, 10],
marker: {
color: ['red', 'blue', 'green', 'yellow'],
size: [10, 20, 8, 10]
}
}));

expect(calcTrace).toEqual([
{ lonlat: [10, 20], mc: 'red', ms: 10, mcc: 'red', mrc: 5 },
{ lonlat: [20, 30], mc: 'blue', ms: 20, mcc: 'blue', mrc: 10, gapAfter: true },
{ lonlat: [30, 10], mc: 'yellow', ms: 10, mcc: 'yellow', mrc: 5 }
]);
});

it('should fill array marker attributes (invalid scale case)', function() {
var calcTrace = _calc(Lib.extendFlat({}, base, {
lon: [10, 20, null, 30],
lat: [20, 30, null, 10],
marker: {
color: [0, null, 5, 10],
size: [10, NaN, 8, 10],
colorscale: [
[0, 'blue'], [0.5, 'red'], [1, 'green']
]
}
}));

expect(calcTrace).toEqual([
{ lonlat: [10, 20], mc: 0, ms: 10, mcc: 'rgb(0, 0, 255)', mrc: 5 },
{ lonlat: [20, 30], mc: null, ms: NaN, mcc: '#444', mrc: 0, gapAfter: true },
{ lonlat: [30, 10], mc: 10, ms: 10, mcc: 'rgb(0, 128, 0)', mrc: 5 }
]);
});

it('should fill marker attributes (symbol case)', function() {
var calcTrace = _calc(Lib.extendFlat({}, base, {
lon: [10, 20, null, 30],
lat: [20, 30, null, 10],
marker: {
symbol: ['monument', 'music', 'harbor', null]
}
}));

expect(calcTrace).toEqual([
{ lonlat: [10, 20], mx: 'monument' },
{ lonlat: [20, 30], mx: 'music', gapAfter: true },
{ lonlat: [30, 10], mx: 'circle' }
]);
});
});

describe('scattermapbox convert', function() {
'use strict';

Expand Down
0