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.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
|
|
@@ -163458,6 +163458,21 @@ var attrs = module.exports = overrideAll({
|
|
|
163458
163458
|
dflt: 0,
|
|
163459
163459
|
},
|
|
163460
163460
|
|
|
163461
|
+
bounds: {
|
|
163462
|
+
west: {
|
|
163463
|
+
valType: 'number',
|
|
163464
|
+
},
|
|
163465
|
+
east: {
|
|
163466
|
+
valType: 'number',
|
|
163467
|
+
},
|
|
163468
|
+
south: {
|
|
163469
|
+
valType: 'number',
|
|
163470
|
+
},
|
|
163471
|
+
north: {
|
|
163472
|
+
valType: 'number',
|
|
163473
|
+
}
|
|
163474
|
+
},
|
|
163475
|
+
|
|
163461
163476
|
layers: templatedArray('layer', {
|
|
163462
163477
|
visible: {
|
|
163463
163478
|
valType: 'boolean',
|
|
@@ -163603,6 +163618,19 @@ function handleDefaults(containerIn, containerOut, coerce, opts) {
|
|
|
163603
163618
|
coerce('bearing');
|
|
163604
163619
|
coerce('pitch');
|
|
163605
163620
|
|
|
163621
|
+
var west = coerce('bounds.west');
|
|
163622
|
+
var east = coerce('bounds.east');
|
|
163623
|
+
var south = coerce('bounds.south');
|
|
163624
|
+
var north = coerce('bounds.north');
|
|
163625
|
+
if(
|
|
163626
|
+
west === undefined ||
|
|
163627
|
+
east === undefined ||
|
|
163628
|
+
south === undefined ||
|
|
163629
|
+
north === undefined
|
|
163630
|
+
) {
|
|
163631
|
+
delete containerOut.bounds;
|
|
163632
|
+
}
|
|
163633
|
+
|
|
163606
163634
|
handleArrayContainerDefaults(containerIn, containerOut, {
|
|
163607
163635
|
name: 'layers',
|
|
163608
163636
|
handleItemDefaults: handleLayerDefaults
|
|
@@ -163768,6 +163796,9 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
|
|
|
163768
163796
|
// store access token associated with this map
|
|
163769
163797
|
self.accessToken = opts.accesstoken;
|
|
163770
163798
|
|
|
163799
|
+
var bounds = opts.bounds;
|
|
163800
|
+
var maxBounds = bounds ? [[bounds.west, bounds.south], [bounds.east, bounds.north]] : null;
|
|
163801
|
+
|
|
163771
163802
|
// create the map!
|
|
163772
163803
|
var map = self.map = new mapboxgl.Map({
|
|
163773
163804
|
container: self.div,
|
|
@@ -163777,6 +163808,7 @@ proto.createMap = function(calcData, fullLayout, resolve, reject) {
|
|
|
163777
163808
|
zoom: opts.zoom,
|
|
163778
163809
|
bearing: opts.bearing,
|
|
163779
163810
|
pitch: opts.pitch,
|
|
163811
|
+
maxBounds: maxBounds,
|
|
163780
163812
|
|
|
163781
163813
|
interactive: !self.isStatic,
|
|
163782
163814
|
preserveDrawingBuffer: self.isStatic,
|
|
@@ -214037,6 +214069,7 @@ var colorScaleAttrs = _dereq_('../../components/colorscale/attributes');
|
|
|
214037
214069
|
|
|
214038
214070
|
var extendFlat = _dereq_('../../lib/extend').extendFlat;
|
|
214039
214071
|
var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll;
|
|
214072
|
+
var mapboxLayoutAtributes = _dereq_('../../plots/mapbox/layout_attributes');
|
|
214040
214073
|
|
|
214041
214074
|
var lineAttrs = scatterGeoAttrs.line;
|
|
214042
214075
|
var markerAttrs = scatterGeoAttrs.marker;
|
|
@@ -214045,6 +214078,33 @@ module.exports = overrideAll({
|
|
|
214045
214078
|
lon: scatterGeoAttrs.lon,
|
|
214046
214079
|
lat: scatterGeoAttrs.lat,
|
|
214047
214080
|
|
|
214081
|
+
cluster: {
|
|
214082
|
+
enabled: {
|
|
214083
|
+
valType: 'boolean',
|
|
214084
|
+
},
|
|
214085
|
+
maxzoom: extendFlat({}, mapboxLayoutAtributes.layers.maxzoom, {
|
|
214086
|
+
}),
|
|
214087
|
+
step: {
|
|
214088
|
+
valType: 'number',
|
|
214089
|
+
arrayOk: true,
|
|
214090
|
+
dflt: -1,
|
|
214091
|
+
min: -1,
|
|
214092
|
+
},
|
|
214093
|
+
size: {
|
|
214094
|
+
valType: 'number',
|
|
214095
|
+
arrayOk: true,
|
|
214096
|
+
dflt: 20,
|
|
214097
|
+
min: 0,
|
|
214098
|
+
},
|
|
214099
|
+
color: {
|
|
214100
|
+
valType: 'color',
|
|
214101
|
+
arrayOk: true,
|
|
214102
|
+
},
|
|
214103
|
+
opacity: extendFlat({}, markerAttrs.opacity, {
|
|
214104
|
+
dflt: 1
|
|
214105
|
+
})
|
|
214106
|
+
},
|
|
214107
|
+
|
|
214048
214108
|
// locations
|
|
214049
214109
|
// locationmode
|
|
214050
214110
|
|
|
@@ -214147,11 +214207,12 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
214147
214207
|
var hasText = subTypes.hasText(trace);
|
|
214148
214208
|
var hasCircles = (hasMarkers && trace.marker.symbol === 'circle');
|
|
214149
214209
|
var hasSymbols = (hasMarkers && trace.marker.symbol !== 'circle');
|
|
214210
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
214150
214211
|
|
|
214151
|
-
var fill = initContainer();
|
|
214152
|
-
var line = initContainer();
|
|
214153
|
-
var circle = initContainer();
|
|
214154
|
-
var symbol = initContainer();
|
|
214212
|
+
var fill = initContainer('fill');
|
|
214213
|
+
var line = initContainer('line');
|
|
214214
|
+
var circle = initContainer('circle');
|
|
214215
|
+
var symbol = initContainer('symbol');
|
|
214155
214216
|
|
|
214156
214217
|
var opts = {
|
|
214157
214218
|
fill: fill,
|
|
@@ -214195,6 +214256,29 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
214195
214256
|
var circleOpts = makeCircleOpts(calcTrace);
|
|
214196
214257
|
circle.geojson = circleOpts.geojson;
|
|
214197
214258
|
circle.layout.visibility = 'visible';
|
|
214259
|
+
if(hasCluster) {
|
|
214260
|
+
circle.filter = ['!', ['has', 'point_count']];
|
|
214261
|
+
opts.cluster = {
|
|
214262
|
+
type: 'circle',
|
|
214263
|
+
filter: ['has', 'point_count'],
|
|
214264
|
+
layout: {visibility: 'visible'},
|
|
214265
|
+
paint: {
|
|
214266
|
+
'circle-color': arrayifyAttribute(trace.cluster.color, trace.cluster.step),
|
|
214267
|
+
'circle-radius': arrayifyAttribute(trace.cluster.size, trace.cluster.step),
|
|
214268
|
+
'circle-opacity': arrayifyAttribute(trace.cluster.opacity, trace.cluster.step),
|
|
214269
|
+
},
|
|
214270
|
+
};
|
|
214271
|
+
opts.clusterCount = {
|
|
214272
|
+
type: 'symbol',
|
|
214273
|
+
filter: ['has', 'point_count'],
|
|
214274
|
+
paint: {},
|
|
214275
|
+
layout: {
|
|
214276
|
+
'text-field': '{point_count_abbreviated}',
|
|
214277
|
+
'text-font': ['Open Sans Regular', 'Arial Unicode MS Regular'],
|
|
214278
|
+
'text-size': 12
|
|
214279
|
+
}
|
|
214280
|
+
};
|
|
214281
|
+
}
|
|
214198
214282
|
|
|
214199
214283
|
Lib.extendFlat(circle.paint, {
|
|
214200
214284
|
'circle-color': circleOpts.mcc,
|
|
@@ -214203,6 +214287,10 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
214203
214287
|
});
|
|
214204
214288
|
}
|
|
214205
214289
|
|
|
214290
|
+
if(hasCircles && hasCluster) {
|
|
214291
|
+
circle.filter = ['!', ['has', 'point_count']];
|
|
214292
|
+
}
|
|
214293
|
+
|
|
214206
214294
|
if(hasSymbols || hasText) {
|
|
214207
214295
|
symbol.geojson = makeSymbolGeoJSON(calcTrace, gd);
|
|
214208
214296
|
|
|
@@ -214263,10 +214351,12 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
214263
214351
|
return opts;
|
|
214264
214352
|
};
|
|
214265
214353
|
|
|
214266
|
-
function initContainer() {
|
|
214354
|
+
function initContainer(type) {
|
|
214267
214355
|
return {
|
|
214356
|
+
type: type,
|
|
214268
214357
|
geojson: geoJsonUtils.makeBlank(),
|
|
214269
214358
|
layout: { visibility: 'none' },
|
|
214359
|
+
filter: null,
|
|
214270
214360
|
paint: {}
|
|
214271
214361
|
};
|
|
214272
214362
|
}
|
|
@@ -214321,7 +214411,8 @@ function makeCircleOpts(calcTrace) {
|
|
|
214321
214411
|
|
|
214322
214412
|
features.push({
|
|
214323
214413
|
type: 'Feature',
|
|
214324
|
-
|
|
214414
|
+
id: i + 1,
|
|
214415
|
+
geometry: { type: 'Point', coordinates: lonlat },
|
|
214325
214416
|
properties: props
|
|
214326
214417
|
});
|
|
214327
214418
|
}
|
|
@@ -214445,6 +214536,20 @@ function isBADNUM(lonlat) {
|
|
|
214445
214536
|
return lonlat[0] === BADNUM;
|
|
214446
214537
|
}
|
|
214447
214538
|
|
|
214539
|
+
function arrayifyAttribute(values, step) {
|
|
214540
|
+
var newAttribute;
|
|
214541
|
+
if(Lib.isArrayOrTypedArray(values) && Lib.isArrayOrTypedArray(step)) {
|
|
214542
|
+
newAttribute = ['step', ['get', 'point_count'], values[0]];
|
|
214543
|
+
|
|
214544
|
+
for(var idx = 1; idx < values.length; idx++) {
|
|
214545
|
+
newAttribute.push(step[idx - 1], values[idx]);
|
|
214546
|
+
}
|
|
214547
|
+
} else {
|
|
214548
|
+
newAttribute = values;
|
|
214549
|
+
}
|
|
214550
|
+
return newAttribute;
|
|
214551
|
+
}
|
|
214552
|
+
|
|
214448
214553
|
},{"../../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){
|
|
214449
214554
|
'use strict';
|
|
214450
214555
|
|
|
@@ -214462,6 +214567,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
214462
214567
|
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
|
|
214463
214568
|
}
|
|
214464
214569
|
|
|
214570
|
+
function coerce2(attr, dflt) {
|
|
214571
|
+
return Lib.coerce2(traceIn, traceOut, attributes, attr, dflt);
|
|
214572
|
+
}
|
|
214573
|
+
|
|
214465
214574
|
var len = handleLonLatDefaults(traceIn, traceOut, coerce);
|
|
214466
214575
|
if(!len) {
|
|
214467
214576
|
traceOut.visible = false;
|
|
@@ -214494,6 +214603,21 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
214494
214603
|
}
|
|
214495
214604
|
}
|
|
214496
214605
|
|
|
214606
|
+
var clusterMaxzoom = coerce2('cluster.maxzoom');
|
|
214607
|
+
var clusterStep = coerce2('cluster.step');
|
|
214608
|
+
var clusterColor = coerce2('cluster.color', (traceOut.marker && traceOut.marker.color) || defaultColor);
|
|
214609
|
+
var clusterSize = coerce2('cluster.size');
|
|
214610
|
+
var clusterOpacity = coerce2('cluster.opacity');
|
|
214611
|
+
|
|
214612
|
+
var clusterEnabledDflt =
|
|
214613
|
+
clusterMaxzoom !== false ||
|
|
214614
|
+
clusterStep !== false ||
|
|
214615
|
+
clusterColor !== false ||
|
|
214616
|
+
clusterSize !== false ||
|
|
214617
|
+
clusterOpacity !== false;
|
|
214618
|
+
|
|
214619
|
+
coerce('cluster.enabled', clusterEnabledDflt);
|
|
214620
|
+
|
|
214497
214621
|
if(subTypes.hasText(traceOut)) {
|
|
214498
214622
|
handleTextDefaults(traceIn, traceOut, layout, coerce, {noSelect: true});
|
|
214499
214623
|
}
|
|
@@ -214552,6 +214676,7 @@ var Lib = _dereq_('../../lib');
|
|
|
214552
214676
|
var getTraceColor = _dereq_('../scatter/get_trace_color');
|
|
214553
214677
|
var fillText = Lib.fillText;
|
|
214554
214678
|
var BADNUM = _dereq_('../../constants/numerical').BADNUM;
|
|
214679
|
+
var LAYER_PREFIX = _dereq_('../../plots/mapbox/constants').traceLayerPrefix;
|
|
214555
214680
|
|
|
214556
214681
|
function hoverPoints(pointData, xval, yval) {
|
|
214557
214682
|
var cd = pointData.cd;
|
|
@@ -214559,6 +214684,14 @@ function hoverPoints(pointData, xval, yval) {
|
|
|
214559
214684
|
var xa = pointData.xa;
|
|
214560
214685
|
var ya = pointData.ya;
|
|
214561
214686
|
var subplot = pointData.subplot;
|
|
214687
|
+
var clusteredPointsIds = [];
|
|
214688
|
+
var layer = LAYER_PREFIX + trace.uid + '-circle';
|
|
214689
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
214690
|
+
|
|
214691
|
+
if(hasCluster) {
|
|
214692
|
+
var elems = subplot.map.queryRenderedFeatures(null, {layers: [layer]});
|
|
214693
|
+
clusteredPointsIds = elems.map(function(elem) {return elem.id;});
|
|
214694
|
+
}
|
|
214562
214695
|
|
|
214563
214696
|
// compute winding number about [-180, 180] globe
|
|
214564
214697
|
var winding = (xval >= 0) ?
|
|
@@ -214572,6 +214705,7 @@ function hoverPoints(pointData, xval, yval) {
|
|
|
214572
214705
|
function distFn(d) {
|
|
214573
214706
|
var lonlat = d.lonlat;
|
|
214574
214707
|
if(lonlat[0] === BADNUM) return Infinity;
|
|
214708
|
+
if(hasCluster && clusteredPointsIds.indexOf(d.i + 1) === -1) return Infinity;
|
|
214575
214709
|
|
|
214576
214710
|
var lon = Lib.modHalf(lonlat[0], 360);
|
|
214577
214711
|
var lat = lonlat[1];
|
|
@@ -214652,7 +214786,7 @@ module.exports = {
|
|
|
214652
214786
|
getExtraText: getExtraText
|
|
214653
214787
|
};
|
|
214654
214788
|
|
|
214655
|
-
},{"../../components/fx":407,"../../constants/numerical":491,"../../lib":515,"../scatter/get_trace_color":946}],1008:[function(_dereq_,module,exports){
|
|
214789
|
+
},{"../../components/fx":407,"../../constants/numerical":491,"../../lib":515,"../../plots/mapbox/constants":620,"../scatter/get_trace_color":946}],1008:[function(_dereq_,module,exports){
|
|
214656
214790
|
'use strict';
|
|
214657
214791
|
|
|
214658
214792
|
module.exports = {
|
|
@@ -214684,27 +214818,36 @@ module.exports = {
|
|
|
214684
214818
|
},{"../../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){
|
|
214685
214819
|
'use strict';
|
|
214686
214820
|
|
|
214821
|
+
var Lib = _dereq_('../../lib');
|
|
214687
214822
|
var convert = _dereq_('./convert');
|
|
214688
214823
|
var LAYER_PREFIX = _dereq_('../../plots/mapbox/constants').traceLayerPrefix;
|
|
214689
|
-
var ORDER =
|
|
214824
|
+
var ORDER = {
|
|
214825
|
+
cluster: ['cluster', 'clusterCount', 'circle'],
|
|
214826
|
+
nonCluster: ['fill', 'line', 'circle', 'symbol'],
|
|
214827
|
+
};
|
|
214690
214828
|
|
|
214691
|
-
function ScatterMapbox(subplot, uid) {
|
|
214829
|
+
function ScatterMapbox(subplot, uid, clusterEnabled) {
|
|
214692
214830
|
this.type = 'scattermapbox';
|
|
214693
214831
|
this.subplot = subplot;
|
|
214694
214832
|
this.uid = uid;
|
|
214833
|
+
this.clusterEnabled = clusterEnabled;
|
|
214695
214834
|
|
|
214696
214835
|
this.sourceIds = {
|
|
214697
214836
|
fill: 'source-' + uid + '-fill',
|
|
214698
214837
|
line: 'source-' + uid + '-line',
|
|
214699
214838
|
circle: 'source-' + uid + '-circle',
|
|
214700
|
-
symbol: 'source-' + uid + '-symbol'
|
|
214839
|
+
symbol: 'source-' + uid + '-symbol',
|
|
214840
|
+
cluster: 'source-' + uid + '-circle',
|
|
214841
|
+
clusterCount: 'source-' + uid + '-circle',
|
|
214701
214842
|
};
|
|
214702
214843
|
|
|
214703
214844
|
this.layerIds = {
|
|
214704
214845
|
fill: LAYER_PREFIX + uid + '-fill',
|
|
214705
214846
|
line: LAYER_PREFIX + uid + '-line',
|
|
214706
214847
|
circle: LAYER_PREFIX + uid + '-circle',
|
|
214707
|
-
symbol: LAYER_PREFIX + uid + '-symbol'
|
|
214848
|
+
symbol: LAYER_PREFIX + uid + '-symbol',
|
|
214849
|
+
cluster: LAYER_PREFIX + uid + '-cluster',
|
|
214850
|
+
clusterCount: LAYER_PREFIX + uid + '-cluster-count',
|
|
214708
214851
|
};
|
|
214709
214852
|
|
|
214710
214853
|
// We could merge the 'fill' source with the 'line' source and
|
|
@@ -214718,11 +214861,20 @@ function ScatterMapbox(subplot, uid) {
|
|
|
214718
214861
|
|
|
214719
214862
|
var proto = ScatterMapbox.prototype;
|
|
214720
214863
|
|
|
214721
|
-
proto.addSource = function(k, opts) {
|
|
214722
|
-
|
|
214864
|
+
proto.addSource = function(k, opts, cluster) {
|
|
214865
|
+
var sourceOpts = {
|
|
214723
214866
|
type: 'geojson',
|
|
214724
|
-
data: opts.geojson
|
|
214725
|
-
}
|
|
214867
|
+
data: opts.geojson,
|
|
214868
|
+
};
|
|
214869
|
+
|
|
214870
|
+
if(cluster && cluster.enabled) {
|
|
214871
|
+
Lib.extendFlat(sourceOpts, {
|
|
214872
|
+
cluster: true,
|
|
214873
|
+
clusterMaxZoom: cluster.maxzoom,
|
|
214874
|
+
});
|
|
214875
|
+
}
|
|
214876
|
+
|
|
214877
|
+
this.subplot.map.addSource(this.sourceIds[k], sourceOpts);
|
|
214726
214878
|
};
|
|
214727
214879
|
|
|
214728
214880
|
proto.setSourceData = function(k, opts) {
|
|
@@ -214732,56 +214884,79 @@ proto.setSourceData = function(k, opts) {
|
|
|
214732
214884
|
};
|
|
214733
214885
|
|
|
214734
214886
|
proto.addLayer = function(k, opts, below) {
|
|
214735
|
-
|
|
214736
|
-
type:
|
|
214887
|
+
var source = {
|
|
214888
|
+
type: opts.type,
|
|
214737
214889
|
id: this.layerIds[k],
|
|
214738
214890
|
source: this.sourceIds[k],
|
|
214739
214891
|
layout: opts.layout,
|
|
214740
|
-
paint: opts.paint
|
|
214741
|
-
}
|
|
214892
|
+
paint: opts.paint,
|
|
214893
|
+
};
|
|
214894
|
+
if(opts.filter) {
|
|
214895
|
+
source.filter = opts.filter;
|
|
214896
|
+
}
|
|
214897
|
+
this.subplot.addLayer(source, below);
|
|
214742
214898
|
};
|
|
214743
214899
|
|
|
214744
214900
|
proto.update = function update(calcTrace) {
|
|
214901
|
+
var trace = calcTrace[0].trace;
|
|
214745
214902
|
var subplot = this.subplot;
|
|
214746
214903
|
var map = subplot.map;
|
|
214747
214904
|
var optsAll = convert(subplot.gd, calcTrace);
|
|
214748
214905
|
var below = subplot.belowLookup['trace-' + this.uid];
|
|
214749
214906
|
var i, k, opts;
|
|
214907
|
+
var hasCluster = !!(trace.cluster && trace.cluster.enabled);
|
|
214908
|
+
var hadCluster = !!this.clusterEnabled;
|
|
214750
214909
|
|
|
214751
214910
|
if(below !== this.below) {
|
|
214752
|
-
|
|
214753
|
-
|
|
214911
|
+
var order = ORDER.nonCluster;
|
|
214912
|
+
|
|
214913
|
+
for(i = order.length - 1; i >= 0; i--) {
|
|
214914
|
+
k = order[i];
|
|
214754
214915
|
map.removeLayer(this.layerIds[k]);
|
|
214755
214916
|
}
|
|
214756
|
-
for(i = 0; i <
|
|
214757
|
-
k =
|
|
214917
|
+
for(i = 0; i < order.length; i++) {
|
|
214918
|
+
k = order[i];
|
|
214758
214919
|
opts = optsAll[k];
|
|
214759
214920
|
this.addLayer(k, opts, below);
|
|
214760
214921
|
}
|
|
214761
214922
|
this.below = below;
|
|
214762
|
-
}
|
|
214763
|
-
|
|
214764
|
-
|
|
214765
|
-
|
|
214766
|
-
|
|
214767
|
-
|
|
214768
|
-
|
|
214769
|
-
|
|
214770
|
-
|
|
214771
|
-
|
|
214772
|
-
|
|
214923
|
+
} else if(hasCluster && !hadCluster) {
|
|
214924
|
+
for(i = ORDER.nonCluster.length - 1; i >= 0; i--) {
|
|
214925
|
+
k = ORDER.nonCluster[i];
|
|
214926
|
+
map.removeLayer(this.layerIds[k]);
|
|
214927
|
+
map.removeSource(this.sourceIds[k]);
|
|
214928
|
+
}
|
|
214929
|
+
this.addSource('circle', optsAll.circle, trace.cluster);
|
|
214930
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
214931
|
+
k = ORDER.cluster[i];
|
|
214932
|
+
opts = optsAll[k];
|
|
214933
|
+
this.addLayer(k, opts, below);
|
|
214934
|
+
}
|
|
214935
|
+
this.clusterEnabled = hasCluster;
|
|
214936
|
+
} else if(!hasCluster && hadCluster) {
|
|
214937
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
214938
|
+
k = ORDER.cluster[i];
|
|
214939
|
+
map.removeLayer(this.layerIds[k]);
|
|
214940
|
+
}
|
|
214941
|
+
map.removeSource(this.sourceIds.circle);
|
|
214942
|
+
for(i = 0; i < ORDER.nonCluster.length; i++) {
|
|
214943
|
+
k = ORDER.nonCluster[i];
|
|
214944
|
+
opts = optsAll[k];
|
|
214945
|
+
this.addSource(k, opts, trace.cluster);
|
|
214946
|
+
this.addLayer(k, opts, below);
|
|
214773
214947
|
}
|
|
214948
|
+
this.clusterEnabled = hasCluster;
|
|
214774
214949
|
}
|
|
214775
214950
|
|
|
214776
|
-
|
|
214951
|
+
// link ref for quick update during selections
|
|
214777
214952
|
calcTrace[0].trace._glTrace = this;
|
|
214778
214953
|
};
|
|
214779
214954
|
|
|
214780
214955
|
proto.dispose = function dispose() {
|
|
214781
214956
|
var map = this.subplot.map;
|
|
214782
|
-
|
|
214783
|
-
for(var i =
|
|
214784
|
-
var k =
|
|
214957
|
+
var order = this.clusterEnabled ? ORDER.cluster : ORDER.nonCluster;
|
|
214958
|
+
for(var i = order.length - 1; i >= 0; i--) {
|
|
214959
|
+
var k = order[i];
|
|
214785
214960
|
map.removeLayer(this.layerIds[k]);
|
|
214786
214961
|
map.removeSource(this.sourceIds[k]);
|
|
214787
214962
|
}
|
|
@@ -214789,15 +214964,31 @@ proto.dispose = function dispose() {
|
|
|
214789
214964
|
|
|
214790
214965
|
module.exports = function createScatterMapbox(subplot, calcTrace) {
|
|
214791
214966
|
var trace = calcTrace[0].trace;
|
|
214792
|
-
var
|
|
214967
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
214968
|
+
var scatterMapbox = new ScatterMapbox(
|
|
214969
|
+
subplot,
|
|
214970
|
+
trace.uid,
|
|
214971
|
+
hasCluster
|
|
214972
|
+
);
|
|
214973
|
+
|
|
214793
214974
|
var optsAll = convert(subplot.gd, calcTrace);
|
|
214794
214975
|
var below = scatterMapbox.below = subplot.belowLookup['trace-' + trace.uid];
|
|
214976
|
+
var i, k, opts;
|
|
214795
214977
|
|
|
214796
|
-
|
|
214797
|
-
|
|
214798
|
-
|
|
214799
|
-
|
|
214800
|
-
|
|
214978
|
+
if(hasCluster) {
|
|
214979
|
+
scatterMapbox.addSource('circle', optsAll.circle, trace.cluster);
|
|
214980
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
214981
|
+
k = ORDER.cluster[i];
|
|
214982
|
+
opts = optsAll[k];
|
|
214983
|
+
scatterMapbox.addLayer(k, opts, below);
|
|
214984
|
+
}
|
|
214985
|
+
} else {
|
|
214986
|
+
for(i = 0; i < ORDER.nonCluster.length; i++) {
|
|
214987
|
+
k = ORDER.nonCluster[i];
|
|
214988
|
+
opts = optsAll[k];
|
|
214989
|
+
scatterMapbox.addSource(k, opts, trace.cluster);
|
|
214990
|
+
scatterMapbox.addLayer(k, opts, below);
|
|
214991
|
+
}
|
|
214801
214992
|
}
|
|
214802
214993
|
|
|
214803
214994
|
// link ref for quick update during selections
|
|
@@ -214806,7 +214997,7 @@ module.exports = function createScatterMapbox(subplot, calcTrace) {
|
|
|
214806
214997
|
return scatterMapbox;
|
|
214807
214998
|
};
|
|
214808
214999
|
|
|
214809
|
-
},{"../../plots/mapbox/constants":620,"./convert":1003}],1010:[function(_dereq_,module,exports){
|
|
215000
|
+
},{"../../lib":515,"../../plots/mapbox/constants":620,"./convert":1003}],1010:[function(_dereq_,module,exports){
|
|
214810
215001
|
'use strict';
|
|
214811
215002
|
|
|
214812
215003
|
var Lib = _dereq_('../../lib');
|
|
@@ -227170,7 +227361,7 @@ function getSortFunc(opts, d2c) {
|
|
|
227170
227361
|
'use strict';
|
|
227171
227362
|
|
|
227172
227363
|
// package version injected by `npm run preprocess`
|
|
227173
|
-
exports.version = '2.
|
|
227364
|
+
exports.version = '2.16.0';
|
|
227174
227365
|
|
|
227175
227366
|
},{}],1133:[function(_dereq_,module,exports){
|
|
227176
227367
|
(function (global){(function (){
|