@vizabi/bubblechart 5.5.0 → 5.5.2

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.
@@ -1,4 +1,4 @@
1
- // https://github.com/vizabi/bubblechart#readme v5.5.0 build 1764365872039 Copyright 2025 Gapminder Foundation and contributors
1
+ // https://github.com/vizabi/bubblechart#readme v5.5.2 build 1765875954936 Copyright 2025 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) :
@@ -2700,7 +2700,7 @@ void main(void) {
2700
2700
  requestAnimationFrame(() => {
2701
2701
  this.redrawUpdateTrigger++;
2702
2702
  this.__labelData = this.__newLabelData;
2703
- this.deckBubble.setProps({layers: this.getBubbleLayers(this.__data, true, this.duration + this.perfDataStart - performance.now(), undefined, this.__newLastLineTrailData)});
2703
+ this.deckBubble.setProps({layers: this.getBubbleLayers(this.__data, true, this.duration + (this.perfDataStart - performance.now()) * 0.85, undefined, this.__newLastLineTrailData)});
2704
2704
  this.__trailsData = this.__newTrailsData;
2705
2705
  //_updateRangesLine = _newUpdateRangesLine;
2706
2706
  });
@@ -3265,28 +3265,35 @@ void main(void) {
3265
3265
 
3266
3266
  getProps() {
3267
3267
  return {
3268
- getSourcePosition: (d) => {
3268
+ getSourcePosition: (d, { target }) => {
3269
3269
  if (!d) return;
3270
- //console.log("src", d, d.KEY, d.uz ? d.uz : this.zScale(d.z*1.01), this.zScale(d.z*1.01));
3271
- return [this.xScale(d.x), this.yScale(d.y), d.uz ? d.uz : this.zScale(d.z*1.01)]
3270
+ target[0] = this.xScale(d.x);
3271
+ target[1] = this.yScale(d.y);
3272
+ target[2] = d.uz ? d.uz : this.zScale(d.z*1.01);
3273
+ return target;
3272
3274
  },
3273
- getTargetPosition: (_d, { data, index }) => {
3274
- //console.log("trgt", _d, data[index + 1]);
3275
+ getTargetPosition: (_d, { data, index, target }) => {
3275
3276
  if (!_d) return;
3276
3277
  const d = _d[TRAIL_KEY] ? data[index + 1] ? data[index + 1] : _d : _d;
3277
3278
  if (!d) return;
3278
- //console.log("trgt", d, d.KEY, d.uz ? d.uz : this.zScale(d.z*1.01), this.zScale(d.z*1.01));
3279
- return [this.xScale(d.x), this.yScale(d.y), d.uz ? d.uz : this.zScale(d.z*1.01)]
3279
+ target[0] = this.xScale(d.x);
3280
+ target[1] = this.yScale(d.y);
3281
+ target[2] = d.uz ? d.uz : this.zScale(d.z*1.01);
3282
+ return target;
3280
3283
  },
3281
- getLastLineSourcePosition: (d) => {
3282
- //console.log("src",d);
3284
+ getLastLineSourcePosition: (d, { target }) => {
3283
3285
  if (!d) return;
3284
- return [this.xScale(d[0].x), this.yScale(d[0].y), this.zScale(d[0].z*1.01)]
3286
+ target[0] = this.xScale(d[0].x);
3287
+ target[1] = this.yScale(d[0].y);
3288
+ target[2] = this.zScale(d[0].z*1.01);
3289
+ return target;
3285
3290
  },
3286
- getLastLineTargetPosition: (d) => {
3287
- //console.log("trgt", _d, data[index + 1]);
3291
+ getLastLineTargetPosition: (d, { target }) => {
3288
3292
  if (!d) return;
3289
- return [this.xScale(d[1].x), this.yScale(d[1].y), this.zScale(d[1].z*1.01)]
3293
+ target[0] = this.xScale(d[1].x);
3294
+ target[1] = this.yScale(d[1].y);
3295
+ target[2] = this.zScale(d[1].z*1.01);
3296
+ return target;
3290
3297
  },
3291
3298
  getLabelText: (d) => {
3292
3299
  if (!d) return;
@@ -3342,7 +3349,7 @@ void main(void) {
3342
3349
 
3343
3350
  //adjust label offset if label with current offset located outside of vieport
3344
3351
  const offset = this.labelOffset[key];
3345
- const pPos = viewport.project(this.props.getPosition(d).slice(0,2));
3352
+ const pPos = viewport.project(this.props.getPosition(d, { target: [] }).slice(0,2));
3346
3353
  const vW = viewport.width;
3347
3354
  const vH = viewport.height;
3348
3355
  const [lW, lH] = sourceLayer.parent.state.labelSize;
@@ -3371,7 +3378,7 @@ void main(void) {
3371
3378
  offset[1] = vH - lPaddB - pPos[1];
3372
3379
  }
3373
3380
 
3374
- console.log("offset", offset, "point", pPos, lW, lH, viewport);
3381
+ //console.log("offset", offset, "point", pPos, lW, lH, viewport);
3375
3382
  this.dragX0 = this.labelOffset[key][0] - x;
3376
3383
  this.dragY0 = this.labelOffset[key][1] - y;
3377
3384
  //this.deckBubble.setProps({layers: this.getBubbleLayers(undefined, false, 0, false), controller: { dragPan: dragFlag }});
@@ -3385,7 +3392,6 @@ void main(void) {
3385
3392
  const key = d[TRAIL_KEY] || d[KEY];
3386
3393
  this.labelOffset[key][0] = this.dragX;
3387
3394
  this.labelOffset[key][1] = this.dragY;
3388
- this.props.getPosition(d).slice(0,2);
3389
3395
  //console.log("offset", this.labelOffset[key], "point", sourceLayer.project(pos), viewport.getBounds(), viewport);
3390
3396
  this.deckBubble.setProps({layers: this.getBubbleLayers(undefined, false, 0, false),}); //views: this.getViews({ dragPan: dragFlag }),});
3391
3397
  return true;
@@ -3427,25 +3433,25 @@ void main(void) {
3427
3433
  const offsetY = this.labelOffset[key] && this.labelOffset[key][1] || 0;
3428
3434
  return [offsetX || 0, -offsetY || 0];
3429
3435
  },
3430
- getPosition: (d) => {
3436
+ getPosition: (d, { target }) => {
3431
3437
  if (!d) return;
3432
- //let zHover = 0;
3433
- // if (this.activeObject && this.activeObject[KEY] == d[KEY]) {
3434
- //zHover = -0.05;
3435
- //console.log("zHover", zHover, d, this.activeObject)
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)]
3438
+ target[0] = this.xScale(d.x);
3439
+ target[1] = this.yScale(d.y);
3440
+ target[2] = d.uz ? d.uz : this.zScale(d.size);
3441
+ return target;
3440
3442
  },
3441
- getPositionHighlight: (d) => {
3443
+ getPositionHighlight: (d, { target }) => {
3442
3444
  if (!d) return;
3443
- return [this.xScale(d.x), this.yScale(d.y), -0.095];
3445
+ target[0] = this.xScale(d.x);
3446
+ target[1] = this.yScale(d.y);
3447
+ target[2] = -0.095;
3448
+ return target;
3444
3449
  },
3445
- getPositionXY: (d) => {
3450
+ getPositionXY: (d, { target }) => {
3446
3451
  if (!d) return;
3447
- //console.log(d[KEY],this.xScale(d.x), this.yScale(d.y), d.uz ? d.uz : this.zScale(d.size))
3448
- return [this.xScale(d.x), this.yScale(d.y)]
3452
+ target[0] = this.xScale(d.x);
3453
+ target[1] = this.yScale(d.y);
3454
+ return target;
3449
3455
  },
3450
3456
 
3451
3457
  getFillColor: (d, { target }) => {
@@ -3636,6 +3642,7 @@ void main(void) {
3636
3642
  // console.log("_datediff line", newData, oldData, _updateRangesLine);
3637
3643
  // return dataDiff ? playing ? _updateRangesLine : null : null;
3638
3644
  //}
3645
+ visible: this.MDL.trail.show
3639
3646
  }),
3640
3647
  new layers.LineLayer({
3641
3648
  id: 'lastLineLayer',
@@ -3658,6 +3665,7 @@ void main(void) {
3658
3665
  // console.log("_datediff line", newData, oldData, _updateRangesLine);
3659
3666
  // return dataDiff ? playing ? _updateRangesLine : null : null;
3660
3667
  //}
3668
+ visible: this.MDL.trail.show
3661
3669
  }),
3662
3670
  new layers.ScatterplotLayer({
3663
3671
  parameters: {depthTest: false},
@@ -3684,12 +3692,6 @@ void main(void) {
3684
3692
  transitions: t ? {
3685
3693
  getPosition: {
3686
3694
  duration,
3687
- onStart: (e) => {
3688
- console.log("start", e);
3689
- },
3690
- onEnd: (e) => {
3691
- console.log("end", e);
3692
- }
3693
3695
  },
3694
3696
  getRadius: {
3695
3697
  duration,
@@ -3829,7 +3831,7 @@ void main(void) {
3829
3831
  //}
3830
3832
  }),*/
3831
3833
 
3832
- this.ui.labels.enabled && new LabelLayer({
3834
+ this.ui.labels.enabled && this.__someSelected && new LabelLayer({
3833
3835
  //parameters: {depthTest: false},
3834
3836
  id: 'labelTextLayer',
3835
3837
  _subLayerProps: {
@@ -3903,7 +3905,8 @@ void main(void) {
3903
3905
  getLineSourceFillOffset: {
3904
3906
  duration,
3905
3907
  }
3906
- } : null
3908
+ } : null,
3909
+ visible: this.__someSelected
3907
3910
  }),
3908
3911
  ]
3909
3912
  }
@@ -4224,18 +4227,28 @@ void main(void) {
4224
4227
  }
4225
4228
  //"scale": { "ref": "markers.bubble.encoding.color.scale" }
4226
4229
  },
4227
- "name": { "data": { } },
4230
+ "name": {
4231
+ "data": {
4232
+ "concept": {"filter": { "concept": { "$in": ["name"]} } }
4233
+ }
4234
+ },
4228
4235
  "order": {
4229
4236
  "modelType": "order",
4230
4237
  "direction": "asc",
4231
- "data": { }
4238
+ "data": {
4239
+ "concept": {"filter": { "concept": { "$in": ["rank"]} } }
4240
+ }
4232
4241
  },
4233
- "map": { "data": { } }
4242
+ "map": {
4243
+ "data": {
4244
+ "concept": {"filter": { "concept": { "$in": ["shape_lores_svg", "shape", "svg"]} } }
4245
+ }
4246
+ }
4234
4247
  }
4235
4248
  },
4236
4249
  };
4237
4250
 
4238
- BubbleChart.versionInfo = { version: "5.5.0", build: 1764365872039, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
4251
+ BubbleChart.versionInfo = { version: "5.5.2", build: 1765875954936, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
4239
4252
 
4240
4253
  exports.Base = BubbleChart;
4241
4254