Skip to content

Commit 1abbd90

Browse files
committed
🔪 scattermapbox/calc.js | ♻️ scattergeo/calc.js
1 parent aec6248 commit 1abbd90

File tree

3 files changed

+1
-239
lines changed

3 files changed

+1
-239
lines changed

src/traces/scattermapbox/calc.js

Lines changed: 0 additions & 101 deletions
This file was deleted.

src/traces/scattermapbox/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var ScatterMapbox = {};
1414
ScatterMapbox.attributes = require('./attributes');
1515
ScatterMapbox.supplyDefaults = require('./defaults');
1616
ScatterMapbox.colorbar = require('../scatter/colorbar');
17-
ScatterMapbox.calc = require('./calc');
17+
ScatterMapbox.calc = require('../scattergeo/calc');
1818
ScatterMapbox.hoverPoints = require('./hover');
1919
ScatterMapbox.eventData = require('./event_data');
2020
ScatterMapbox.plot = require('./plot');

test/jasmine/tests/scattermapbox_test.js

Lines changed: 0 additions & 137 deletions
Original file line numberDiff line numberDiff line change
@@ -112,143 +112,6 @@ describe('scattermapbox defaults', function() {
112112
});
113113
});
114114

115-
describe('scattermapbox calc', function() {
116-
'use strict';
117-
118-
function _calc(trace) {
119-
var gd = { data: [trace] };
120-
121-
Plots.supplyDefaults(gd);
122-
123-
var fullTrace = gd._fullData[0];
124-
return ScatterMapbox.calc(gd, fullTrace);
125-
}
126-
127-
var base = { type: 'scattermapbox' };
128-
129-
it('should place lon/lat data in lonlat pairs', function() {
130-
var calcTrace = _calc(Lib.extendFlat({}, base, {
131-
lon: [10, 20, 30],
132-
lat: [20, 30, 10]
133-
}));
134-
135-
expect(calcTrace).toEqual([
136-
{ lonlat: [10, 20] },
137-
{ lonlat: [20, 30] },
138-
{ lonlat: [30, 10] }
139-
]);
140-
});
141-
142-
it('should coerce numeric strings lon/lat data into numbers', function() {
143-
var calcTrace = _calc(Lib.extendFlat({}, base, {
144-
lon: [10, 20, '30', '40'],
145-
lat: [20, '30', 10, '50']
146-
}));
147-
148-
expect(calcTrace).toEqual([
149-
{ lonlat: [10, 20] },
150-
{ lonlat: [20, 30] },
151-
{ lonlat: [30, 10] },
152-
{ lonlat: [40, 50] }
153-
]);
154-
});
155-
156-
it('should keep track of gaps in data', function() {
157-
var calcTrace = _calc(Lib.extendFlat({}, base, {
158-
lon: [null, 10, null, null, 20, '30', null, '40', null, 10],
159-
lat: [10, 20, '30', null, 10, '50', null, 60, null, null]
160-
}));
161-
162-
expect(calcTrace).toEqual([
163-
{ lonlat: [10, 20], gapAfter: true },
164-
{ lonlat: [20, 10] },
165-
{ lonlat: [30, 50], gapAfter: true },
166-
{ lonlat: [40, 60], gapAfter: true }
167-
]);
168-
});
169-
170-
it('should fill array text (base case)', function() {
171-
var calcTrace = _calc(Lib.extendFlat({}, base, {
172-
lon: [10, 20, 30],
173-
lat: [20, 30, 10],
174-
text: ['A', 'B', 'C']
175-
}));
176-
177-
expect(calcTrace).toEqual([
178-
{ lonlat: [10, 20], tx: 'A' },
179-
{ lonlat: [20, 30], tx: 'B' },
180-
{ lonlat: [30, 10], tx: 'C' }
181-
]);
182-
});
183-
184-
it('should fill array text (invalid entry case)', function() {
185-
var calcTrace = _calc(Lib.extendFlat({}, base, {
186-
lon: [10, 20, 30],
187-
lat: [20, 30, 10],
188-
text: ['A', 'B', null]
189-
}));
190-
191-
expect(calcTrace).toEqual([
192-
{ lonlat: [10, 20], tx: 'A' },
193-
{ lonlat: [20, 30], tx: 'B' },
194-
{ lonlat: [30, 10], tx: '' }
195-
]);
196-
});
197-
198-
it('should fill array marker attributes (base case)', function() {
199-
var calcTrace = _calc(Lib.extendFlat({}, base, {
200-
lon: [10, 20, null, 30],
201-
lat: [20, 30, null, 10],
202-
marker: {
203-
color: ['red', 'blue', 'green', 'yellow'],
204-
size: [10, 20, 8, 10]
205-
}
206-
}));
207-
208-
expect(calcTrace).toEqual([
209-
{ lonlat: [10, 20], mc: 'red', ms: 10, mcc: 'red', mrc: 5 },
210-
{ lonlat: [20, 30], mc: 'blue', ms: 20, mcc: 'blue', mrc: 10, gapAfter: true },
211-
{ lonlat: [30, 10], mc: 'yellow', ms: 10, mcc: 'yellow', mrc: 5 }
212-
]);
213-
});
214-
215-
it('should fill array marker attributes (invalid scale case)', function() {
216-
var calcTrace = _calc(Lib.extendFlat({}, base, {
217-
lon: [10, 20, null, 30],
218-
lat: [20, 30, null, 10],
219-
marker: {
220-
color: [0, null, 5, 10],
221-
size: [10, NaN, 8, 10],
222-
colorscale: [
223-
[0, 'blue'], [0.5, 'red'], [1, 'green']
224-
]
225-
}
226-
}));
227-
228-
expect(calcTrace).toEqual([
229-
{ lonlat: [10, 20], mc: 0, ms: 10, mcc: 'rgb(0, 0, 255)', mrc: 5 },
230-
{ lonlat: [20, 30], mc: null, ms: NaN, mcc: '#444', mrc: 0, gapAfter: true },
231-
{ lonlat: [30, 10], mc: 10, ms: 10, mcc: 'rgb(0, 128, 0)', mrc: 5 }
232-
]);
233-
});
234-
235-
it('should fill marker attributes (symbol case)', function() {
236-
var calcTrace = _calc(Lib.extendFlat({}, base, {
237-
lon: [10, 20, null, 30],
238-
lat: [20, 30, null, 10],
239-
marker: {
240-
symbol: ['monument', 'music', 'harbor', null]
241-
}
242-
}));
243-
244-
expect(calcTrace).toEqual([
245-
{ lonlat: [10, 20], mx: 'monument' },
246-
{ lonlat: [20, 30], mx: 'music', gapAfter: true },
247-
{ lonlat: [30, 10], mx: 'circle' }
248-
]);
249-
});
250-
});
251-
252115
describe('scattermapbox convert', function() {
253116
'use strict';
254117

0 commit comments

Comments
 (0)