plotly.js 2.15.1 → 2.16.1
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 +14 -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 +240 -46
- package/dist/plotly-mapbox.min.js +3 -3
- package/dist/plotly-strict.js +240 -46
- package/dist/plotly-strict.min.js +11 -11
- package/dist/plotly-with-meta.js +273 -46
- package/dist/plotly.js +240 -46
- package/dist/plotly.min.js +2 -2
- package/package.json +4 -4
- 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/choroplethmapbox/plot.js +3 -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 +93 -36
- 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.1
|
|
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,
|
|
@@ -205943,6 +205975,9 @@ var proto = ChoroplethMapbox.prototype;
|
|
|
205943
205975
|
|
|
205944
205976
|
proto.update = function(calcTrace) {
|
|
205945
205977
|
this._update(convert(calcTrace));
|
|
205978
|
+
|
|
205979
|
+
// link ref for quick update during selections
|
|
205980
|
+
calcTrace[0].trace._glTrace = this;
|
|
205946
205981
|
};
|
|
205947
205982
|
|
|
205948
205983
|
proto.updateOnSelect = function(calcTrace) {
|
|
@@ -237019,6 +237054,7 @@ var colorScaleAttrs = _dereq_('../../components/colorscale/attributes');
|
|
|
237019
237054
|
|
|
237020
237055
|
var extendFlat = _dereq_('../../lib/extend').extendFlat;
|
|
237021
237056
|
var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll;
|
|
237057
|
+
var mapboxLayoutAtributes = _dereq_('../../plots/mapbox/layout_attributes');
|
|
237022
237058
|
|
|
237023
237059
|
var lineAttrs = scatterGeoAttrs.line;
|
|
237024
237060
|
var markerAttrs = scatterGeoAttrs.marker;
|
|
@@ -237027,6 +237063,33 @@ module.exports = overrideAll({
|
|
|
237027
237063
|
lon: scatterGeoAttrs.lon,
|
|
237028
237064
|
lat: scatterGeoAttrs.lat,
|
|
237029
237065
|
|
|
237066
|
+
cluster: {
|
|
237067
|
+
enabled: {
|
|
237068
|
+
valType: 'boolean',
|
|
237069
|
+
},
|
|
237070
|
+
maxzoom: extendFlat({}, mapboxLayoutAtributes.layers.maxzoom, {
|
|
237071
|
+
}),
|
|
237072
|
+
step: {
|
|
237073
|
+
valType: 'number',
|
|
237074
|
+
arrayOk: true,
|
|
237075
|
+
dflt: -1,
|
|
237076
|
+
min: -1,
|
|
237077
|
+
},
|
|
237078
|
+
size: {
|
|
237079
|
+
valType: 'number',
|
|
237080
|
+
arrayOk: true,
|
|
237081
|
+
dflt: 20,
|
|
237082
|
+
min: 0,
|
|
237083
|
+
},
|
|
237084
|
+
color: {
|
|
237085
|
+
valType: 'color',
|
|
237086
|
+
arrayOk: true,
|
|
237087
|
+
},
|
|
237088
|
+
opacity: extendFlat({}, markerAttrs.opacity, {
|
|
237089
|
+
dflt: 1
|
|
237090
|
+
})
|
|
237091
|
+
},
|
|
237092
|
+
|
|
237030
237093
|
// locations
|
|
237031
237094
|
// locationmode
|
|
237032
237095
|
|
|
@@ -237129,11 +237192,12 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
237129
237192
|
var hasText = subTypes.hasText(trace);
|
|
237130
237193
|
var hasCircles = (hasMarkers && trace.marker.symbol === 'circle');
|
|
237131
237194
|
var hasSymbols = (hasMarkers && trace.marker.symbol !== 'circle');
|
|
237195
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
237132
237196
|
|
|
237133
|
-
var fill = initContainer();
|
|
237134
|
-
var line = initContainer();
|
|
237135
|
-
var circle = initContainer();
|
|
237136
|
-
var symbol = initContainer();
|
|
237197
|
+
var fill = initContainer('fill');
|
|
237198
|
+
var line = initContainer('line');
|
|
237199
|
+
var circle = initContainer('circle');
|
|
237200
|
+
var symbol = initContainer('symbol');
|
|
237137
237201
|
|
|
237138
237202
|
var opts = {
|
|
237139
237203
|
fill: fill,
|
|
@@ -237177,6 +237241,29 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
237177
237241
|
var circleOpts = makeCircleOpts(calcTrace);
|
|
237178
237242
|
circle.geojson = circleOpts.geojson;
|
|
237179
237243
|
circle.layout.visibility = 'visible';
|
|
237244
|
+
if(hasCluster) {
|
|
237245
|
+
circle.filter = ['!', ['has', 'point_count']];
|
|
237246
|
+
opts.cluster = {
|
|
237247
|
+
type: 'circle',
|
|
237248
|
+
filter: ['has', 'point_count'],
|
|
237249
|
+
layout: {visibility: 'visible'},
|
|
237250
|
+
paint: {
|
|
237251
|
+
'circle-color': arrayifyAttribute(trace.cluster.color, trace.cluster.step),
|
|
237252
|
+
'circle-radius': arrayifyAttribute(trace.cluster.size, trace.cluster.step),
|
|
237253
|
+
'circle-opacity': arrayifyAttribute(trace.cluster.opacity, trace.cluster.step),
|
|
237254
|
+
},
|
|
237255
|
+
};
|
|
237256
|
+
opts.clusterCount = {
|
|
237257
|
+
type: 'symbol',
|
|
237258
|
+
filter: ['has', 'point_count'],
|
|
237259
|
+
paint: {},
|
|
237260
|
+
layout: {
|
|
237261
|
+
'text-field': '{point_count_abbreviated}',
|
|
237262
|
+
'text-font': ['Open Sans Regular', 'Arial Unicode MS Regular'],
|
|
237263
|
+
'text-size': 12
|
|
237264
|
+
}
|
|
237265
|
+
};
|
|
237266
|
+
}
|
|
237180
237267
|
|
|
237181
237268
|
Lib.extendFlat(circle.paint, {
|
|
237182
237269
|
'circle-color': circleOpts.mcc,
|
|
@@ -237185,6 +237272,10 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
237185
237272
|
});
|
|
237186
237273
|
}
|
|
237187
237274
|
|
|
237275
|
+
if(hasCircles && hasCluster) {
|
|
237276
|
+
circle.filter = ['!', ['has', 'point_count']];
|
|
237277
|
+
}
|
|
237278
|
+
|
|
237188
237279
|
if(hasSymbols || hasText) {
|
|
237189
237280
|
symbol.geojson = makeSymbolGeoJSON(calcTrace, gd);
|
|
237190
237281
|
|
|
@@ -237245,10 +237336,12 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
237245
237336
|
return opts;
|
|
237246
237337
|
};
|
|
237247
237338
|
|
|
237248
|
-
function initContainer() {
|
|
237339
|
+
function initContainer(type) {
|
|
237249
237340
|
return {
|
|
237341
|
+
type: type,
|
|
237250
237342
|
geojson: geoJsonUtils.makeBlank(),
|
|
237251
237343
|
layout: { visibility: 'none' },
|
|
237344
|
+
filter: null,
|
|
237252
237345
|
paint: {}
|
|
237253
237346
|
};
|
|
237254
237347
|
}
|
|
@@ -237303,7 +237396,8 @@ function makeCircleOpts(calcTrace) {
|
|
|
237303
237396
|
|
|
237304
237397
|
features.push({
|
|
237305
237398
|
type: 'Feature',
|
|
237306
|
-
|
|
237399
|
+
id: i + 1,
|
|
237400
|
+
geometry: { type: 'Point', coordinates: lonlat },
|
|
237307
237401
|
properties: props
|
|
237308
237402
|
});
|
|
237309
237403
|
}
|
|
@@ -237427,6 +237521,20 @@ function isBADNUM(lonlat) {
|
|
|
237427
237521
|
return lonlat[0] === BADNUM;
|
|
237428
237522
|
}
|
|
237429
237523
|
|
|
237524
|
+
function arrayifyAttribute(values, step) {
|
|
237525
|
+
var newAttribute;
|
|
237526
|
+
if(Lib.isArrayOrTypedArray(values) && Lib.isArrayOrTypedArray(step)) {
|
|
237527
|
+
newAttribute = ['step', ['get', 'point_count'], values[0]];
|
|
237528
|
+
|
|
237529
|
+
for(var idx = 1; idx < values.length; idx++) {
|
|
237530
|
+
newAttribute.push(step[idx - 1], values[idx]);
|
|
237531
|
+
}
|
|
237532
|
+
} else {
|
|
237533
|
+
newAttribute = values;
|
|
237534
|
+
}
|
|
237535
|
+
return newAttribute;
|
|
237536
|
+
}
|
|
237537
|
+
|
|
237430
237538
|
},{"../../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
237539
|
'use strict';
|
|
237432
237540
|
|
|
@@ -237444,6 +237552,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
237444
237552
|
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
|
|
237445
237553
|
}
|
|
237446
237554
|
|
|
237555
|
+
function coerce2(attr, dflt) {
|
|
237556
|
+
return Lib.coerce2(traceIn, traceOut, attributes, attr, dflt);
|
|
237557
|
+
}
|
|
237558
|
+
|
|
237447
237559
|
var len = handleLonLatDefaults(traceIn, traceOut, coerce);
|
|
237448
237560
|
if(!len) {
|
|
237449
237561
|
traceOut.visible = false;
|
|
@@ -237476,6 +237588,21 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
237476
237588
|
}
|
|
237477
237589
|
}
|
|
237478
237590
|
|
|
237591
|
+
var clusterMaxzoom = coerce2('cluster.maxzoom');
|
|
237592
|
+
var clusterStep = coerce2('cluster.step');
|
|
237593
|
+
var clusterColor = coerce2('cluster.color', (traceOut.marker && traceOut.marker.color) || defaultColor);
|
|
237594
|
+
var clusterSize = coerce2('cluster.size');
|
|
237595
|
+
var clusterOpacity = coerce2('cluster.opacity');
|
|
237596
|
+
|
|
237597
|
+
var clusterEnabledDflt =
|
|
237598
|
+
clusterMaxzoom !== false ||
|
|
237599
|
+
clusterStep !== false ||
|
|
237600
|
+
clusterColor !== false ||
|
|
237601
|
+
clusterSize !== false ||
|
|
237602
|
+
clusterOpacity !== false;
|
|
237603
|
+
|
|
237604
|
+
coerce('cluster.enabled', clusterEnabledDflt);
|
|
237605
|
+
|
|
237479
237606
|
if(subTypes.hasText(traceOut)) {
|
|
237480
237607
|
handleTextDefaults(traceIn, traceOut, layout, coerce, {noSelect: true});
|
|
237481
237608
|
}
|
|
@@ -237534,6 +237661,7 @@ var Lib = _dereq_('../../lib');
|
|
|
237534
237661
|
var getTraceColor = _dereq_('../scatter/get_trace_color');
|
|
237535
237662
|
var fillText = Lib.fillText;
|
|
237536
237663
|
var BADNUM = _dereq_('../../constants/numerical').BADNUM;
|
|
237664
|
+
var LAYER_PREFIX = _dereq_('../../plots/mapbox/constants').traceLayerPrefix;
|
|
237537
237665
|
|
|
237538
237666
|
function hoverPoints(pointData, xval, yval) {
|
|
237539
237667
|
var cd = pointData.cd;
|
|
@@ -237541,6 +237669,14 @@ function hoverPoints(pointData, xval, yval) {
|
|
|
237541
237669
|
var xa = pointData.xa;
|
|
237542
237670
|
var ya = pointData.ya;
|
|
237543
237671
|
var subplot = pointData.subplot;
|
|
237672
|
+
var clusteredPointsIds = [];
|
|
237673
|
+
var layer = LAYER_PREFIX + trace.uid + '-circle';
|
|
237674
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
237675
|
+
|
|
237676
|
+
if(hasCluster) {
|
|
237677
|
+
var elems = subplot.map.queryRenderedFeatures(null, {layers: [layer]});
|
|
237678
|
+
clusteredPointsIds = elems.map(function(elem) {return elem.id;});
|
|
237679
|
+
}
|
|
237544
237680
|
|
|
237545
237681
|
// compute winding number about [-180, 180] globe
|
|
237546
237682
|
var winding = (xval >= 0) ?
|
|
@@ -237554,6 +237690,7 @@ function hoverPoints(pointData, xval, yval) {
|
|
|
237554
237690
|
function distFn(d) {
|
|
237555
237691
|
var lonlat = d.lonlat;
|
|
237556
237692
|
if(lonlat[0] === BADNUM) return Infinity;
|
|
237693
|
+
if(hasCluster && clusteredPointsIds.indexOf(d.i + 1) === -1) return Infinity;
|
|
237557
237694
|
|
|
237558
237695
|
var lon = Lib.modHalf(lonlat[0], 360);
|
|
237559
237696
|
var lat = lonlat[1];
|
|
@@ -237634,7 +237771,7 @@ module.exports = {
|
|
|
237634
237771
|
getExtraText: getExtraText
|
|
237635
237772
|
};
|
|
237636
237773
|
|
|
237637
|
-
},{"../../components/fx":403,"../../constants/numerical":487,"../../lib":525,"../scatter/get_trace_color":958}],1022:[function(_dereq_,module,exports){
|
|
237774
|
+
},{"../../components/fx":403,"../../constants/numerical":487,"../../lib":525,"../../plots/mapbox/constants":630,"../scatter/get_trace_color":958}],1022:[function(_dereq_,module,exports){
|
|
237638
237775
|
'use strict';
|
|
237639
237776
|
|
|
237640
237777
|
module.exports = {
|
|
@@ -237666,27 +237803,36 @@ module.exports = {
|
|
|
237666
237803
|
},{"../../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
237804
|
'use strict';
|
|
237668
237805
|
|
|
237806
|
+
var Lib = _dereq_('../../lib');
|
|
237669
237807
|
var convert = _dereq_('./convert');
|
|
237670
237808
|
var LAYER_PREFIX = _dereq_('../../plots/mapbox/constants').traceLayerPrefix;
|
|
237671
|
-
var ORDER =
|
|
237809
|
+
var ORDER = {
|
|
237810
|
+
cluster: ['cluster', 'clusterCount', 'circle'],
|
|
237811
|
+
nonCluster: ['fill', 'line', 'circle', 'symbol'],
|
|
237812
|
+
};
|
|
237672
237813
|
|
|
237673
|
-
function ScatterMapbox(subplot, uid) {
|
|
237814
|
+
function ScatterMapbox(subplot, uid, clusterEnabled) {
|
|
237674
237815
|
this.type = 'scattermapbox';
|
|
237675
237816
|
this.subplot = subplot;
|
|
237676
237817
|
this.uid = uid;
|
|
237818
|
+
this.clusterEnabled = clusterEnabled;
|
|
237677
237819
|
|
|
237678
237820
|
this.sourceIds = {
|
|
237679
237821
|
fill: 'source-' + uid + '-fill',
|
|
237680
237822
|
line: 'source-' + uid + '-line',
|
|
237681
237823
|
circle: 'source-' + uid + '-circle',
|
|
237682
|
-
symbol: 'source-' + uid + '-symbol'
|
|
237824
|
+
symbol: 'source-' + uid + '-symbol',
|
|
237825
|
+
cluster: 'source-' + uid + '-circle',
|
|
237826
|
+
clusterCount: 'source-' + uid + '-circle',
|
|
237683
237827
|
};
|
|
237684
237828
|
|
|
237685
237829
|
this.layerIds = {
|
|
237686
237830
|
fill: LAYER_PREFIX + uid + '-fill',
|
|
237687
237831
|
line: LAYER_PREFIX + uid + '-line',
|
|
237688
237832
|
circle: LAYER_PREFIX + uid + '-circle',
|
|
237689
|
-
symbol: LAYER_PREFIX + uid + '-symbol'
|
|
237833
|
+
symbol: LAYER_PREFIX + uid + '-symbol',
|
|
237834
|
+
cluster: LAYER_PREFIX + uid + '-cluster',
|
|
237835
|
+
clusterCount: LAYER_PREFIX + uid + '-cluster-count',
|
|
237690
237836
|
};
|
|
237691
237837
|
|
|
237692
237838
|
// We could merge the 'fill' source with the 'line' source and
|
|
@@ -237700,11 +237846,20 @@ function ScatterMapbox(subplot, uid) {
|
|
|
237700
237846
|
|
|
237701
237847
|
var proto = ScatterMapbox.prototype;
|
|
237702
237848
|
|
|
237703
|
-
proto.addSource = function(k, opts) {
|
|
237704
|
-
|
|
237849
|
+
proto.addSource = function(k, opts, cluster) {
|
|
237850
|
+
var sourceOpts = {
|
|
237705
237851
|
type: 'geojson',
|
|
237706
|
-
data: opts.geojson
|
|
237707
|
-
}
|
|
237852
|
+
data: opts.geojson,
|
|
237853
|
+
};
|
|
237854
|
+
|
|
237855
|
+
if(cluster && cluster.enabled) {
|
|
237856
|
+
Lib.extendFlat(sourceOpts, {
|
|
237857
|
+
cluster: true,
|
|
237858
|
+
clusterMaxZoom: cluster.maxzoom,
|
|
237859
|
+
});
|
|
237860
|
+
}
|
|
237861
|
+
|
|
237862
|
+
this.subplot.map.addSource(this.sourceIds[k], sourceOpts);
|
|
237708
237863
|
};
|
|
237709
237864
|
|
|
237710
237865
|
proto.setSourceData = function(k, opts) {
|
|
@@ -237714,45 +237869,68 @@ proto.setSourceData = function(k, opts) {
|
|
|
237714
237869
|
};
|
|
237715
237870
|
|
|
237716
237871
|
proto.addLayer = function(k, opts, below) {
|
|
237717
|
-
|
|
237718
|
-
type:
|
|
237872
|
+
var source = {
|
|
237873
|
+
type: opts.type,
|
|
237719
237874
|
id: this.layerIds[k],
|
|
237720
237875
|
source: this.sourceIds[k],
|
|
237721
237876
|
layout: opts.layout,
|
|
237722
|
-
paint: opts.paint
|
|
237723
|
-
}
|
|
237877
|
+
paint: opts.paint,
|
|
237878
|
+
};
|
|
237879
|
+
if(opts.filter) {
|
|
237880
|
+
source.filter = opts.filter;
|
|
237881
|
+
}
|
|
237882
|
+
this.subplot.addLayer(source, below);
|
|
237724
237883
|
};
|
|
237725
237884
|
|
|
237726
237885
|
proto.update = function update(calcTrace) {
|
|
237886
|
+
var trace = calcTrace[0].trace;
|
|
237727
237887
|
var subplot = this.subplot;
|
|
237728
237888
|
var map = subplot.map;
|
|
237729
237889
|
var optsAll = convert(subplot.gd, calcTrace);
|
|
237730
237890
|
var below = subplot.belowLookup['trace-' + this.uid];
|
|
237731
237891
|
var i, k, opts;
|
|
237892
|
+
var hasCluster = !!(trace.cluster && trace.cluster.enabled);
|
|
237893
|
+
var hadCluster = !!this.clusterEnabled;
|
|
237732
237894
|
|
|
237733
237895
|
if(below !== this.below) {
|
|
237734
|
-
|
|
237735
|
-
|
|
237896
|
+
var order = ORDER.nonCluster;
|
|
237897
|
+
|
|
237898
|
+
for(i = order.length - 1; i >= 0; i--) {
|
|
237899
|
+
k = order[i];
|
|
237736
237900
|
map.removeLayer(this.layerIds[k]);
|
|
237737
237901
|
}
|
|
237738
|
-
for(i = 0; i <
|
|
237739
|
-
k =
|
|
237902
|
+
for(i = 0; i < order.length; i++) {
|
|
237903
|
+
k = order[i];
|
|
237740
237904
|
opts = optsAll[k];
|
|
237741
237905
|
this.addLayer(k, opts, below);
|
|
237742
237906
|
}
|
|
237743
237907
|
this.below = below;
|
|
237744
|
-
}
|
|
237745
|
-
|
|
237746
|
-
|
|
237747
|
-
|
|
237748
|
-
|
|
237749
|
-
|
|
237750
|
-
subplot.setOptions(this.layerIds[k], 'setLayoutProperty', opts.layout);
|
|
237751
|
-
|
|
237752
|
-
if(opts.layout.visibility === 'visible') {
|
|
237753
|
-
this.setSourceData(k, opts);
|
|
237754
|
-
subplot.setOptions(this.layerIds[k], 'setPaintProperty', opts.paint);
|
|
237908
|
+
} else if(hasCluster && !hadCluster) {
|
|
237909
|
+
for(i = ORDER.nonCluster.length - 1; i >= 0; i--) {
|
|
237910
|
+
k = ORDER.nonCluster[i];
|
|
237911
|
+
map.removeLayer(this.layerIds[k]);
|
|
237912
|
+
map.removeSource(this.sourceIds[k]);
|
|
237755
237913
|
}
|
|
237914
|
+
this.addSource('circle', optsAll.circle, trace.cluster);
|
|
237915
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
237916
|
+
k = ORDER.cluster[i];
|
|
237917
|
+
opts = optsAll[k];
|
|
237918
|
+
this.addLayer(k, opts, below);
|
|
237919
|
+
}
|
|
237920
|
+
this.clusterEnabled = hasCluster;
|
|
237921
|
+
} else if(!hasCluster && hadCluster) {
|
|
237922
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
237923
|
+
k = ORDER.cluster[i];
|
|
237924
|
+
map.removeLayer(this.layerIds[k]);
|
|
237925
|
+
}
|
|
237926
|
+
map.removeSource(this.sourceIds.circle);
|
|
237927
|
+
for(i = 0; i < ORDER.nonCluster.length; i++) {
|
|
237928
|
+
k = ORDER.nonCluster[i];
|
|
237929
|
+
opts = optsAll[k];
|
|
237930
|
+
this.addSource(k, opts, trace.cluster);
|
|
237931
|
+
this.addLayer(k, opts, below);
|
|
237932
|
+
}
|
|
237933
|
+
this.clusterEnabled = hasCluster;
|
|
237756
237934
|
}
|
|
237757
237935
|
|
|
237758
237936
|
// link ref for quick update during selections
|
|
@@ -237761,9 +237939,9 @@ proto.update = function update(calcTrace) {
|
|
|
237761
237939
|
|
|
237762
237940
|
proto.dispose = function dispose() {
|
|
237763
237941
|
var map = this.subplot.map;
|
|
237764
|
-
|
|
237765
|
-
for(var i =
|
|
237766
|
-
var k =
|
|
237942
|
+
var order = this.clusterEnabled ? ORDER.cluster : ORDER.nonCluster;
|
|
237943
|
+
for(var i = order.length - 1; i >= 0; i--) {
|
|
237944
|
+
var k = order[i];
|
|
237767
237945
|
map.removeLayer(this.layerIds[k]);
|
|
237768
237946
|
map.removeSource(this.sourceIds[k]);
|
|
237769
237947
|
}
|
|
@@ -237771,15 +237949,31 @@ proto.dispose = function dispose() {
|
|
|
237771
237949
|
|
|
237772
237950
|
module.exports = function createScatterMapbox(subplot, calcTrace) {
|
|
237773
237951
|
var trace = calcTrace[0].trace;
|
|
237774
|
-
var
|
|
237952
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
237953
|
+
var scatterMapbox = new ScatterMapbox(
|
|
237954
|
+
subplot,
|
|
237955
|
+
trace.uid,
|
|
237956
|
+
hasCluster
|
|
237957
|
+
);
|
|
237958
|
+
|
|
237775
237959
|
var optsAll = convert(subplot.gd, calcTrace);
|
|
237776
237960
|
var below = scatterMapbox.below = subplot.belowLookup['trace-' + trace.uid];
|
|
237961
|
+
var i, k, opts;
|
|
237777
237962
|
|
|
237778
|
-
|
|
237779
|
-
|
|
237780
|
-
|
|
237781
|
-
|
|
237782
|
-
|
|
237963
|
+
if(hasCluster) {
|
|
237964
|
+
scatterMapbox.addSource('circle', optsAll.circle, trace.cluster);
|
|
237965
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
237966
|
+
k = ORDER.cluster[i];
|
|
237967
|
+
opts = optsAll[k];
|
|
237968
|
+
scatterMapbox.addLayer(k, opts, below);
|
|
237969
|
+
}
|
|
237970
|
+
} else {
|
|
237971
|
+
for(i = 0; i < ORDER.nonCluster.length; i++) {
|
|
237972
|
+
k = ORDER.nonCluster[i];
|
|
237973
|
+
opts = optsAll[k];
|
|
237974
|
+
scatterMapbox.addSource(k, opts, trace.cluster);
|
|
237975
|
+
scatterMapbox.addLayer(k, opts, below);
|
|
237976
|
+
}
|
|
237783
237977
|
}
|
|
237784
237978
|
|
|
237785
237979
|
// link ref for quick update during selections
|
|
@@ -237788,7 +237982,7 @@ module.exports = function createScatterMapbox(subplot, calcTrace) {
|
|
|
237788
237982
|
return scatterMapbox;
|
|
237789
237983
|
};
|
|
237790
237984
|
|
|
237791
|
-
},{"../../plots/mapbox/constants":630,"./convert":1017}],1024:[function(_dereq_,module,exports){
|
|
237985
|
+
},{"../../lib":525,"../../plots/mapbox/constants":630,"./convert":1017}],1024:[function(_dereq_,module,exports){
|
|
237792
237986
|
'use strict';
|
|
237793
237987
|
|
|
237794
237988
|
var Lib = _dereq_('../../lib');
|
|
@@ -250206,7 +250400,7 @@ function getSortFunc(opts, d2c) {
|
|
|
250206
250400
|
'use strict';
|
|
250207
250401
|
|
|
250208
250402
|
// package version injected by `npm run preprocess`
|
|
250209
|
-
exports.version = '2.
|
|
250403
|
+
exports.version = '2.16.1';
|
|
250210
250404
|
|
|
250211
250405
|
},{}],1151:[function(_dereq_,module,exports){
|
|
250212
250406
|
(function (global){(function (){
|