plotly.js 2.15.1 → 2.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/README.md +3 -3
- package/dist/README.md +19 -19
- package/dist/plot-schema.json +92 -0
- package/dist/plotly-basic.js +2 -2
- package/dist/plotly-basic.min.js +2 -2
- package/dist/plotly-cartesian.js +2 -2
- package/dist/plotly-cartesian.min.js +2 -2
- package/dist/plotly-finance.js +2 -2
- package/dist/plotly-finance.min.js +2 -2
- package/dist/plotly-geo-assets.js +2 -2
- package/dist/plotly-geo.js +2 -2
- package/dist/plotly-geo.min.js +2 -2
- package/dist/plotly-gl2d.js +2 -2
- package/dist/plotly-gl2d.min.js +2 -2
- package/dist/plotly-gl3d.js +2 -2
- package/dist/plotly-gl3d.min.js +2 -2
- package/dist/plotly-mapbox.js +238 -47
- package/dist/plotly-mapbox.min.js +3 -3
- package/dist/plotly-strict.js +238 -47
- package/dist/plotly-strict.min.js +11 -11
- package/dist/plotly-with-meta.js +271 -47
- package/dist/plotly.js +238 -47
- package/dist/plotly.min.js +2 -2
- package/package.json +1 -1
- package/src/plots/mapbox/layout_attributes.js +31 -0
- package/src/plots/mapbox/layout_defaults.js +13 -0
- package/src/plots/mapbox/mapbox.js +4 -0
- package/src/traces/scattermapbox/attributes.js +45 -0
- package/src/traces/scattermapbox/convert.js +51 -6
- package/src/traces/scattermapbox/defaults.js +19 -0
- package/src/traces/scattermapbox/hover.js +10 -0
- package/src/traces/scattermapbox/plot.js +94 -37
- package/src/version.js +1 -1
package/dist/plotly-with-meta.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* plotly.js v2.
|
|
2
|
+
* plotly.js v2.16.0
|
|
3
3
|
* Copyright 2012-2022, Plotly, Inc.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Licensed under the MIT license
|
|
@@ -166252,6 +166252,37 @@ var attrs = module.exports = overrideAll({
|
|
|
166252
166252
|
].join(' ')
|
|
166253
166253
|
},
|
|
166254
166254
|
|
|
166255
|
+
bounds: {
|
|
166256
|
+
west: {
|
|
166257
|
+
valType: 'number',
|
|
166258
|
+
description: [
|
|
166259
|
+
'Sets the minimum longitude of the map (in degrees East)',
|
|
166260
|
+
'if `east`, `south` and `north` are declared.'
|
|
166261
|
+
].join(' ')
|
|
166262
|
+
},
|
|
166263
|
+
east: {
|
|
166264
|
+
valType: 'number',
|
|
166265
|
+
description: [
|
|
166266
|
+
'Sets the maximum longitude of the map (in degrees East)',
|
|
166267
|
+
'if `west`, `south` and `north` are declared.'
|
|
166268
|
+
].join(' ')
|
|
166269
|
+
},
|
|
166270
|
+
south: {
|
|
166271
|
+
valType: 'number',
|
|
166272
|
+
description: [
|
|
166273
|
+
'Sets the minimum latitude of the map (in degrees North)',
|
|
166274
|
+
'if `east`, `west` and `north` are declared.'
|
|
166275
|
+
].join(' ')
|
|
166276
|
+
},
|
|
166277
|
+
north: {
|
|
166278
|
+
valType: 'number',
|
|
166279
|
+
description: [
|
|
166280
|
+
'Sets the maximum latitude of the map (in degrees North)',
|
|
166281
|
+
'if `east`, `west` and `south` are declared.'
|
|
166282
|
+
].join(' ')
|
|
166283
|
+
}
|
|
166284
|
+
},
|
|
166285
|
+
|
|
166255
166286
|
layers: templatedArray('layer', {
|
|
166256
166287
|
visible: {
|
|
166257
166288
|
valType: 'boolean',
|
|
@@ -166501,6 +166532,19 @@ function handleDefaults(containerIn, containerOut, coerce, opts) {
|
|
|
166501
166532
|
coerce('bearing');
|
|
166502
166533
|
coerce('pitch');
|
|
166503
166534
|
|
|
166535
|
+
var west = coerce('bounds.west');
|
|
166536
|
+
var east = coerce('bounds.east');
|
|
166537
|
+
var south = coerce('bounds.south');
|
|
166538
|
+
var north = coerce('bounds.north');
|
|
166539
|
+
if(
|
|
166540
|
+
west === undefined ||
|
|
166541
|
+
east === undefined ||
|
|
166542
|
+
south === undefined ||
|
|
166543
|
+
north === undefined
|
|
166544
|
+
) {
|
|
166545
|
+
delete containerOut.bounds;
|
|
166546
|
+
}
|
|
166547
|
+
|
|
166504
166548
|
handleArrayContainerDefaults(containerIn, containerOut, {
|
|
166505
166549
|
name: 'layers',
|
|
166506
166550
|
handleItemDefaults: handleLayerDefaults
|
|
@@ -166666,6 +166710,9 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
|
|
|
166666
166710
|
// store access token associated with this map
|
|
166667
166711
|
self.accessToken = opts.accesstoken;
|
|
166668
166712
|
|
|
166713
|
+
var bounds = opts.bounds;
|
|
166714
|
+
var maxBounds = bounds ? [[bounds.west, bounds.south], [bounds.east, bounds.north]] : null;
|
|
166715
|
+
|
|
166669
166716
|
// create the map!
|
|
166670
166717
|
var map = self.map = new mapboxgl.Map({
|
|
166671
166718
|
container: self.div,
|
|
@@ -166675,6 +166722,7 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
|
|
|
166675
166722
|
zoom: opts.zoom,
|
|
166676
166723
|
bearing: opts.bearing,
|
|
166677
166724
|
pitch: opts.pitch,
|
|
166725
|
+
maxBounds: maxBounds,
|
|
166678
166726
|
|
|
166679
166727
|
interactive: !self.isStatic,
|
|
166680
166728
|
preserveDrawingBuffer: self.isStatic,
|
|
@@ -219582,6 +219630,7 @@ var colorScaleAttrs = _dereq_('../../components/colorscale/attributes');
|
|
|
219582
219630
|
|
|
219583
219631
|
var extendFlat = _dereq_('../../lib/extend').extendFlat;
|
|
219584
219632
|
var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll;
|
|
219633
|
+
var mapboxLayoutAtributes = _dereq_('../../plots/mapbox/layout_attributes');
|
|
219585
219634
|
|
|
219586
219635
|
var lineAttrs = scatterGeoAttrs.line;
|
|
219587
219636
|
var markerAttrs = scatterGeoAttrs.marker;
|
|
@@ -219590,6 +219639,50 @@ module.exports = overrideAll({
|
|
|
219590
219639
|
lon: scatterGeoAttrs.lon,
|
|
219591
219640
|
lat: scatterGeoAttrs.lat,
|
|
219592
219641
|
|
|
219642
|
+
cluster: {
|
|
219643
|
+
enabled: {
|
|
219644
|
+
valType: 'boolean',
|
|
219645
|
+
description: 'Determines whether clustering is enabled or disabled.'
|
|
219646
|
+
},
|
|
219647
|
+
maxzoom: extendFlat({}, mapboxLayoutAtributes.layers.maxzoom, {
|
|
219648
|
+
description: [
|
|
219649
|
+
'Sets the maximum zoom level.',
|
|
219650
|
+
'At zoom levels equal to or greater than this, points will never be clustered.'
|
|
219651
|
+
].join(' ')
|
|
219652
|
+
}),
|
|
219653
|
+
step: {
|
|
219654
|
+
valType: 'number',
|
|
219655
|
+
arrayOk: true,
|
|
219656
|
+
dflt: -1,
|
|
219657
|
+
min: -1,
|
|
219658
|
+
description: [
|
|
219659
|
+
'Sets how many points it takes to create a cluster or advance to the next cluster step.',
|
|
219660
|
+
'Use this in conjunction with arrays for `size` and / or `color`.',
|
|
219661
|
+
'If an integer, steps start at multiples of this number.',
|
|
219662
|
+
'If an array, each step extends from the given value until one less than the next value.'
|
|
219663
|
+
].join(' ')
|
|
219664
|
+
},
|
|
219665
|
+
size: {
|
|
219666
|
+
valType: 'number',
|
|
219667
|
+
arrayOk: true,
|
|
219668
|
+
dflt: 20,
|
|
219669
|
+
min: 0,
|
|
219670
|
+
description: [
|
|
219671
|
+
'Sets the size for each cluster step.'
|
|
219672
|
+
].join(' ')
|
|
219673
|
+
},
|
|
219674
|
+
color: {
|
|
219675
|
+
valType: 'color',
|
|
219676
|
+
arrayOk: true,
|
|
219677
|
+
description: [
|
|
219678
|
+
'Sets the color for each cluster step.'
|
|
219679
|
+
].join(' ')
|
|
219680
|
+
},
|
|
219681
|
+
opacity: extendFlat({}, markerAttrs.opacity, {
|
|
219682
|
+
dflt: 1
|
|
219683
|
+
})
|
|
219684
|
+
},
|
|
219685
|
+
|
|
219593
219686
|
// locations
|
|
219594
219687
|
// locationmode
|
|
219595
219688
|
|
|
@@ -219736,11 +219829,12 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
219736
219829
|
var hasText = subTypes.hasText(trace);
|
|
219737
219830
|
var hasCircles = (hasMarkers && trace.marker.symbol === 'circle');
|
|
219738
219831
|
var hasSymbols = (hasMarkers && trace.marker.symbol !== 'circle');
|
|
219832
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
219739
219833
|
|
|
219740
|
-
var fill = initContainer();
|
|
219741
|
-
var line = initContainer();
|
|
219742
|
-
var circle = initContainer();
|
|
219743
|
-
var symbol = initContainer();
|
|
219834
|
+
var fill = initContainer('fill');
|
|
219835
|
+
var line = initContainer('line');
|
|
219836
|
+
var circle = initContainer('circle');
|
|
219837
|
+
var symbol = initContainer('symbol');
|
|
219744
219838
|
|
|
219745
219839
|
var opts = {
|
|
219746
219840
|
fill: fill,
|
|
@@ -219784,6 +219878,29 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
219784
219878
|
var circleOpts = makeCircleOpts(calcTrace);
|
|
219785
219879
|
circle.geojson = circleOpts.geojson;
|
|
219786
219880
|
circle.layout.visibility = 'visible';
|
|
219881
|
+
if(hasCluster) {
|
|
219882
|
+
circle.filter = ['!', ['has', 'point_count']];
|
|
219883
|
+
opts.cluster = {
|
|
219884
|
+
type: 'circle',
|
|
219885
|
+
filter: ['has', 'point_count'],
|
|
219886
|
+
layout: {visibility: 'visible'},
|
|
219887
|
+
paint: {
|
|
219888
|
+
'circle-color': arrayifyAttribute(trace.cluster.color, trace.cluster.step),
|
|
219889
|
+
'circle-radius': arrayifyAttribute(trace.cluster.size, trace.cluster.step),
|
|
219890
|
+
'circle-opacity': arrayifyAttribute(trace.cluster.opacity, trace.cluster.step),
|
|
219891
|
+
},
|
|
219892
|
+
};
|
|
219893
|
+
opts.clusterCount = {
|
|
219894
|
+
type: 'symbol',
|
|
219895
|
+
filter: ['has', 'point_count'],
|
|
219896
|
+
paint: {},
|
|
219897
|
+
layout: {
|
|
219898
|
+
'text-field': '{point_count_abbreviated}',
|
|
219899
|
+
'text-font': ['Open Sans Regular', 'Arial Unicode MS Regular'],
|
|
219900
|
+
'text-size': 12
|
|
219901
|
+
}
|
|
219902
|
+
};
|
|
219903
|
+
}
|
|
219787
219904
|
|
|
219788
219905
|
Lib.extendFlat(circle.paint, {
|
|
219789
219906
|
'circle-color': circleOpts.mcc,
|
|
@@ -219792,6 +219909,10 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
219792
219909
|
});
|
|
219793
219910
|
}
|
|
219794
219911
|
|
|
219912
|
+
if(hasCircles && hasCluster) {
|
|
219913
|
+
circle.filter = ['!', ['has', 'point_count']];
|
|
219914
|
+
}
|
|
219915
|
+
|
|
219795
219916
|
if(hasSymbols || hasText) {
|
|
219796
219917
|
symbol.geojson = makeSymbolGeoJSON(calcTrace, gd);
|
|
219797
219918
|
|
|
@@ -219852,10 +219973,12 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
219852
219973
|
return opts;
|
|
219853
219974
|
};
|
|
219854
219975
|
|
|
219855
|
-
function initContainer() {
|
|
219976
|
+
function initContainer(type) {
|
|
219856
219977
|
return {
|
|
219978
|
+
type: type,
|
|
219857
219979
|
geojson: geoJsonUtils.makeBlank(),
|
|
219858
219980
|
layout: { visibility: 'none' },
|
|
219981
|
+
filter: null,
|
|
219859
219982
|
paint: {}
|
|
219860
219983
|
};
|
|
219861
219984
|
}
|
|
@@ -219910,7 +220033,8 @@ function makeCircleOpts(calcTrace) {
|
|
|
219910
220033
|
|
|
219911
220034
|
features.push({
|
|
219912
220035
|
type: 'Feature',
|
|
219913
|
-
|
|
220036
|
+
id: i + 1,
|
|
220037
|
+
geometry: { type: 'Point', coordinates: lonlat },
|
|
219914
220038
|
properties: props
|
|
219915
220039
|
});
|
|
219916
220040
|
}
|
|
@@ -220034,6 +220158,20 @@ function isBADNUM(lonlat) {
|
|
|
220034
220158
|
return lonlat[0] === BADNUM;
|
|
220035
220159
|
}
|
|
220036
220160
|
|
|
220161
|
+
function arrayifyAttribute(values, step) {
|
|
220162
|
+
var newAttribute;
|
|
220163
|
+
if(Lib.isArrayOrTypedArray(values) && Lib.isArrayOrTypedArray(step)) {
|
|
220164
|
+
newAttribute = ['step', ['get', 'point_count'], values[0]];
|
|
220165
|
+
|
|
220166
|
+
for(var idx = 1; idx < values.length; idx++) {
|
|
220167
|
+
newAttribute.push(step[idx - 1], values[idx]);
|
|
220168
|
+
}
|
|
220169
|
+
} else {
|
|
220170
|
+
newAttribute = values;
|
|
220171
|
+
}
|
|
220172
|
+
return newAttribute;
|
|
220173
|
+
}
|
|
220174
|
+
|
|
220037
220175
|
},{"../../components/colorscale":379,"../../components/drawing":389,"../../components/fx/helpers":403,"../../constants/numerical":491,"../../lib":515,"../../lib/geojson_utils":509,"../../lib/svg_text_utils":541,"../../plots/mapbox/convert_text_opts":621,"../scatter/make_bubble_size_func":953,"../scatter/subtypes":961,"fast-isnumeric":190}],1004:[function(_dereq_,module,exports){
|
|
220038
220176
|
'use strict';
|
|
220039
220177
|
|
|
@@ -220051,6 +220189,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
220051
220189
|
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
|
|
220052
220190
|
}
|
|
220053
220191
|
|
|
220192
|
+
function coerce2(attr, dflt) {
|
|
220193
|
+
return Lib.coerce2(traceIn, traceOut, attributes, attr, dflt);
|
|
220194
|
+
}
|
|
220195
|
+
|
|
220054
220196
|
var len = handleLonLatDefaults(traceIn, traceOut, coerce);
|
|
220055
220197
|
if(!len) {
|
|
220056
220198
|
traceOut.visible = false;
|
|
@@ -220083,6 +220225,21 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
220083
220225
|
}
|
|
220084
220226
|
}
|
|
220085
220227
|
|
|
220228
|
+
var clusterMaxzoom = coerce2('cluster.maxzoom');
|
|
220229
|
+
var clusterStep = coerce2('cluster.step');
|
|
220230
|
+
var clusterColor = coerce2('cluster.color', (traceOut.marker && traceOut.marker.color) || defaultColor);
|
|
220231
|
+
var clusterSize = coerce2('cluster.size');
|
|
220232
|
+
var clusterOpacity = coerce2('cluster.opacity');
|
|
220233
|
+
|
|
220234
|
+
var clusterEnabledDflt =
|
|
220235
|
+
clusterMaxzoom !== false ||
|
|
220236
|
+
clusterStep !== false ||
|
|
220237
|
+
clusterColor !== false ||
|
|
220238
|
+
clusterSize !== false ||
|
|
220239
|
+
clusterOpacity !== false;
|
|
220240
|
+
|
|
220241
|
+
coerce('cluster.enabled', clusterEnabledDflt);
|
|
220242
|
+
|
|
220086
220243
|
if(subTypes.hasText(traceOut)) {
|
|
220087
220244
|
handleTextDefaults(traceIn, traceOut, layout, coerce, {noSelect: true});
|
|
220088
220245
|
}
|
|
@@ -220141,6 +220298,7 @@ var Lib = _dereq_('../../lib');
|
|
|
220141
220298
|
var getTraceColor = _dereq_('../scatter/get_trace_color');
|
|
220142
220299
|
var fillText = Lib.fillText;
|
|
220143
220300
|
var BADNUM = _dereq_('../../constants/numerical').BADNUM;
|
|
220301
|
+
var LAYER_PREFIX = _dereq_('../../plots/mapbox/constants').traceLayerPrefix;
|
|
220144
220302
|
|
|
220145
220303
|
function hoverPoints(pointData, xval, yval) {
|
|
220146
220304
|
var cd = pointData.cd;
|
|
@@ -220148,6 +220306,14 @@ function hoverPoints(pointData, xval, yval) {
|
|
|
220148
220306
|
var xa = pointData.xa;
|
|
220149
220307
|
var ya = pointData.ya;
|
|
220150
220308
|
var subplot = pointData.subplot;
|
|
220309
|
+
var clusteredPointsIds = [];
|
|
220310
|
+
var layer = LAYER_PREFIX + trace.uid + '-circle';
|
|
220311
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
220312
|
+
|
|
220313
|
+
if(hasCluster) {
|
|
220314
|
+
var elems = subplot.map.queryRenderedFeatures(null, {layers: [layer]});
|
|
220315
|
+
clusteredPointsIds = elems.map(function(elem) {return elem.id;});
|
|
220316
|
+
}
|
|
220151
220317
|
|
|
220152
220318
|
// compute winding number about [-180, 180] globe
|
|
220153
220319
|
var winding = (xval >= 0) ?
|
|
@@ -220161,6 +220327,7 @@ function hoverPoints(pointData, xval, yval) {
|
|
|
220161
220327
|
function distFn(d) {
|
|
220162
220328
|
var lonlat = d.lonlat;
|
|
220163
220329
|
if(lonlat[0] === BADNUM) return Infinity;
|
|
220330
|
+
if(hasCluster && clusteredPointsIds.indexOf(d.i + 1) === -1) return Infinity;
|
|
220164
220331
|
|
|
220165
220332
|
var lon = Lib.modHalf(lonlat[0], 360);
|
|
220166
220333
|
var lat = lonlat[1];
|
|
@@ -220241,7 +220408,7 @@ module.exports = {
|
|
|
220241
220408
|
getExtraText: getExtraText
|
|
220242
220409
|
};
|
|
220243
220410
|
|
|
220244
|
-
},{"../../components/fx":407,"../../constants/numerical":491,"../../lib":515,"../scatter/get_trace_color":946}],1008:[function(_dereq_,module,exports){
|
|
220411
|
+
},{"../../components/fx":407,"../../constants/numerical":491,"../../lib":515,"../../plots/mapbox/constants":620,"../scatter/get_trace_color":946}],1008:[function(_dereq_,module,exports){
|
|
220245
220412
|
'use strict';
|
|
220246
220413
|
|
|
220247
220414
|
module.exports = {
|
|
@@ -220279,27 +220446,36 @@ module.exports = {
|
|
|
220279
220446
|
},{"../../plots/mapbox":622,"../scatter/marker_colorbar":954,"../scattergeo/calc":979,"./attributes":1002,"./defaults":1004,"./event_data":1005,"./format_labels":1006,"./hover":1007,"./plot":1009,"./select":1010}],1009:[function(_dereq_,module,exports){
|
|
220280
220447
|
'use strict';
|
|
220281
220448
|
|
|
220449
|
+
var Lib = _dereq_('../../lib');
|
|
220282
220450
|
var convert = _dereq_('./convert');
|
|
220283
220451
|
var LAYER_PREFIX = _dereq_('../../plots/mapbox/constants').traceLayerPrefix;
|
|
220284
|
-
var ORDER =
|
|
220452
|
+
var ORDER = {
|
|
220453
|
+
cluster: ['cluster', 'clusterCount', 'circle'],
|
|
220454
|
+
nonCluster: ['fill', 'line', 'circle', 'symbol'],
|
|
220455
|
+
};
|
|
220285
220456
|
|
|
220286
|
-
function ScatterMapbox(subplot, uid) {
|
|
220457
|
+
function ScatterMapbox(subplot, uid, clusterEnabled) {
|
|
220287
220458
|
this.type = 'scattermapbox';
|
|
220288
220459
|
this.subplot = subplot;
|
|
220289
220460
|
this.uid = uid;
|
|
220461
|
+
this.clusterEnabled = clusterEnabled;
|
|
220290
220462
|
|
|
220291
220463
|
this.sourceIds = {
|
|
220292
220464
|
fill: 'source-' + uid + '-fill',
|
|
220293
220465
|
line: 'source-' + uid + '-line',
|
|
220294
220466
|
circle: 'source-' + uid + '-circle',
|
|
220295
|
-
symbol: 'source-' + uid + '-symbol'
|
|
220467
|
+
symbol: 'source-' + uid + '-symbol',
|
|
220468
|
+
cluster: 'source-' + uid + '-circle',
|
|
220469
|
+
clusterCount: 'source-' + uid + '-circle',
|
|
220296
220470
|
};
|
|
220297
220471
|
|
|
220298
220472
|
this.layerIds = {
|
|
220299
220473
|
fill: LAYER_PREFIX + uid + '-fill',
|
|
220300
220474
|
line: LAYER_PREFIX + uid + '-line',
|
|
220301
220475
|
circle: LAYER_PREFIX + uid + '-circle',
|
|
220302
|
-
symbol: LAYER_PREFIX + uid + '-symbol'
|
|
220476
|
+
symbol: LAYER_PREFIX + uid + '-symbol',
|
|
220477
|
+
cluster: LAYER_PREFIX + uid + '-cluster',
|
|
220478
|
+
clusterCount: LAYER_PREFIX + uid + '-cluster-count',
|
|
220303
220479
|
};
|
|
220304
220480
|
|
|
220305
220481
|
// We could merge the 'fill' source with the 'line' source and
|
|
@@ -220313,11 +220489,20 @@ function ScatterMapbox(subplot, uid) {
|
|
|
220313
220489
|
|
|
220314
220490
|
var proto = ScatterMapbox.prototype;
|
|
220315
220491
|
|
|
220316
|
-
proto.addSource = function(k, opts) {
|
|
220317
|
-
|
|
220492
|
+
proto.addSource = function(k, opts, cluster) {
|
|
220493
|
+
var sourceOpts = {
|
|
220318
220494
|
type: 'geojson',
|
|
220319
|
-
data: opts.geojson
|
|
220320
|
-
}
|
|
220495
|
+
data: opts.geojson,
|
|
220496
|
+
};
|
|
220497
|
+
|
|
220498
|
+
if(cluster && cluster.enabled) {
|
|
220499
|
+
Lib.extendFlat(sourceOpts, {
|
|
220500
|
+
cluster: true,
|
|
220501
|
+
clusterMaxZoom: cluster.maxzoom,
|
|
220502
|
+
});
|
|
220503
|
+
}
|
|
220504
|
+
|
|
220505
|
+
this.subplot.map.addSource(this.sourceIds[k], sourceOpts);
|
|
220321
220506
|
};
|
|
220322
220507
|
|
|
220323
220508
|
proto.setSourceData = function(k, opts) {
|
|
@@ -220327,56 +220512,79 @@ proto.setSourceData = function(k, opts) {
|
|
|
220327
220512
|
};
|
|
220328
220513
|
|
|
220329
220514
|
proto.addLayer = function(k, opts, below) {
|
|
220330
|
-
|
|
220331
|
-
type:
|
|
220515
|
+
var source = {
|
|
220516
|
+
type: opts.type,
|
|
220332
220517
|
id: this.layerIds[k],
|
|
220333
220518
|
source: this.sourceIds[k],
|
|
220334
220519
|
layout: opts.layout,
|
|
220335
|
-
paint: opts.paint
|
|
220336
|
-
}
|
|
220520
|
+
paint: opts.paint,
|
|
220521
|
+
};
|
|
220522
|
+
if(opts.filter) {
|
|
220523
|
+
source.filter = opts.filter;
|
|
220524
|
+
}
|
|
220525
|
+
this.subplot.addLayer(source, below);
|
|
220337
220526
|
};
|
|
220338
220527
|
|
|
220339
220528
|
proto.update = function update(calcTrace) {
|
|
220529
|
+
var trace = calcTrace[0].trace;
|
|
220340
220530
|
var subplot = this.subplot;
|
|
220341
220531
|
var map = subplot.map;
|
|
220342
220532
|
var optsAll = convert(subplot.gd, calcTrace);
|
|
220343
220533
|
var below = subplot.belowLookup['trace-' + this.uid];
|
|
220344
220534
|
var i, k, opts;
|
|
220535
|
+
var hasCluster = !!(trace.cluster && trace.cluster.enabled);
|
|
220536
|
+
var hadCluster = !!this.clusterEnabled;
|
|
220345
220537
|
|
|
220346
220538
|
if(below !== this.below) {
|
|
220347
|
-
|
|
220348
|
-
|
|
220539
|
+
var order = ORDER.nonCluster;
|
|
220540
|
+
|
|
220541
|
+
for(i = order.length - 1; i >= 0; i--) {
|
|
220542
|
+
k = order[i];
|
|
220349
220543
|
map.removeLayer(this.layerIds[k]);
|
|
220350
220544
|
}
|
|
220351
|
-
for(i = 0; i <
|
|
220352
|
-
k =
|
|
220545
|
+
for(i = 0; i < order.length; i++) {
|
|
220546
|
+
k = order[i];
|
|
220353
220547
|
opts = optsAll[k];
|
|
220354
220548
|
this.addLayer(k, opts, below);
|
|
220355
220549
|
}
|
|
220356
220550
|
this.below = below;
|
|
220357
|
-
}
|
|
220358
|
-
|
|
220359
|
-
|
|
220360
|
-
|
|
220361
|
-
|
|
220362
|
-
|
|
220363
|
-
|
|
220364
|
-
|
|
220365
|
-
|
|
220366
|
-
|
|
220367
|
-
|
|
220551
|
+
} else if(hasCluster && !hadCluster) {
|
|
220552
|
+
for(i = ORDER.nonCluster.length - 1; i >= 0; i--) {
|
|
220553
|
+
k = ORDER.nonCluster[i];
|
|
220554
|
+
map.removeLayer(this.layerIds[k]);
|
|
220555
|
+
map.removeSource(this.sourceIds[k]);
|
|
220556
|
+
}
|
|
220557
|
+
this.addSource('circle', optsAll.circle, trace.cluster);
|
|
220558
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
220559
|
+
k = ORDER.cluster[i];
|
|
220560
|
+
opts = optsAll[k];
|
|
220561
|
+
this.addLayer(k, opts, below);
|
|
220562
|
+
}
|
|
220563
|
+
this.clusterEnabled = hasCluster;
|
|
220564
|
+
} else if(!hasCluster && hadCluster) {
|
|
220565
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
220566
|
+
k = ORDER.cluster[i];
|
|
220567
|
+
map.removeLayer(this.layerIds[k]);
|
|
220368
220568
|
}
|
|
220569
|
+
map.removeSource(this.sourceIds.circle);
|
|
220570
|
+
for(i = 0; i < ORDER.nonCluster.length; i++) {
|
|
220571
|
+
k = ORDER.nonCluster[i];
|
|
220572
|
+
opts = optsAll[k];
|
|
220573
|
+
this.addSource(k, opts, trace.cluster);
|
|
220574
|
+
this.addLayer(k, opts, below);
|
|
220575
|
+
}
|
|
220576
|
+
this.clusterEnabled = hasCluster;
|
|
220369
220577
|
}
|
|
220370
220578
|
|
|
220371
|
-
|
|
220579
|
+
// link ref for quick update during selections
|
|
220372
220580
|
calcTrace[0].trace._glTrace = this;
|
|
220373
220581
|
};
|
|
220374
220582
|
|
|
220375
220583
|
proto.dispose = function dispose() {
|
|
220376
220584
|
var map = this.subplot.map;
|
|
220377
|
-
|
|
220378
|
-
for(var i =
|
|
220379
|
-
var k =
|
|
220585
|
+
var order = this.clusterEnabled ? ORDER.cluster : ORDER.nonCluster;
|
|
220586
|
+
for(var i = order.length - 1; i >= 0; i--) {
|
|
220587
|
+
var k = order[i];
|
|
220380
220588
|
map.removeLayer(this.layerIds[k]);
|
|
220381
220589
|
map.removeSource(this.sourceIds[k]);
|
|
220382
220590
|
}
|
|
@@ -220384,15 +220592,31 @@ proto.dispose = function dispose() {
|
|
|
220384
220592
|
|
|
220385
220593
|
module.exports = function createScatterMapbox(subplot, calcTrace) {
|
|
220386
220594
|
var trace = calcTrace[0].trace;
|
|
220387
|
-
var
|
|
220595
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
220596
|
+
var scatterMapbox = new ScatterMapbox(
|
|
220597
|
+
subplot,
|
|
220598
|
+
trace.uid,
|
|
220599
|
+
hasCluster
|
|
220600
|
+
);
|
|
220601
|
+
|
|
220388
220602
|
var optsAll = convert(subplot.gd, calcTrace);
|
|
220389
220603
|
var below = scatterMapbox.below = subplot.belowLookup['trace-' + trace.uid];
|
|
220604
|
+
var i, k, opts;
|
|
220390
220605
|
|
|
220391
|
-
|
|
220392
|
-
|
|
220393
|
-
|
|
220394
|
-
|
|
220395
|
-
|
|
220606
|
+
if(hasCluster) {
|
|
220607
|
+
scatterMapbox.addSource('circle', optsAll.circle, trace.cluster);
|
|
220608
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
220609
|
+
k = ORDER.cluster[i];
|
|
220610
|
+
opts = optsAll[k];
|
|
220611
|
+
scatterMapbox.addLayer(k, opts, below);
|
|
220612
|
+
}
|
|
220613
|
+
} else {
|
|
220614
|
+
for(i = 0; i < ORDER.nonCluster.length; i++) {
|
|
220615
|
+
k = ORDER.nonCluster[i];
|
|
220616
|
+
opts = optsAll[k];
|
|
220617
|
+
scatterMapbox.addSource(k, opts, trace.cluster);
|
|
220618
|
+
scatterMapbox.addLayer(k, opts, below);
|
|
220619
|
+
}
|
|
220396
220620
|
}
|
|
220397
220621
|
|
|
220398
220622
|
// link ref for quick update during selections
|
|
@@ -220401,7 +220625,7 @@ module.exports = function createScatterMapbox(subplot, calcTrace) {
|
|
|
220401
220625
|
return scatterMapbox;
|
|
220402
220626
|
};
|
|
220403
220627
|
|
|
220404
|
-
},{"../../plots/mapbox/constants":620,"./convert":1003}],1010:[function(_dereq_,module,exports){
|
|
220628
|
+
},{"../../lib":515,"../../plots/mapbox/constants":620,"./convert":1003}],1010:[function(_dereq_,module,exports){
|
|
220405
220629
|
'use strict';
|
|
220406
220630
|
|
|
220407
220631
|
var Lib = _dereq_('../../lib');
|
|
@@ -233687,7 +233911,7 @@ function getSortFunc(opts, d2c) {
|
|
|
233687
233911
|
'use strict';
|
|
233688
233912
|
|
|
233689
233913
|
// package version injected by `npm run preprocess`
|
|
233690
|
-
exports.version = '2.
|
|
233914
|
+
exports.version = '2.16.0';
|
|
233691
233915
|
|
|
233692
233916
|
},{}],1133:[function(_dereq_,module,exports){
|
|
233693
233917
|
(function (global){(function (){
|