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-strict.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* plotly.js (strict) v2.
|
|
2
|
+
* plotly.js (strict) v2.16.0
|
|
3
3
|
* Copyright 2012-2022, Plotly, Inc.
|
|
4
4
|
* All rights reserved.
|
|
5
5
|
* Licensed under the MIT license
|
|
@@ -186380,6 +186380,21 @@ var attrs = module.exports = overrideAll({
|
|
|
186380
186380
|
dflt: 0,
|
|
186381
186381
|
},
|
|
186382
186382
|
|
|
186383
|
+
bounds: {
|
|
186384
|
+
west: {
|
|
186385
|
+
valType: 'number',
|
|
186386
|
+
},
|
|
186387
|
+
east: {
|
|
186388
|
+
valType: 'number',
|
|
186389
|
+
},
|
|
186390
|
+
south: {
|
|
186391
|
+
valType: 'number',
|
|
186392
|
+
},
|
|
186393
|
+
north: {
|
|
186394
|
+
valType: 'number',
|
|
186395
|
+
}
|
|
186396
|
+
},
|
|
186397
|
+
|
|
186383
186398
|
layers: templatedArray('layer', {
|
|
186384
186399
|
visible: {
|
|
186385
186400
|
valType: 'boolean',
|
|
@@ -186525,6 +186540,19 @@ function handleDefaults(containerIn, containerOut, coerce, opts) {
|
|
|
186525
186540
|
coerce('bearing');
|
|
186526
186541
|
coerce('pitch');
|
|
186527
186542
|
|
|
186543
|
+
var west = coerce('bounds.west');
|
|
186544
|
+
var east = coerce('bounds.east');
|
|
186545
|
+
var south = coerce('bounds.south');
|
|
186546
|
+
var north = coerce('bounds.north');
|
|
186547
|
+
if(
|
|
186548
|
+
west === undefined ||
|
|
186549
|
+
east === undefined ||
|
|
186550
|
+
south === undefined ||
|
|
186551
|
+
north === undefined
|
|
186552
|
+
) {
|
|
186553
|
+
delete containerOut.bounds;
|
|
186554
|
+
}
|
|
186555
|
+
|
|
186528
186556
|
handleArrayContainerDefaults(containerIn, containerOut, {
|
|
186529
186557
|
name: 'layers',
|
|
186530
186558
|
handleItemDefaults: handleLayerDefaults
|
|
@@ -186690,6 +186718,9 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
|
|
|
186690
186718
|
// store access token associated with this map
|
|
186691
186719
|
self.accessToken = opts.accesstoken;
|
|
186692
186720
|
|
|
186721
|
+
var bounds = opts.bounds;
|
|
186722
|
+
var maxBounds = bounds ? [[bounds.west, bounds.south], [bounds.east, bounds.north]] : null;
|
|
186723
|
+
|
|
186693
186724
|
// create the map!
|
|
186694
186725
|
var map = self.map = new mapboxgl.Map({
|
|
186695
186726
|
container: self.div,
|
|
@@ -186699,6 +186730,7 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
|
|
|
186699
186730
|
zoom: opts.zoom,
|
|
186700
186731
|
bearing: opts.bearing,
|
|
186701
186732
|
pitch: opts.pitch,
|
|
186733
|
+
maxBounds: maxBounds,
|
|
186702
186734
|
|
|
186703
186735
|
interactive: !self.isStatic,
|
|
186704
186736
|
preserveDrawingBuffer: self.isStatic,
|
|
@@ -237019,6 +237051,7 @@ var colorScaleAttrs = _dereq_('../../components/colorscale/attributes');
|
|
|
237019
237051
|
|
|
237020
237052
|
var extendFlat = _dereq_('../../lib/extend').extendFlat;
|
|
237021
237053
|
var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll;
|
|
237054
|
+
var mapboxLayoutAtributes = _dereq_('../../plots/mapbox/layout_attributes');
|
|
237022
237055
|
|
|
237023
237056
|
var lineAttrs = scatterGeoAttrs.line;
|
|
237024
237057
|
var markerAttrs = scatterGeoAttrs.marker;
|
|
@@ -237027,6 +237060,33 @@ module.exports = overrideAll({
|
|
|
237027
237060
|
lon: scatterGeoAttrs.lon,
|
|
237028
237061
|
lat: scatterGeoAttrs.lat,
|
|
237029
237062
|
|
|
237063
|
+
cluster: {
|
|
237064
|
+
enabled: {
|
|
237065
|
+
valType: 'boolean',
|
|
237066
|
+
},
|
|
237067
|
+
maxzoom: extendFlat({}, mapboxLayoutAtributes.layers.maxzoom, {
|
|
237068
|
+
}),
|
|
237069
|
+
step: {
|
|
237070
|
+
valType: 'number',
|
|
237071
|
+
arrayOk: true,
|
|
237072
|
+
dflt: -1,
|
|
237073
|
+
min: -1,
|
|
237074
|
+
},
|
|
237075
|
+
size: {
|
|
237076
|
+
valType: 'number',
|
|
237077
|
+
arrayOk: true,
|
|
237078
|
+
dflt: 20,
|
|
237079
|
+
min: 0,
|
|
237080
|
+
},
|
|
237081
|
+
color: {
|
|
237082
|
+
valType: 'color',
|
|
237083
|
+
arrayOk: true,
|
|
237084
|
+
},
|
|
237085
|
+
opacity: extendFlat({}, markerAttrs.opacity, {
|
|
237086
|
+
dflt: 1
|
|
237087
|
+
})
|
|
237088
|
+
},
|
|
237089
|
+
|
|
237030
237090
|
// locations
|
|
237031
237091
|
// locationmode
|
|
237032
237092
|
|
|
@@ -237129,11 +237189,12 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
237129
237189
|
var hasText = subTypes.hasText(trace);
|
|
237130
237190
|
var hasCircles = (hasMarkers && trace.marker.symbol === 'circle');
|
|
237131
237191
|
var hasSymbols = (hasMarkers && trace.marker.symbol !== 'circle');
|
|
237192
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
237132
237193
|
|
|
237133
|
-
var fill = initContainer();
|
|
237134
|
-
var line = initContainer();
|
|
237135
|
-
var circle = initContainer();
|
|
237136
|
-
var symbol = initContainer();
|
|
237194
|
+
var fill = initContainer('fill');
|
|
237195
|
+
var line = initContainer('line');
|
|
237196
|
+
var circle = initContainer('circle');
|
|
237197
|
+
var symbol = initContainer('symbol');
|
|
237137
237198
|
|
|
237138
237199
|
var opts = {
|
|
237139
237200
|
fill: fill,
|
|
@@ -237177,6 +237238,29 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
237177
237238
|
var circleOpts = makeCircleOpts(calcTrace);
|
|
237178
237239
|
circle.geojson = circleOpts.geojson;
|
|
237179
237240
|
circle.layout.visibility = 'visible';
|
|
237241
|
+
if(hasCluster) {
|
|
237242
|
+
circle.filter = ['!', ['has', 'point_count']];
|
|
237243
|
+
opts.cluster = {
|
|
237244
|
+
type: 'circle',
|
|
237245
|
+
filter: ['has', 'point_count'],
|
|
237246
|
+
layout: {visibility: 'visible'},
|
|
237247
|
+
paint: {
|
|
237248
|
+
'circle-color': arrayifyAttribute(trace.cluster.color, trace.cluster.step),
|
|
237249
|
+
'circle-radius': arrayifyAttribute(trace.cluster.size, trace.cluster.step),
|
|
237250
|
+
'circle-opacity': arrayifyAttribute(trace.cluster.opacity, trace.cluster.step),
|
|
237251
|
+
},
|
|
237252
|
+
};
|
|
237253
|
+
opts.clusterCount = {
|
|
237254
|
+
type: 'symbol',
|
|
237255
|
+
filter: ['has', 'point_count'],
|
|
237256
|
+
paint: {},
|
|
237257
|
+
layout: {
|
|
237258
|
+
'text-field': '{point_count_abbreviated}',
|
|
237259
|
+
'text-font': ['Open Sans Regular', 'Arial Unicode MS Regular'],
|
|
237260
|
+
'text-size': 12
|
|
237261
|
+
}
|
|
237262
|
+
};
|
|
237263
|
+
}
|
|
237180
237264
|
|
|
237181
237265
|
Lib.extendFlat(circle.paint, {
|
|
237182
237266
|
'circle-color': circleOpts.mcc,
|
|
@@ -237185,6 +237269,10 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
237185
237269
|
});
|
|
237186
237270
|
}
|
|
237187
237271
|
|
|
237272
|
+
if(hasCircles && hasCluster) {
|
|
237273
|
+
circle.filter = ['!', ['has', 'point_count']];
|
|
237274
|
+
}
|
|
237275
|
+
|
|
237188
237276
|
if(hasSymbols || hasText) {
|
|
237189
237277
|
symbol.geojson = makeSymbolGeoJSON(calcTrace, gd);
|
|
237190
237278
|
|
|
@@ -237245,10 +237333,12 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
237245
237333
|
return opts;
|
|
237246
237334
|
};
|
|
237247
237335
|
|
|
237248
|
-
function initContainer() {
|
|
237336
|
+
function initContainer(type) {
|
|
237249
237337
|
return {
|
|
237338
|
+
type: type,
|
|
237250
237339
|
geojson: geoJsonUtils.makeBlank(),
|
|
237251
237340
|
layout: { visibility: 'none' },
|
|
237341
|
+
filter: null,
|
|
237252
237342
|
paint: {}
|
|
237253
237343
|
};
|
|
237254
237344
|
}
|
|
@@ -237303,7 +237393,8 @@ function makeCircleOpts(calcTrace) {
|
|
|
237303
237393
|
|
|
237304
237394
|
features.push({
|
|
237305
237395
|
type: 'Feature',
|
|
237306
|
-
|
|
237396
|
+
id: i + 1,
|
|
237397
|
+
geometry: { type: 'Point', coordinates: lonlat },
|
|
237307
237398
|
properties: props
|
|
237308
237399
|
});
|
|
237309
237400
|
}
|
|
@@ -237427,6 +237518,20 @@ function isBADNUM(lonlat) {
|
|
|
237427
237518
|
return lonlat[0] === BADNUM;
|
|
237428
237519
|
}
|
|
237429
237520
|
|
|
237521
|
+
function arrayifyAttribute(values, step) {
|
|
237522
|
+
var newAttribute;
|
|
237523
|
+
if(Lib.isArrayOrTypedArray(values) && Lib.isArrayOrTypedArray(step)) {
|
|
237524
|
+
newAttribute = ['step', ['get', 'point_count'], values[0]];
|
|
237525
|
+
|
|
237526
|
+
for(var idx = 1; idx < values.length; idx++) {
|
|
237527
|
+
newAttribute.push(step[idx - 1], values[idx]);
|
|
237528
|
+
}
|
|
237529
|
+
} else {
|
|
237530
|
+
newAttribute = values;
|
|
237531
|
+
}
|
|
237532
|
+
return newAttribute;
|
|
237533
|
+
}
|
|
237534
|
+
|
|
237430
237535
|
},{"../../components/colorscale":375,"../../components/drawing":385,"../../components/fx/helpers":399,"../../constants/numerical":487,"../../lib":525,"../../lib/geojson_utils":519,"../../lib/svg_text_utils":551,"../../plots/mapbox/convert_text_opts":631,"../scatter/make_bubble_size_func":965,"../scatter/subtypes":973,"fast-isnumeric":186}],1018:[function(_dereq_,module,exports){
|
|
237431
237536
|
'use strict';
|
|
237432
237537
|
|
|
@@ -237444,6 +237549,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
237444
237549
|
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
|
|
237445
237550
|
}
|
|
237446
237551
|
|
|
237552
|
+
function coerce2(attr, dflt) {
|
|
237553
|
+
return Lib.coerce2(traceIn, traceOut, attributes, attr, dflt);
|
|
237554
|
+
}
|
|
237555
|
+
|
|
237447
237556
|
var len = handleLonLatDefaults(traceIn, traceOut, coerce);
|
|
237448
237557
|
if(!len) {
|
|
237449
237558
|
traceOut.visible = false;
|
|
@@ -237476,6 +237585,21 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
237476
237585
|
}
|
|
237477
237586
|
}
|
|
237478
237587
|
|
|
237588
|
+
var clusterMaxzoom = coerce2('cluster.maxzoom');
|
|
237589
|
+
var clusterStep = coerce2('cluster.step');
|
|
237590
|
+
var clusterColor = coerce2('cluster.color', (traceOut.marker && traceOut.marker.color) || defaultColor);
|
|
237591
|
+
var clusterSize = coerce2('cluster.size');
|
|
237592
|
+
var clusterOpacity = coerce2('cluster.opacity');
|
|
237593
|
+
|
|
237594
|
+
var clusterEnabledDflt =
|
|
237595
|
+
clusterMaxzoom !== false ||
|
|
237596
|
+
clusterStep !== false ||
|
|
237597
|
+
clusterColor !== false ||
|
|
237598
|
+
clusterSize !== false ||
|
|
237599
|
+
clusterOpacity !== false;
|
|
237600
|
+
|
|
237601
|
+
coerce('cluster.enabled', clusterEnabledDflt);
|
|
237602
|
+
|
|
237479
237603
|
if(subTypes.hasText(traceOut)) {
|
|
237480
237604
|
handleTextDefaults(traceIn, traceOut, layout, coerce, {noSelect: true});
|
|
237481
237605
|
}
|
|
@@ -237534,6 +237658,7 @@ var Lib = _dereq_('../../lib');
|
|
|
237534
237658
|
var getTraceColor = _dereq_('../scatter/get_trace_color');
|
|
237535
237659
|
var fillText = Lib.fillText;
|
|
237536
237660
|
var BADNUM = _dereq_('../../constants/numerical').BADNUM;
|
|
237661
|
+
var LAYER_PREFIX = _dereq_('../../plots/mapbox/constants').traceLayerPrefix;
|
|
237537
237662
|
|
|
237538
237663
|
function hoverPoints(pointData, xval, yval) {
|
|
237539
237664
|
var cd = pointData.cd;
|
|
@@ -237541,6 +237666,14 @@ function hoverPoints(pointData, xval, yval) {
|
|
|
237541
237666
|
var xa = pointData.xa;
|
|
237542
237667
|
var ya = pointData.ya;
|
|
237543
237668
|
var subplot = pointData.subplot;
|
|
237669
|
+
var clusteredPointsIds = [];
|
|
237670
|
+
var layer = LAYER_PREFIX + trace.uid + '-circle';
|
|
237671
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
237672
|
+
|
|
237673
|
+
if(hasCluster) {
|
|
237674
|
+
var elems = subplot.map.queryRenderedFeatures(null, {layers: [layer]});
|
|
237675
|
+
clusteredPointsIds = elems.map(function(elem) {return elem.id;});
|
|
237676
|
+
}
|
|
237544
237677
|
|
|
237545
237678
|
// compute winding number about [-180, 180] globe
|
|
237546
237679
|
var winding = (xval >= 0) ?
|
|
@@ -237554,6 +237687,7 @@ function hoverPoints(pointData, xval, yval) {
|
|
|
237554
237687
|
function distFn(d) {
|
|
237555
237688
|
var lonlat = d.lonlat;
|
|
237556
237689
|
if(lonlat[0] === BADNUM) return Infinity;
|
|
237690
|
+
if(hasCluster && clusteredPointsIds.indexOf(d.i + 1) === -1) return Infinity;
|
|
237557
237691
|
|
|
237558
237692
|
var lon = Lib.modHalf(lonlat[0], 360);
|
|
237559
237693
|
var lat = lonlat[1];
|
|
@@ -237634,7 +237768,7 @@ module.exports = {
|
|
|
237634
237768
|
getExtraText: getExtraText
|
|
237635
237769
|
};
|
|
237636
237770
|
|
|
237637
|
-
},{"../../components/fx":403,"../../constants/numerical":487,"../../lib":525,"../scatter/get_trace_color":958}],1022:[function(_dereq_,module,exports){
|
|
237771
|
+
},{"../../components/fx":403,"../../constants/numerical":487,"../../lib":525,"../../plots/mapbox/constants":630,"../scatter/get_trace_color":958}],1022:[function(_dereq_,module,exports){
|
|
237638
237772
|
'use strict';
|
|
237639
237773
|
|
|
237640
237774
|
module.exports = {
|
|
@@ -237666,27 +237800,36 @@ module.exports = {
|
|
|
237666
237800
|
},{"../../plots/mapbox":632,"../scatter/marker_colorbar":966,"../scattergeo/calc":991,"./attributes":1016,"./defaults":1018,"./event_data":1019,"./format_labels":1020,"./hover":1021,"./plot":1023,"./select":1024}],1023:[function(_dereq_,module,exports){
|
|
237667
237801
|
'use strict';
|
|
237668
237802
|
|
|
237803
|
+
var Lib = _dereq_('../../lib');
|
|
237669
237804
|
var convert = _dereq_('./convert');
|
|
237670
237805
|
var LAYER_PREFIX = _dereq_('../../plots/mapbox/constants').traceLayerPrefix;
|
|
237671
|
-
var ORDER =
|
|
237806
|
+
var ORDER = {
|
|
237807
|
+
cluster: ['cluster', 'clusterCount', 'circle'],
|
|
237808
|
+
nonCluster: ['fill', 'line', 'circle', 'symbol'],
|
|
237809
|
+
};
|
|
237672
237810
|
|
|
237673
|
-
function ScatterMapbox(subplot, uid) {
|
|
237811
|
+
function ScatterMapbox(subplot, uid, clusterEnabled) {
|
|
237674
237812
|
this.type = 'scattermapbox';
|
|
237675
237813
|
this.subplot = subplot;
|
|
237676
237814
|
this.uid = uid;
|
|
237815
|
+
this.clusterEnabled = clusterEnabled;
|
|
237677
237816
|
|
|
237678
237817
|
this.sourceIds = {
|
|
237679
237818
|
fill: 'source-' + uid + '-fill',
|
|
237680
237819
|
line: 'source-' + uid + '-line',
|
|
237681
237820
|
circle: 'source-' + uid + '-circle',
|
|
237682
|
-
symbol: 'source-' + uid + '-symbol'
|
|
237821
|
+
symbol: 'source-' + uid + '-symbol',
|
|
237822
|
+
cluster: 'source-' + uid + '-circle',
|
|
237823
|
+
clusterCount: 'source-' + uid + '-circle',
|
|
237683
237824
|
};
|
|
237684
237825
|
|
|
237685
237826
|
this.layerIds = {
|
|
237686
237827
|
fill: LAYER_PREFIX + uid + '-fill',
|
|
237687
237828
|
line: LAYER_PREFIX + uid + '-line',
|
|
237688
237829
|
circle: LAYER_PREFIX + uid + '-circle',
|
|
237689
|
-
symbol: LAYER_PREFIX + uid + '-symbol'
|
|
237830
|
+
symbol: LAYER_PREFIX + uid + '-symbol',
|
|
237831
|
+
cluster: LAYER_PREFIX + uid + '-cluster',
|
|
237832
|
+
clusterCount: LAYER_PREFIX + uid + '-cluster-count',
|
|
237690
237833
|
};
|
|
237691
237834
|
|
|
237692
237835
|
// We could merge the 'fill' source with the 'line' source and
|
|
@@ -237700,11 +237843,20 @@ function ScatterMapbox(subplot, uid) {
|
|
|
237700
237843
|
|
|
237701
237844
|
var proto = ScatterMapbox.prototype;
|
|
237702
237845
|
|
|
237703
|
-
proto.addSource = function(k, opts) {
|
|
237704
|
-
|
|
237846
|
+
proto.addSource = function(k, opts, cluster) {
|
|
237847
|
+
var sourceOpts = {
|
|
237705
237848
|
type: 'geojson',
|
|
237706
|
-
data: opts.geojson
|
|
237707
|
-
}
|
|
237849
|
+
data: opts.geojson,
|
|
237850
|
+
};
|
|
237851
|
+
|
|
237852
|
+
if(cluster && cluster.enabled) {
|
|
237853
|
+
Lib.extendFlat(sourceOpts, {
|
|
237854
|
+
cluster: true,
|
|
237855
|
+
clusterMaxZoom: cluster.maxzoom,
|
|
237856
|
+
});
|
|
237857
|
+
}
|
|
237858
|
+
|
|
237859
|
+
this.subplot.map.addSource(this.sourceIds[k], sourceOpts);
|
|
237708
237860
|
};
|
|
237709
237861
|
|
|
237710
237862
|
proto.setSourceData = function(k, opts) {
|
|
@@ -237714,56 +237866,79 @@ proto.setSourceData = function(k, opts) {
|
|
|
237714
237866
|
};
|
|
237715
237867
|
|
|
237716
237868
|
proto.addLayer = function(k, opts, below) {
|
|
237717
|
-
|
|
237718
|
-
type:
|
|
237869
|
+
var source = {
|
|
237870
|
+
type: opts.type,
|
|
237719
237871
|
id: this.layerIds[k],
|
|
237720
237872
|
source: this.sourceIds[k],
|
|
237721
237873
|
layout: opts.layout,
|
|
237722
|
-
paint: opts.paint
|
|
237723
|
-
}
|
|
237874
|
+
paint: opts.paint,
|
|
237875
|
+
};
|
|
237876
|
+
if(opts.filter) {
|
|
237877
|
+
source.filter = opts.filter;
|
|
237878
|
+
}
|
|
237879
|
+
this.subplot.addLayer(source, below);
|
|
237724
237880
|
};
|
|
237725
237881
|
|
|
237726
237882
|
proto.update = function update(calcTrace) {
|
|
237883
|
+
var trace = calcTrace[0].trace;
|
|
237727
237884
|
var subplot = this.subplot;
|
|
237728
237885
|
var map = subplot.map;
|
|
237729
237886
|
var optsAll = convert(subplot.gd, calcTrace);
|
|
237730
237887
|
var below = subplot.belowLookup['trace-' + this.uid];
|
|
237731
237888
|
var i, k, opts;
|
|
237889
|
+
var hasCluster = !!(trace.cluster && trace.cluster.enabled);
|
|
237890
|
+
var hadCluster = !!this.clusterEnabled;
|
|
237732
237891
|
|
|
237733
237892
|
if(below !== this.below) {
|
|
237734
|
-
|
|
237735
|
-
|
|
237893
|
+
var order = ORDER.nonCluster;
|
|
237894
|
+
|
|
237895
|
+
for(i = order.length - 1; i >= 0; i--) {
|
|
237896
|
+
k = order[i];
|
|
237736
237897
|
map.removeLayer(this.layerIds[k]);
|
|
237737
237898
|
}
|
|
237738
|
-
for(i = 0; i <
|
|
237739
|
-
k =
|
|
237899
|
+
for(i = 0; i < order.length; i++) {
|
|
237900
|
+
k = order[i];
|
|
237740
237901
|
opts = optsAll[k];
|
|
237741
237902
|
this.addLayer(k, opts, below);
|
|
237742
237903
|
}
|
|
237743
237904
|
this.below = below;
|
|
237744
|
-
}
|
|
237745
|
-
|
|
237746
|
-
|
|
237747
|
-
|
|
237748
|
-
|
|
237749
|
-
|
|
237750
|
-
|
|
237751
|
-
|
|
237752
|
-
|
|
237753
|
-
|
|
237754
|
-
|
|
237905
|
+
} else if(hasCluster && !hadCluster) {
|
|
237906
|
+
for(i = ORDER.nonCluster.length - 1; i >= 0; i--) {
|
|
237907
|
+
k = ORDER.nonCluster[i];
|
|
237908
|
+
map.removeLayer(this.layerIds[k]);
|
|
237909
|
+
map.removeSource(this.sourceIds[k]);
|
|
237910
|
+
}
|
|
237911
|
+
this.addSource('circle', optsAll.circle, trace.cluster);
|
|
237912
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
237913
|
+
k = ORDER.cluster[i];
|
|
237914
|
+
opts = optsAll[k];
|
|
237915
|
+
this.addLayer(k, opts, below);
|
|
237916
|
+
}
|
|
237917
|
+
this.clusterEnabled = hasCluster;
|
|
237918
|
+
} else if(!hasCluster && hadCluster) {
|
|
237919
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
237920
|
+
k = ORDER.cluster[i];
|
|
237921
|
+
map.removeLayer(this.layerIds[k]);
|
|
237922
|
+
}
|
|
237923
|
+
map.removeSource(this.sourceIds.circle);
|
|
237924
|
+
for(i = 0; i < ORDER.nonCluster.length; i++) {
|
|
237925
|
+
k = ORDER.nonCluster[i];
|
|
237926
|
+
opts = optsAll[k];
|
|
237927
|
+
this.addSource(k, opts, trace.cluster);
|
|
237928
|
+
this.addLayer(k, opts, below);
|
|
237755
237929
|
}
|
|
237930
|
+
this.clusterEnabled = hasCluster;
|
|
237756
237931
|
}
|
|
237757
237932
|
|
|
237758
|
-
|
|
237933
|
+
// link ref for quick update during selections
|
|
237759
237934
|
calcTrace[0].trace._glTrace = this;
|
|
237760
237935
|
};
|
|
237761
237936
|
|
|
237762
237937
|
proto.dispose = function dispose() {
|
|
237763
237938
|
var map = this.subplot.map;
|
|
237764
|
-
|
|
237765
|
-
for(var i =
|
|
237766
|
-
var k =
|
|
237939
|
+
var order = this.clusterEnabled ? ORDER.cluster : ORDER.nonCluster;
|
|
237940
|
+
for(var i = order.length - 1; i >= 0; i--) {
|
|
237941
|
+
var k = order[i];
|
|
237767
237942
|
map.removeLayer(this.layerIds[k]);
|
|
237768
237943
|
map.removeSource(this.sourceIds[k]);
|
|
237769
237944
|
}
|
|
@@ -237771,15 +237946,31 @@ proto.dispose = function dispose() {
|
|
|
237771
237946
|
|
|
237772
237947
|
module.exports = function createScatterMapbox(subplot, calcTrace) {
|
|
237773
237948
|
var trace = calcTrace[0].trace;
|
|
237774
|
-
var
|
|
237949
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
237950
|
+
var scatterMapbox = new ScatterMapbox(
|
|
237951
|
+
subplot,
|
|
237952
|
+
trace.uid,
|
|
237953
|
+
hasCluster
|
|
237954
|
+
);
|
|
237955
|
+
|
|
237775
237956
|
var optsAll = convert(subplot.gd, calcTrace);
|
|
237776
237957
|
var below = scatterMapbox.below = subplot.belowLookup['trace-' + trace.uid];
|
|
237958
|
+
var i, k, opts;
|
|
237777
237959
|
|
|
237778
|
-
|
|
237779
|
-
|
|
237780
|
-
|
|
237781
|
-
|
|
237782
|
-
|
|
237960
|
+
if(hasCluster) {
|
|
237961
|
+
scatterMapbox.addSource('circle', optsAll.circle, trace.cluster);
|
|
237962
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
237963
|
+
k = ORDER.cluster[i];
|
|
237964
|
+
opts = optsAll[k];
|
|
237965
|
+
scatterMapbox.addLayer(k, opts, below);
|
|
237966
|
+
}
|
|
237967
|
+
} else {
|
|
237968
|
+
for(i = 0; i < ORDER.nonCluster.length; i++) {
|
|
237969
|
+
k = ORDER.nonCluster[i];
|
|
237970
|
+
opts = optsAll[k];
|
|
237971
|
+
scatterMapbox.addSource(k, opts, trace.cluster);
|
|
237972
|
+
scatterMapbox.addLayer(k, opts, below);
|
|
237973
|
+
}
|
|
237783
237974
|
}
|
|
237784
237975
|
|
|
237785
237976
|
// link ref for quick update during selections
|
|
@@ -237788,7 +237979,7 @@ module.exports = function createScatterMapbox(subplot, calcTrace) {
|
|
|
237788
237979
|
return scatterMapbox;
|
|
237789
237980
|
};
|
|
237790
237981
|
|
|
237791
|
-
},{"../../plots/mapbox/constants":630,"./convert":1017}],1024:[function(_dereq_,module,exports){
|
|
237982
|
+
},{"../../lib":525,"../../plots/mapbox/constants":630,"./convert":1017}],1024:[function(_dereq_,module,exports){
|
|
237792
237983
|
'use strict';
|
|
237793
237984
|
|
|
237794
237985
|
var Lib = _dereq_('../../lib');
|
|
@@ -250206,7 +250397,7 @@ function getSortFunc(opts, d2c) {
|
|
|
250206
250397
|
'use strict';
|
|
250207
250398
|
|
|
250208
250399
|
// package version injected by `npm run preprocess`
|
|
250209
|
-
exports.version = '2.
|
|
250400
|
+
exports.version = '2.16.0';
|
|
250210
250401
|
|
|
250211
250402
|
},{}],1151:[function(_dereq_,module,exports){
|
|
250212
250403
|
(function (global){(function (){
|