@vizabi/bubblechart 5.5.1 → 5.5.3
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/build/bubblechart.js +58 -47
- package/build/bubblechart.js.map +1 -1
- package/build/stats.html +1 -1
- package/package.json +1 -1
package/build/bubblechart.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// https://github.com/vizabi/bubblechart#readme v5.5.
|
|
1
|
+
// https://github.com/vizabi/bubblechart#readme v5.5.3 build 1768916445428 Copyright 2026 Gapminder Foundation and contributors
|
|
2
2
|
(function (global, factory) {
|
|
3
3
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@vizabi/shared-components'), require('d3'), require('mobx'), require('@deck.gl/core'), require('@deck.gl/layers')) :
|
|
4
4
|
typeof define === 'function' && define.amd ? define(['exports', '@vizabi/shared-components', 'd3', 'mobx', '@deck.gl/core', '@deck.gl/layers'], factory) :
|
|
@@ -2156,6 +2156,7 @@ void main(void) {
|
|
|
2156
2156
|
this.dragX;
|
|
2157
2157
|
this.dragY;
|
|
2158
2158
|
this.redrawUpdateTrigger = 0;
|
|
2159
|
+
this.lastLineRedrawUpdateTrigger = 0;
|
|
2159
2160
|
this.opacityUpdateTrigger = 0;
|
|
2160
2161
|
}
|
|
2161
2162
|
|
|
@@ -2695,12 +2696,12 @@ void main(void) {
|
|
|
2695
2696
|
//requestAnimationFrame(() => {
|
|
2696
2697
|
this.deckBubble.setProps({layers: this.getBubbleLayers(this.__oldData, false, 0, undefined, this.__lastLineTrailData)});
|
|
2697
2698
|
requestAnimationFrame(() => {
|
|
2698
|
-
this.
|
|
2699
|
+
this.lastLineRedrawUpdateTrigger++;
|
|
2699
2700
|
this.deckBubble.setProps({layers: this.getBubbleLayers(this.__oldData, true, 0.001, undefined, this.__lastLineTrailData)});
|
|
2700
2701
|
requestAnimationFrame(() => {
|
|
2701
2702
|
this.redrawUpdateTrigger++;
|
|
2702
2703
|
this.__labelData = this.__newLabelData;
|
|
2703
|
-
this.deckBubble.setProps({layers: this.getBubbleLayers(this.__data, true, this.duration + this.perfDataStart - performance.now(), undefined, this.__newLastLineTrailData)});
|
|
2704
|
+
this.deckBubble.setProps({layers: this.getBubbleLayers(this.__data, true, this.duration + (this.perfDataStart - performance.now()) * 0.85, undefined, this.__newLastLineTrailData)});
|
|
2704
2705
|
this.__trailsData = this.__newTrailsData;
|
|
2705
2706
|
//_updateRangesLine = _newUpdateRangesLine;
|
|
2706
2707
|
});
|
|
@@ -2788,8 +2789,6 @@ void main(void) {
|
|
|
2788
2789
|
return true;
|
|
2789
2790
|
});
|
|
2790
2791
|
|
|
2791
|
-
this.labelZScale = d3.scaleLinear([0, selectedData.size - 1],[-0.09, -0.05]);
|
|
2792
|
-
|
|
2793
2792
|
if (newTrailsData.length) {
|
|
2794
2793
|
newTrailsData.forEach(d => {
|
|
2795
2794
|
if (!d[TRAIL_KEY]) return;
|
|
@@ -2855,8 +2854,16 @@ void main(void) {
|
|
|
2855
2854
|
} = this.profileConstants;
|
|
2856
2855
|
|
|
2857
2856
|
//transfer min max radius to size dialog via root ui observable (probably a cleaner way is possible)
|
|
2858
|
-
this.root.ui.minMaxRadius
|
|
2859
|
-
|
|
2857
|
+
if (this.root.ui.minMaxRadius) {
|
|
2858
|
+
this.root.ui.minMaxRadius.min = minRadiusPx;
|
|
2859
|
+
this.root.ui.minMaxRadius.max = maxRadiusPx;
|
|
2860
|
+
} else {
|
|
2861
|
+
this.root.ui.minMaxRadius = {
|
|
2862
|
+
min: minRadiusPx,
|
|
2863
|
+
max: maxRadiusPx
|
|
2864
|
+
};
|
|
2865
|
+
}
|
|
2866
|
+
|
|
2860
2867
|
const extent = this.MDL.size.scale.extent || [0, 1];
|
|
2861
2868
|
|
|
2862
2869
|
let minArea = sharedComponents.LegacyUtils.radiusToArea(Math.max(maxRadiusPx * extent[0], minRadiusPx));
|
|
@@ -2899,6 +2906,7 @@ void main(void) {
|
|
|
2899
2906
|
this.__selectedMarkers = new Map(selectedFilter.markers);
|
|
2900
2907
|
this.__selectedKeys = [...this.__selectedMarkers.keys()];
|
|
2901
2908
|
|
|
2909
|
+
this.labelZScale = d3.scaleLinear([0, this.__selectedKeys.length - 1],[-0.09, -0.05]);
|
|
2902
2910
|
|
|
2903
2911
|
Object.keys(this.labelOffset).forEach(key => {
|
|
2904
2912
|
if (!this.__selectedMarkers.has(key)) delete this.labelOffset[key];
|
|
@@ -3265,28 +3273,35 @@ void main(void) {
|
|
|
3265
3273
|
|
|
3266
3274
|
getProps() {
|
|
3267
3275
|
return {
|
|
3268
|
-
getSourcePosition: (d) => {
|
|
3276
|
+
getSourcePosition: (d, { target }) => {
|
|
3269
3277
|
if (!d) return;
|
|
3270
|
-
|
|
3271
|
-
|
|
3278
|
+
target[0] = this.xScale(d.x);
|
|
3279
|
+
target[1] = this.yScale(d.y);
|
|
3280
|
+
target[2] = d.uz ? d.uz : this.zScale(d.z*1.01);
|
|
3281
|
+
return target;
|
|
3272
3282
|
},
|
|
3273
|
-
getTargetPosition: (_d, { data, index }) => {
|
|
3274
|
-
//console.log("trgt", _d, data[index + 1]);
|
|
3283
|
+
getTargetPosition: (_d, { data, index, target }) => {
|
|
3275
3284
|
if (!_d) return;
|
|
3276
3285
|
const d = _d[TRAIL_KEY] ? data[index + 1] ? data[index + 1] : _d : _d;
|
|
3277
3286
|
if (!d) return;
|
|
3278
|
-
|
|
3279
|
-
|
|
3287
|
+
target[0] = this.xScale(d.x);
|
|
3288
|
+
target[1] = this.yScale(d.y);
|
|
3289
|
+
target[2] = d.uz ? d.uz : this.zScale(d.z*1.01);
|
|
3290
|
+
return target;
|
|
3280
3291
|
},
|
|
3281
|
-
getLastLineSourcePosition: (d) => {
|
|
3282
|
-
//console.log("src",d);
|
|
3292
|
+
getLastLineSourcePosition: (d, { target }) => {
|
|
3283
3293
|
if (!d) return;
|
|
3284
|
-
|
|
3294
|
+
target[0] = this.xScale(d[0].x);
|
|
3295
|
+
target[1] = this.yScale(d[0].y);
|
|
3296
|
+
target[2] = this.zScale(d[0].z*1.01);
|
|
3297
|
+
return target;
|
|
3285
3298
|
},
|
|
3286
|
-
getLastLineTargetPosition: (d) => {
|
|
3287
|
-
//console.log("trgt", _d, data[index + 1]);
|
|
3299
|
+
getLastLineTargetPosition: (d, { target }) => {
|
|
3288
3300
|
if (!d) return;
|
|
3289
|
-
|
|
3301
|
+
target[0] = this.xScale(d[1].x);
|
|
3302
|
+
target[1] = this.yScale(d[1].y);
|
|
3303
|
+
target[2] = this.zScale(d[1].z*1.01);
|
|
3304
|
+
return target;
|
|
3290
3305
|
},
|
|
3291
3306
|
getLabelText: (d) => {
|
|
3292
3307
|
if (!d) return;
|
|
@@ -3342,7 +3357,7 @@ void main(void) {
|
|
|
3342
3357
|
|
|
3343
3358
|
//adjust label offset if label with current offset located outside of vieport
|
|
3344
3359
|
const offset = this.labelOffset[key];
|
|
3345
|
-
const pPos = viewport.project(this.props.getPosition(d).slice(0,2));
|
|
3360
|
+
const pPos = viewport.project(this.props.getPosition(d, { target: [] }).slice(0,2));
|
|
3346
3361
|
const vW = viewport.width;
|
|
3347
3362
|
const vH = viewport.height;
|
|
3348
3363
|
const [lW, lH] = sourceLayer.parent.state.labelSize;
|
|
@@ -3371,7 +3386,7 @@ void main(void) {
|
|
|
3371
3386
|
offset[1] = vH - lPaddB - pPos[1];
|
|
3372
3387
|
}
|
|
3373
3388
|
|
|
3374
|
-
console.log("offset", offset, "point", pPos, lW, lH, viewport);
|
|
3389
|
+
//console.log("offset", offset, "point", pPos, lW, lH, viewport);
|
|
3375
3390
|
this.dragX0 = this.labelOffset[key][0] - x;
|
|
3376
3391
|
this.dragY0 = this.labelOffset[key][1] - y;
|
|
3377
3392
|
//this.deckBubble.setProps({layers: this.getBubbleLayers(undefined, false, 0, false), controller: { dragPan: dragFlag }});
|
|
@@ -3385,7 +3400,6 @@ void main(void) {
|
|
|
3385
3400
|
const key = d[TRAIL_KEY] || d[KEY];
|
|
3386
3401
|
this.labelOffset[key][0] = this.dragX;
|
|
3387
3402
|
this.labelOffset[key][1] = this.dragY;
|
|
3388
|
-
this.props.getPosition(d).slice(0,2);
|
|
3389
3403
|
//console.log("offset", this.labelOffset[key], "point", sourceLayer.project(pos), viewport.getBounds(), viewport);
|
|
3390
3404
|
this.deckBubble.setProps({layers: this.getBubbleLayers(undefined, false, 0, false),}); //views: this.getViews({ dragPan: dragFlag }),});
|
|
3391
3405
|
return true;
|
|
@@ -3427,25 +3441,25 @@ void main(void) {
|
|
|
3427
3441
|
const offsetY = this.labelOffset[key] && this.labelOffset[key][1] || 0;
|
|
3428
3442
|
return [offsetX || 0, -offsetY || 0];
|
|
3429
3443
|
},
|
|
3430
|
-
getPosition: (d) => {
|
|
3444
|
+
getPosition: (d, { target }) => {
|
|
3431
3445
|
if (!d) return;
|
|
3432
|
-
|
|
3433
|
-
|
|
3434
|
-
|
|
3435
|
-
|
|
3436
|
-
// }
|
|
3437
|
-
//console.log(d[KEY],this.xScale(d.x), this.yScale(d.y), d.uz ? d.uz : this.zScale(d.size))
|
|
3438
|
-
//return [this.xScale(d.x), this.yScale(d.y), d.uz ? d.uz : this.zScale(d.size)]
|
|
3439
|
-
return [this.xScale(d.x), this.yScale(d.y), d.uz ? d.uz : this.zScale(d.size)]
|
|
3446
|
+
target[0] = this.xScale(d.x);
|
|
3447
|
+
target[1] = this.yScale(d.y);
|
|
3448
|
+
target[2] = d.uz ? d.uz : this.zScale(d.size);
|
|
3449
|
+
return target;
|
|
3440
3450
|
},
|
|
3441
|
-
getPositionHighlight: (d) => {
|
|
3451
|
+
getPositionHighlight: (d, { target }) => {
|
|
3442
3452
|
if (!d) return;
|
|
3443
|
-
|
|
3453
|
+
target[0] = this.xScale(d.x);
|
|
3454
|
+
target[1] = this.yScale(d.y);
|
|
3455
|
+
target[2] = -0.095;
|
|
3456
|
+
return target;
|
|
3444
3457
|
},
|
|
3445
|
-
getPositionXY: (d) => {
|
|
3458
|
+
getPositionXY: (d, { target }) => {
|
|
3446
3459
|
if (!d) return;
|
|
3447
|
-
|
|
3448
|
-
|
|
3460
|
+
target[0] = this.xScale(d.x);
|
|
3461
|
+
target[1] = this.yScale(d.y);
|
|
3462
|
+
return target;
|
|
3449
3463
|
},
|
|
3450
3464
|
|
|
3451
3465
|
getFillColor: (d, { target }) => {
|
|
@@ -3636,6 +3650,7 @@ void main(void) {
|
|
|
3636
3650
|
// console.log("_datediff line", newData, oldData, _updateRangesLine);
|
|
3637
3651
|
// return dataDiff ? playing ? _updateRangesLine : null : null;
|
|
3638
3652
|
//}
|
|
3653
|
+
visible: this.MDL.trail.show
|
|
3639
3654
|
}),
|
|
3640
3655
|
new layers.LineLayer({
|
|
3641
3656
|
id: 'lastLineLayer',
|
|
@@ -3646,7 +3661,7 @@ void main(void) {
|
|
|
3646
3661
|
getWidth: this.props.getLastTrailLineWidth,
|
|
3647
3662
|
updateTriggers: {
|
|
3648
3663
|
getColor: [this.activeObject, this.opacityUpdateTrigger],
|
|
3649
|
-
getTargetPosition: [this.redrawUpdateTrigger]
|
|
3664
|
+
getTargetPosition: [this.redrawUpdateTrigger, this.lastLineRedrawUpdateTrigger]
|
|
3650
3665
|
},
|
|
3651
3666
|
transitions: t ? {
|
|
3652
3667
|
getTargetPosition: {
|
|
@@ -3658,6 +3673,7 @@ void main(void) {
|
|
|
3658
3673
|
// console.log("_datediff line", newData, oldData, _updateRangesLine);
|
|
3659
3674
|
// return dataDiff ? playing ? _updateRangesLine : null : null;
|
|
3660
3675
|
//}
|
|
3676
|
+
visible: this.MDL.trail.show
|
|
3661
3677
|
}),
|
|
3662
3678
|
new layers.ScatterplotLayer({
|
|
3663
3679
|
parameters: {depthTest: false},
|
|
@@ -3684,12 +3700,6 @@ void main(void) {
|
|
|
3684
3700
|
transitions: t ? {
|
|
3685
3701
|
getPosition: {
|
|
3686
3702
|
duration,
|
|
3687
|
-
onStart: (e) => {
|
|
3688
|
-
console.log("start", e);
|
|
3689
|
-
},
|
|
3690
|
-
onEnd: (e) => {
|
|
3691
|
-
console.log("end", e);
|
|
3692
|
-
}
|
|
3693
3703
|
},
|
|
3694
3704
|
getRadius: {
|
|
3695
3705
|
duration,
|
|
@@ -3829,7 +3839,7 @@ void main(void) {
|
|
|
3829
3839
|
//}
|
|
3830
3840
|
}),*/
|
|
3831
3841
|
|
|
3832
|
-
this.ui.labels.enabled && new LabelLayer({
|
|
3842
|
+
this.ui.labels.enabled && this.__someSelected && new LabelLayer({
|
|
3833
3843
|
//parameters: {depthTest: false},
|
|
3834
3844
|
id: 'labelTextLayer',
|
|
3835
3845
|
_subLayerProps: {
|
|
@@ -3903,7 +3913,8 @@ void main(void) {
|
|
|
3903
3913
|
getLineSourceFillOffset: {
|
|
3904
3914
|
duration,
|
|
3905
3915
|
}
|
|
3906
|
-
} : null
|
|
3916
|
+
} : null,
|
|
3917
|
+
visible: this.__someSelected
|
|
3907
3918
|
}),
|
|
3908
3919
|
]
|
|
3909
3920
|
}
|
|
@@ -4245,7 +4256,7 @@ void main(void) {
|
|
|
4245
4256
|
},
|
|
4246
4257
|
};
|
|
4247
4258
|
|
|
4248
|
-
BubbleChart.versionInfo = { version: "5.5.
|
|
4259
|
+
BubbleChart.versionInfo = { version: "5.5.3", build: 1768916445428, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
|
|
4249
4260
|
|
|
4250
4261
|
exports.Base = BubbleChart;
|
|
4251
4262
|
|