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.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* plotly.js v2.
|
|
2
|
+
* plotly.js v2.16.1
|
|
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,
|
|
@@ -183021,6 +183053,9 @@ var proto = ChoroplethMapbox.prototype;
|
|
|
183021
183053
|
|
|
183022
183054
|
proto.update = function(calcTrace) {
|
|
183023
183055
|
this._update(convert(calcTrace));
|
|
183056
|
+
|
|
183057
|
+
// link ref for quick update during selections
|
|
183058
|
+
calcTrace[0].trace._glTrace = this;
|
|
183024
183059
|
};
|
|
183025
183060
|
|
|
183026
183061
|
proto.updateOnSelect = function(calcTrace) {
|
|
@@ -214037,6 +214072,7 @@ var colorScaleAttrs = _dereq_('../../components/colorscale/attributes');
|
|
|
214037
214072
|
|
|
214038
214073
|
var extendFlat = _dereq_('../../lib/extend').extendFlat;
|
|
214039
214074
|
var overrideAll = _dereq_('../../plot_api/edit_types').overrideAll;
|
|
214075
|
+
var mapboxLayoutAtributes = _dereq_('../../plots/mapbox/layout_attributes');
|
|
214040
214076
|
|
|
214041
214077
|
var lineAttrs = scatterGeoAttrs.line;
|
|
214042
214078
|
var markerAttrs = scatterGeoAttrs.marker;
|
|
@@ -214045,6 +214081,33 @@ module.exports = overrideAll({
|
|
|
214045
214081
|
lon: scatterGeoAttrs.lon,
|
|
214046
214082
|
lat: scatterGeoAttrs.lat,
|
|
214047
214083
|
|
|
214084
|
+
cluster: {
|
|
214085
|
+
enabled: {
|
|
214086
|
+
valType: 'boolean',
|
|
214087
|
+
},
|
|
214088
|
+
maxzoom: extendFlat({}, mapboxLayoutAtributes.layers.maxzoom, {
|
|
214089
|
+
}),
|
|
214090
|
+
step: {
|
|
214091
|
+
valType: 'number',
|
|
214092
|
+
arrayOk: true,
|
|
214093
|
+
dflt: -1,
|
|
214094
|
+
min: -1,
|
|
214095
|
+
},
|
|
214096
|
+
size: {
|
|
214097
|
+
valType: 'number',
|
|
214098
|
+
arrayOk: true,
|
|
214099
|
+
dflt: 20,
|
|
214100
|
+
min: 0,
|
|
214101
|
+
},
|
|
214102
|
+
color: {
|
|
214103
|
+
valType: 'color',
|
|
214104
|
+
arrayOk: true,
|
|
214105
|
+
},
|
|
214106
|
+
opacity: extendFlat({}, markerAttrs.opacity, {
|
|
214107
|
+
dflt: 1
|
|
214108
|
+
})
|
|
214109
|
+
},
|
|
214110
|
+
|
|
214048
214111
|
// locations
|
|
214049
214112
|
// locationmode
|
|
214050
214113
|
|
|
@@ -214147,11 +214210,12 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
214147
214210
|
var hasText = subTypes.hasText(trace);
|
|
214148
214211
|
var hasCircles = (hasMarkers && trace.marker.symbol === 'circle');
|
|
214149
214212
|
var hasSymbols = (hasMarkers && trace.marker.symbol !== 'circle');
|
|
214213
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
214150
214214
|
|
|
214151
|
-
var fill = initContainer();
|
|
214152
|
-
var line = initContainer();
|
|
214153
|
-
var circle = initContainer();
|
|
214154
|
-
var symbol = initContainer();
|
|
214215
|
+
var fill = initContainer('fill');
|
|
214216
|
+
var line = initContainer('line');
|
|
214217
|
+
var circle = initContainer('circle');
|
|
214218
|
+
var symbol = initContainer('symbol');
|
|
214155
214219
|
|
|
214156
214220
|
var opts = {
|
|
214157
214221
|
fill: fill,
|
|
@@ -214195,6 +214259,29 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
214195
214259
|
var circleOpts = makeCircleOpts(calcTrace);
|
|
214196
214260
|
circle.geojson = circleOpts.geojson;
|
|
214197
214261
|
circle.layout.visibility = 'visible';
|
|
214262
|
+
if(hasCluster) {
|
|
214263
|
+
circle.filter = ['!', ['has', 'point_count']];
|
|
214264
|
+
opts.cluster = {
|
|
214265
|
+
type: 'circle',
|
|
214266
|
+
filter: ['has', 'point_count'],
|
|
214267
|
+
layout: {visibility: 'visible'},
|
|
214268
|
+
paint: {
|
|
214269
|
+
'circle-color': arrayifyAttribute(trace.cluster.color, trace.cluster.step),
|
|
214270
|
+
'circle-radius': arrayifyAttribute(trace.cluster.size, trace.cluster.step),
|
|
214271
|
+
'circle-opacity': arrayifyAttribute(trace.cluster.opacity, trace.cluster.step),
|
|
214272
|
+
},
|
|
214273
|
+
};
|
|
214274
|
+
opts.clusterCount = {
|
|
214275
|
+
type: 'symbol',
|
|
214276
|
+
filter: ['has', 'point_count'],
|
|
214277
|
+
paint: {},
|
|
214278
|
+
layout: {
|
|
214279
|
+
'text-field': '{point_count_abbreviated}',
|
|
214280
|
+
'text-font': ['Open Sans Regular', 'Arial Unicode MS Regular'],
|
|
214281
|
+
'text-size': 12
|
|
214282
|
+
}
|
|
214283
|
+
};
|
|
214284
|
+
}
|
|
214198
214285
|
|
|
214199
214286
|
Lib.extendFlat(circle.paint, {
|
|
214200
214287
|
'circle-color': circleOpts.mcc,
|
|
@@ -214203,6 +214290,10 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
214203
214290
|
});
|
|
214204
214291
|
}
|
|
214205
214292
|
|
|
214293
|
+
if(hasCircles && hasCluster) {
|
|
214294
|
+
circle.filter = ['!', ['has', 'point_count']];
|
|
214295
|
+
}
|
|
214296
|
+
|
|
214206
214297
|
if(hasSymbols || hasText) {
|
|
214207
214298
|
symbol.geojson = makeSymbolGeoJSON(calcTrace, gd);
|
|
214208
214299
|
|
|
@@ -214263,10 +214354,12 @@ module.exports = function convert(gd, calcTrace) {
|
|
|
214263
214354
|
return opts;
|
|
214264
214355
|
};
|
|
214265
214356
|
|
|
214266
|
-
function initContainer() {
|
|
214357
|
+
function initContainer(type) {
|
|
214267
214358
|
return {
|
|
214359
|
+
type: type,
|
|
214268
214360
|
geojson: geoJsonUtils.makeBlank(),
|
|
214269
214361
|
layout: { visibility: 'none' },
|
|
214362
|
+
filter: null,
|
|
214270
214363
|
paint: {}
|
|
214271
214364
|
};
|
|
214272
214365
|
}
|
|
@@ -214321,7 +214414,8 @@ function makeCircleOpts(calcTrace) {
|
|
|
214321
214414
|
|
|
214322
214415
|
features.push({
|
|
214323
214416
|
type: 'Feature',
|
|
214324
|
-
|
|
214417
|
+
id: i + 1,
|
|
214418
|
+
geometry: { type: 'Point', coordinates: lonlat },
|
|
214325
214419
|
properties: props
|
|
214326
214420
|
});
|
|
214327
214421
|
}
|
|
@@ -214445,6 +214539,20 @@ function isBADNUM(lonlat) {
|
|
|
214445
214539
|
return lonlat[0] === BADNUM;
|
|
214446
214540
|
}
|
|
214447
214541
|
|
|
214542
|
+
function arrayifyAttribute(values, step) {
|
|
214543
|
+
var newAttribute;
|
|
214544
|
+
if(Lib.isArrayOrTypedArray(values) && Lib.isArrayOrTypedArray(step)) {
|
|
214545
|
+
newAttribute = ['step', ['get', 'point_count'], values[0]];
|
|
214546
|
+
|
|
214547
|
+
for(var idx = 1; idx < values.length; idx++) {
|
|
214548
|
+
newAttribute.push(step[idx - 1], values[idx]);
|
|
214549
|
+
}
|
|
214550
|
+
} else {
|
|
214551
|
+
newAttribute = values;
|
|
214552
|
+
}
|
|
214553
|
+
return newAttribute;
|
|
214554
|
+
}
|
|
214555
|
+
|
|
214448
214556
|
},{"../../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
214557
|
'use strict';
|
|
214450
214558
|
|
|
@@ -214462,6 +214570,10 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
214462
214570
|
return Lib.coerce(traceIn, traceOut, attributes, attr, dflt);
|
|
214463
214571
|
}
|
|
214464
214572
|
|
|
214573
|
+
function coerce2(attr, dflt) {
|
|
214574
|
+
return Lib.coerce2(traceIn, traceOut, attributes, attr, dflt);
|
|
214575
|
+
}
|
|
214576
|
+
|
|
214465
214577
|
var len = handleLonLatDefaults(traceIn, traceOut, coerce);
|
|
214466
214578
|
if(!len) {
|
|
214467
214579
|
traceOut.visible = false;
|
|
@@ -214494,6 +214606,21 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
|
|
|
214494
214606
|
}
|
|
214495
214607
|
}
|
|
214496
214608
|
|
|
214609
|
+
var clusterMaxzoom = coerce2('cluster.maxzoom');
|
|
214610
|
+
var clusterStep = coerce2('cluster.step');
|
|
214611
|
+
var clusterColor = coerce2('cluster.color', (traceOut.marker && traceOut.marker.color) || defaultColor);
|
|
214612
|
+
var clusterSize = coerce2('cluster.size');
|
|
214613
|
+
var clusterOpacity = coerce2('cluster.opacity');
|
|
214614
|
+
|
|
214615
|
+
var clusterEnabledDflt =
|
|
214616
|
+
clusterMaxzoom !== false ||
|
|
214617
|
+
clusterStep !== false ||
|
|
214618
|
+
clusterColor !== false ||
|
|
214619
|
+
clusterSize !== false ||
|
|
214620
|
+
clusterOpacity !== false;
|
|
214621
|
+
|
|
214622
|
+
coerce('cluster.enabled', clusterEnabledDflt);
|
|
214623
|
+
|
|
214497
214624
|
if(subTypes.hasText(traceOut)) {
|
|
214498
214625
|
handleTextDefaults(traceIn, traceOut, layout, coerce, {noSelect: true});
|
|
214499
214626
|
}
|
|
@@ -214552,6 +214679,7 @@ var Lib = _dereq_('../../lib');
|
|
|
214552
214679
|
var getTraceColor = _dereq_('../scatter/get_trace_color');
|
|
214553
214680
|
var fillText = Lib.fillText;
|
|
214554
214681
|
var BADNUM = _dereq_('../../constants/numerical').BADNUM;
|
|
214682
|
+
var LAYER_PREFIX = _dereq_('../../plots/mapbox/constants').traceLayerPrefix;
|
|
214555
214683
|
|
|
214556
214684
|
function hoverPoints(pointData, xval, yval) {
|
|
214557
214685
|
var cd = pointData.cd;
|
|
@@ -214559,6 +214687,14 @@ function hoverPoints(pointData, xval, yval) {
|
|
|
214559
214687
|
var xa = pointData.xa;
|
|
214560
214688
|
var ya = pointData.ya;
|
|
214561
214689
|
var subplot = pointData.subplot;
|
|
214690
|
+
var clusteredPointsIds = [];
|
|
214691
|
+
var layer = LAYER_PREFIX + trace.uid + '-circle';
|
|
214692
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
214693
|
+
|
|
214694
|
+
if(hasCluster) {
|
|
214695
|
+
var elems = subplot.map.queryRenderedFeatures(null, {layers: [layer]});
|
|
214696
|
+
clusteredPointsIds = elems.map(function(elem) {return elem.id;});
|
|
214697
|
+
}
|
|
214562
214698
|
|
|
214563
214699
|
// compute winding number about [-180, 180] globe
|
|
214564
214700
|
var winding = (xval >= 0) ?
|
|
@@ -214572,6 +214708,7 @@ function hoverPoints(pointData, xval, yval) {
|
|
|
214572
214708
|
function distFn(d) {
|
|
214573
214709
|
var lonlat = d.lonlat;
|
|
214574
214710
|
if(lonlat[0] === BADNUM) return Infinity;
|
|
214711
|
+
if(hasCluster && clusteredPointsIds.indexOf(d.i + 1) === -1) return Infinity;
|
|
214575
214712
|
|
|
214576
214713
|
var lon = Lib.modHalf(lonlat[0], 360);
|
|
214577
214714
|
var lat = lonlat[1];
|
|
@@ -214652,7 +214789,7 @@ module.exports = {
|
|
|
214652
214789
|
getExtraText: getExtraText
|
|
214653
214790
|
};
|
|
214654
214791
|
|
|
214655
|
-
},{"../../components/fx":407,"../../constants/numerical":491,"../../lib":515,"../scatter/get_trace_color":946}],1008:[function(_dereq_,module,exports){
|
|
214792
|
+
},{"../../components/fx":407,"../../constants/numerical":491,"../../lib":515,"../../plots/mapbox/constants":620,"../scatter/get_trace_color":946}],1008:[function(_dereq_,module,exports){
|
|
214656
214793
|
'use strict';
|
|
214657
214794
|
|
|
214658
214795
|
module.exports = {
|
|
@@ -214684,27 +214821,36 @@ module.exports = {
|
|
|
214684
214821
|
},{"../../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
214822
|
'use strict';
|
|
214686
214823
|
|
|
214824
|
+
var Lib = _dereq_('../../lib');
|
|
214687
214825
|
var convert = _dereq_('./convert');
|
|
214688
214826
|
var LAYER_PREFIX = _dereq_('../../plots/mapbox/constants').traceLayerPrefix;
|
|
214689
|
-
var ORDER =
|
|
214827
|
+
var ORDER = {
|
|
214828
|
+
cluster: ['cluster', 'clusterCount', 'circle'],
|
|
214829
|
+
nonCluster: ['fill', 'line', 'circle', 'symbol'],
|
|
214830
|
+
};
|
|
214690
214831
|
|
|
214691
|
-
function ScatterMapbox(subplot, uid) {
|
|
214832
|
+
function ScatterMapbox(subplot, uid, clusterEnabled) {
|
|
214692
214833
|
this.type = 'scattermapbox';
|
|
214693
214834
|
this.subplot = subplot;
|
|
214694
214835
|
this.uid = uid;
|
|
214836
|
+
this.clusterEnabled = clusterEnabled;
|
|
214695
214837
|
|
|
214696
214838
|
this.sourceIds = {
|
|
214697
214839
|
fill: 'source-' + uid + '-fill',
|
|
214698
214840
|
line: 'source-' + uid + '-line',
|
|
214699
214841
|
circle: 'source-' + uid + '-circle',
|
|
214700
|
-
symbol: 'source-' + uid + '-symbol'
|
|
214842
|
+
symbol: 'source-' + uid + '-symbol',
|
|
214843
|
+
cluster: 'source-' + uid + '-circle',
|
|
214844
|
+
clusterCount: 'source-' + uid + '-circle',
|
|
214701
214845
|
};
|
|
214702
214846
|
|
|
214703
214847
|
this.layerIds = {
|
|
214704
214848
|
fill: LAYER_PREFIX + uid + '-fill',
|
|
214705
214849
|
line: LAYER_PREFIX + uid + '-line',
|
|
214706
214850
|
circle: LAYER_PREFIX + uid + '-circle',
|
|
214707
|
-
symbol: LAYER_PREFIX + uid + '-symbol'
|
|
214851
|
+
symbol: LAYER_PREFIX + uid + '-symbol',
|
|
214852
|
+
cluster: LAYER_PREFIX + uid + '-cluster',
|
|
214853
|
+
clusterCount: LAYER_PREFIX + uid + '-cluster-count',
|
|
214708
214854
|
};
|
|
214709
214855
|
|
|
214710
214856
|
// We could merge the 'fill' source with the 'line' source and
|
|
@@ -214718,11 +214864,20 @@ function ScatterMapbox(subplot, uid) {
|
|
|
214718
214864
|
|
|
214719
214865
|
var proto = ScatterMapbox.prototype;
|
|
214720
214866
|
|
|
214721
|
-
proto.addSource = function(k, opts) {
|
|
214722
|
-
|
|
214867
|
+
proto.addSource = function(k, opts, cluster) {
|
|
214868
|
+
var sourceOpts = {
|
|
214723
214869
|
type: 'geojson',
|
|
214724
|
-
data: opts.geojson
|
|
214725
|
-
}
|
|
214870
|
+
data: opts.geojson,
|
|
214871
|
+
};
|
|
214872
|
+
|
|
214873
|
+
if(cluster && cluster.enabled) {
|
|
214874
|
+
Lib.extendFlat(sourceOpts, {
|
|
214875
|
+
cluster: true,
|
|
214876
|
+
clusterMaxZoom: cluster.maxzoom,
|
|
214877
|
+
});
|
|
214878
|
+
}
|
|
214879
|
+
|
|
214880
|
+
this.subplot.map.addSource(this.sourceIds[k], sourceOpts);
|
|
214726
214881
|
};
|
|
214727
214882
|
|
|
214728
214883
|
proto.setSourceData = function(k, opts) {
|
|
@@ -214732,45 +214887,68 @@ proto.setSourceData = function(k, opts) {
|
|
|
214732
214887
|
};
|
|
214733
214888
|
|
|
214734
214889
|
proto.addLayer = function(k, opts, below) {
|
|
214735
|
-
|
|
214736
|
-
type:
|
|
214890
|
+
var source = {
|
|
214891
|
+
type: opts.type,
|
|
214737
214892
|
id: this.layerIds[k],
|
|
214738
214893
|
source: this.sourceIds[k],
|
|
214739
214894
|
layout: opts.layout,
|
|
214740
|
-
paint: opts.paint
|
|
214741
|
-
}
|
|
214895
|
+
paint: opts.paint,
|
|
214896
|
+
};
|
|
214897
|
+
if(opts.filter) {
|
|
214898
|
+
source.filter = opts.filter;
|
|
214899
|
+
}
|
|
214900
|
+
this.subplot.addLayer(source, below);
|
|
214742
214901
|
};
|
|
214743
214902
|
|
|
214744
214903
|
proto.update = function update(calcTrace) {
|
|
214904
|
+
var trace = calcTrace[0].trace;
|
|
214745
214905
|
var subplot = this.subplot;
|
|
214746
214906
|
var map = subplot.map;
|
|
214747
214907
|
var optsAll = convert(subplot.gd, calcTrace);
|
|
214748
214908
|
var below = subplot.belowLookup['trace-' + this.uid];
|
|
214749
214909
|
var i, k, opts;
|
|
214910
|
+
var hasCluster = !!(trace.cluster && trace.cluster.enabled);
|
|
214911
|
+
var hadCluster = !!this.clusterEnabled;
|
|
214750
214912
|
|
|
214751
214913
|
if(below !== this.below) {
|
|
214752
|
-
|
|
214753
|
-
|
|
214914
|
+
var order = ORDER.nonCluster;
|
|
214915
|
+
|
|
214916
|
+
for(i = order.length - 1; i >= 0; i--) {
|
|
214917
|
+
k = order[i];
|
|
214754
214918
|
map.removeLayer(this.layerIds[k]);
|
|
214755
214919
|
}
|
|
214756
|
-
for(i = 0; i <
|
|
214757
|
-
k =
|
|
214920
|
+
for(i = 0; i < order.length; i++) {
|
|
214921
|
+
k = order[i];
|
|
214758
214922
|
opts = optsAll[k];
|
|
214759
214923
|
this.addLayer(k, opts, below);
|
|
214760
214924
|
}
|
|
214761
214925
|
this.below = below;
|
|
214762
|
-
}
|
|
214763
|
-
|
|
214764
|
-
|
|
214765
|
-
|
|
214766
|
-
|
|
214767
|
-
|
|
214768
|
-
subplot.setOptions(this.layerIds[k], 'setLayoutProperty', opts.layout);
|
|
214769
|
-
|
|
214770
|
-
if(opts.layout.visibility === 'visible') {
|
|
214771
|
-
this.setSourceData(k, opts);
|
|
214772
|
-
subplot.setOptions(this.layerIds[k], 'setPaintProperty', opts.paint);
|
|
214926
|
+
} else if(hasCluster && !hadCluster) {
|
|
214927
|
+
for(i = ORDER.nonCluster.length - 1; i >= 0; i--) {
|
|
214928
|
+
k = ORDER.nonCluster[i];
|
|
214929
|
+
map.removeLayer(this.layerIds[k]);
|
|
214930
|
+
map.removeSource(this.sourceIds[k]);
|
|
214773
214931
|
}
|
|
214932
|
+
this.addSource('circle', optsAll.circle, trace.cluster);
|
|
214933
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
214934
|
+
k = ORDER.cluster[i];
|
|
214935
|
+
opts = optsAll[k];
|
|
214936
|
+
this.addLayer(k, opts, below);
|
|
214937
|
+
}
|
|
214938
|
+
this.clusterEnabled = hasCluster;
|
|
214939
|
+
} else if(!hasCluster && hadCluster) {
|
|
214940
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
214941
|
+
k = ORDER.cluster[i];
|
|
214942
|
+
map.removeLayer(this.layerIds[k]);
|
|
214943
|
+
}
|
|
214944
|
+
map.removeSource(this.sourceIds.circle);
|
|
214945
|
+
for(i = 0; i < ORDER.nonCluster.length; i++) {
|
|
214946
|
+
k = ORDER.nonCluster[i];
|
|
214947
|
+
opts = optsAll[k];
|
|
214948
|
+
this.addSource(k, opts, trace.cluster);
|
|
214949
|
+
this.addLayer(k, opts, below);
|
|
214950
|
+
}
|
|
214951
|
+
this.clusterEnabled = hasCluster;
|
|
214774
214952
|
}
|
|
214775
214953
|
|
|
214776
214954
|
// link ref for quick update during selections
|
|
@@ -214779,9 +214957,9 @@ proto.update = function update(calcTrace) {
|
|
|
214779
214957
|
|
|
214780
214958
|
proto.dispose = function dispose() {
|
|
214781
214959
|
var map = this.subplot.map;
|
|
214782
|
-
|
|
214783
|
-
for(var i =
|
|
214784
|
-
var k =
|
|
214960
|
+
var order = this.clusterEnabled ? ORDER.cluster : ORDER.nonCluster;
|
|
214961
|
+
for(var i = order.length - 1; i >= 0; i--) {
|
|
214962
|
+
var k = order[i];
|
|
214785
214963
|
map.removeLayer(this.layerIds[k]);
|
|
214786
214964
|
map.removeSource(this.sourceIds[k]);
|
|
214787
214965
|
}
|
|
@@ -214789,15 +214967,31 @@ proto.dispose = function dispose() {
|
|
|
214789
214967
|
|
|
214790
214968
|
module.exports = function createScatterMapbox(subplot, calcTrace) {
|
|
214791
214969
|
var trace = calcTrace[0].trace;
|
|
214792
|
-
var
|
|
214970
|
+
var hasCluster = trace.cluster && trace.cluster.enabled;
|
|
214971
|
+
var scatterMapbox = new ScatterMapbox(
|
|
214972
|
+
subplot,
|
|
214973
|
+
trace.uid,
|
|
214974
|
+
hasCluster
|
|
214975
|
+
);
|
|
214976
|
+
|
|
214793
214977
|
var optsAll = convert(subplot.gd, calcTrace);
|
|
214794
214978
|
var below = scatterMapbox.below = subplot.belowLookup['trace-' + trace.uid];
|
|
214979
|
+
var i, k, opts;
|
|
214795
214980
|
|
|
214796
|
-
|
|
214797
|
-
|
|
214798
|
-
|
|
214799
|
-
|
|
214800
|
-
|
|
214981
|
+
if(hasCluster) {
|
|
214982
|
+
scatterMapbox.addSource('circle', optsAll.circle, trace.cluster);
|
|
214983
|
+
for(i = 0; i < ORDER.cluster.length; i++) {
|
|
214984
|
+
k = ORDER.cluster[i];
|
|
214985
|
+
opts = optsAll[k];
|
|
214986
|
+
scatterMapbox.addLayer(k, opts, below);
|
|
214987
|
+
}
|
|
214988
|
+
} else {
|
|
214989
|
+
for(i = 0; i < ORDER.nonCluster.length; i++) {
|
|
214990
|
+
k = ORDER.nonCluster[i];
|
|
214991
|
+
opts = optsAll[k];
|
|
214992
|
+
scatterMapbox.addSource(k, opts, trace.cluster);
|
|
214993
|
+
scatterMapbox.addLayer(k, opts, below);
|
|
214994
|
+
}
|
|
214801
214995
|
}
|
|
214802
214996
|
|
|
214803
214997
|
// link ref for quick update during selections
|
|
@@ -214806,7 +215000,7 @@ module.exports = function createScatterMapbox(subplot, calcTrace) {
|
|
|
214806
215000
|
return scatterMapbox;
|
|
214807
215001
|
};
|
|
214808
215002
|
|
|
214809
|
-
},{"../../plots/mapbox/constants":620,"./convert":1003}],1010:[function(_dereq_,module,exports){
|
|
215003
|
+
},{"../../lib":515,"../../plots/mapbox/constants":620,"./convert":1003}],1010:[function(_dereq_,module,exports){
|
|
214810
215004
|
'use strict';
|
|
214811
215005
|
|
|
214812
215006
|
var Lib = _dereq_('../../lib');
|
|
@@ -227170,7 +227364,7 @@ function getSortFunc(opts, d2c) {
|
|
|
227170
227364
|
'use strict';
|
|
227171
227365
|
|
|
227172
227366
|
// package version injected by `npm run preprocess`
|
|
227173
|
-
exports.version = '2.
|
|
227367
|
+
exports.version = '2.16.1';
|
|
227174
227368
|
|
|
227175
227369
|
},{}],1133:[function(_dereq_,module,exports){
|
|
227176
227370
|
(function (global){(function (){
|