@vizabi/bubblechart 5.1.0 → 5.2.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.
@@ -1,4 +1,4 @@
1
- // https://github.com/vizabi/bubblechart#readme v5.1.0 build 1743007947150 Copyright 2025 Gapminder Foundation and contributors
1
+ // https://github.com/vizabi/bubblechart#readme v5.2.1 build 1746462563188 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')) :
4
4
  typeof define === 'function' && define.amd ? define(['exports', '@vizabi/shared-components', 'd3', 'mobx'], factory) :
@@ -44082,6 +44082,7 @@ void main(void) {
44082
44082
  getSourcePosition: this.props.transitions?.getPosition,
44083
44083
  getTargetPosition: this.props.transitions?.getPosition,
44084
44084
  getTargetPixelOffset: this.props.transitions?.getPosition,
44085
+ getSourceDashOffset: this.props.transitions?.getPosition
44085
44086
  }
44086
44087
  //pickable: true,
44087
44088
  //_dataDiff: (newData, oldData) => {
@@ -44189,6 +44190,7 @@ void main(void) {
44189
44190
  const KEY = Symbol.for("key");
44190
44191
  const TRAIL_KEY = Symbol.for("trailHeadKey");
44191
44192
  const OPACITY_KEY = Symbol.for("opacity");
44193
+ const REQUIRED_KEY = Symbol.for("bubbleRequired");
44192
44194
 
44193
44195
  const marginScaleH = (marginMin, ratio = 0) => height => marginMin + height * ratio;
44194
44196
  const marginScaleW = (marginMin, ratio = 0) => width => marginMin + width * ratio;
@@ -44923,34 +44925,42 @@ void main(void) {
44923
44925
  newTrailsData.length += trailsCount;
44924
44926
  dataTrailChunkIndex = res.length;
44925
44927
  res.length += trailsCount;
44926
- selectedData.set(d[TRAIL_KEY], Object.assign({}, d));
44927
44928
  trailChunkIndex1 = trailChunkIndex + 1;
44928
44929
  }
44929
- newTrailsData[trailChunkIndex++] = d;
44930
- res[dataTrailChunkIndex++] = d;
44930
+ if (!d[REQUIRED_KEY]) {
44931
+ newTrailsData[trailChunkIndex++] = d;
44932
+ res[dataTrailChunkIndex++] = d;
44933
+ if (!selectedData.has(d[TRAIL_KEY])) selectedData.set(d[TRAIL_KEY], Object.assign({}, d));
44934
+ }
44931
44935
  } else {
44932
44936
  if (currentTrailKey) {
44933
44937
  trailsZ[currentTrailKey] = d.size;//d.z
44934
44938
  //newTrailsData[trailChunkIndex] = Object.assign({}, newTrailsData[trailChunkIndex - 1]);
44935
- newTrailsData.fill(d, trailChunkIndex, newTrailsData.length);
44936
44939
  //_newUpdateRangesLine.push({startRow: trailChunkIndex - 2, endRow: trailChunkIndex});
44937
44940
  //newTrailsData[trailChunkIndex - 1] = d;
44938
- indexOffset = trailChunkIndex == trailChunkIndex1 ? 1 : 2;
44939
- lastLineTrailData.push([newTrailsData[trailChunkIndex - indexOffset], newTrailsData[trailChunkIndex - indexOffset]]);
44940
- newLastLineTrailData.push([newTrailsData[trailChunkIndex - indexOffset], d]);
44941
+ if(!d[REQUIRED_KEY]) {
44942
+ newTrailsData.fill(d, trailChunkIndex, newTrailsData.length);
44943
+ indexOffset = trailChunkIndex == trailChunkIndex1 ? 1 : 2;
44944
+ lastLineTrailData.push([newTrailsData[trailChunkIndex - indexOffset], newTrailsData[trailChunkIndex - indexOffset]]);
44945
+ newLastLineTrailData.push([newTrailsData[trailChunkIndex - indexOffset], d]);
44946
+ res.fill(Object.assign({uz: -15000}, res[dataTrailChunkIndex - 1]), dataTrailChunkIndex, res.length - 1);
44947
+ res[res.length - 1] = d;
44948
+ } else {
44949
+ res.fill(Object.assign({uz: -15000}, res[dataTrailChunkIndex - 1]), dataTrailChunkIndex, res.length - 1);
44950
+ res.length--;
44951
+ }
44941
44952
  trailChunkIndex = newTrailsData.length;
44942
- res.fill(Object.assign({uz: -15000}, res[dataTrailChunkIndex - 1]), dataTrailChunkIndex, res.length - 1);
44943
- res[res.length - 1] = d;
44944
44953
  currentTrailKey = null;
44945
44954
  } else {
44946
- res.push(d);
44955
+ if(!d[REQUIRED_KEY]) res.push(d);
44947
44956
  }
44948
44957
  }
44949
44958
  return res;
44950
44959
 
44951
- }, []) : this.model.dataArray.map(d => {
44960
+ }, []) : this.model.dataArray.filter(d => {
44961
+ if (d[REQUIRED_KEY]) return false;
44952
44962
  d.r = sharedComponents.LegacyUtils.areaToRadius(this.sScale(d.size || 0));
44953
- return d;
44963
+ return true;
44954
44964
  });
44955
44965
 
44956
44966
  this.labelZScale = d3.scaleLinear([0, selectedData.size - 1],[-0.09, -0.05]);
@@ -44964,9 +44974,9 @@ void main(void) {
44964
44974
 
44965
44975
  //console.log("__data", this.model.dataArray, this.__data, newData, this.__trailsData, newTrailsData);
44966
44976
 
44967
- this.__newLabelData = trailsShowAndSomeSelected ? this.__selectedKeys.map(key => selectedData.get(key) || this.model.dataMap.get(key)).filter(d => d && true)
44977
+ this.__newLabelData = trailsShowAndSomeSelected ? this.__selectedKeys.map(key => selectedData.get(key) || this.model.dataMap.get(key)).filter(d => d && !d[REQUIRED_KEY])
44968
44978
  :
44969
- this.__selectedKeys.map(key => this.model.dataMap.get(key)).filter(d => d && true);
44979
+ this.__selectedKeys.map(key => this.model.dataMap.get(key)).filter(d => d && !d[REQUIRED_KEY]);
44970
44980
 
44971
44981
  if (this.__selectedKeys.length > this.__newLabelData.length) {
44972
44982
  const labelKeys = this.__newLabelData.map(d => d[TRAIL_KEY] || d[KEY]);
@@ -45050,7 +45060,8 @@ void main(void) {
45050
45060
 
45051
45061
  this.__someHighlighted = highlightedFilter.any();
45052
45062
  this.__highlightedMarkers = new Map(highlightedFilter.markers);
45053
- this.activeObject = this.__highlightedMarkers.size == 1 ? Object.assign({}, this.model.dataMap.get(this.__highlightedMarkers.keys().next().value)) : null;
45063
+ const activeObject = this.__highlightedMarkers.size == 1 ? Object.assign({}, this.model.dataMap.get(this.__highlightedMarkers.keys().next().value)) : null;
45064
+ this.activeObject = activeObject?.[REQUIRED_KEY] ? null : activeObject;
45054
45065
  this.activeObjectData = this.activeObject ? [this.activeObject] : [];
45055
45066
  this.opacityUpdateTrigger++;
45056
45067
  this.deckBubble.setProps({layers: this.getBubbleLayers(undefined, false)});
@@ -45073,7 +45084,7 @@ void main(void) {
45073
45084
 
45074
45085
  mobx.runInAction(() => {
45075
45086
  if (!this.MDL.trail.show) {
45076
- this.__labelData = this.__selectedKeys.map(key => this.model.dataMap.get(key));
45087
+ this.__labelData = this.__selectedKeys.map(key => this.model.dataMap.get(key)).filter(d => d && !d[REQUIRED_KEY]);
45077
45088
  this.opacityUpdateTrigger++;
45078
45089
  this.deckBubble.setProps({layers: this.getBubbleLayers(undefined, false)});
45079
45090
  }
@@ -45199,10 +45210,10 @@ void main(void) {
45199
45210
  //const trailShow = this.MDL.trail.show;
45200
45211
  //const trailStarts = this.MDL.trail.starts;
45201
45212
  //const trailGroupDim = this.MDL.trail.groupDim;
45213
+ const d = this.activeObject;
45202
45214
 
45203
- if (highlightedFilter.markers.size === 1) {
45215
+ if (highlightedFilter.markers.size === 1 && d && !d[REQUIRED_KEY]) {
45204
45216
  highlightedFilter.markers.keys().next().value;
45205
- const d = this.activeObject;
45206
45217
  //Object.assign(this.model.dataMap.get(highlightedKey));
45207
45218
  const selectedKey = d[TRAIL_KEY] || d[KEY];
45208
45219
 
@@ -45280,6 +45291,7 @@ void main(void) {
45280
45291
  }
45281
45292
  return;
45282
45293
  }
45294
+
45283
45295
  const _this = this;
45284
45296
  this.superHighlightFilter = superHighlightFilter;
45285
45297
  this.__superHLBlink = false;
@@ -45293,7 +45305,8 @@ void main(void) {
45293
45305
 
45294
45306
  loop();
45295
45307
  }, SUPERHIGHLIGHT_DELAY);
45296
- }
45308
+ }
45309
+
45297
45310
  }
45298
45311
 
45299
45312
  _selectDataPoints() {
@@ -45456,7 +45469,9 @@ void main(void) {
45456
45469
  },
45457
45470
  getTooltipText: (d) => {
45458
45471
  if (!d) return;
45459
- return d[TRAIL_KEY] || this.__selectedMarkers.has(d[KEY])? this.localise(d.frame) : this.__labelWithoutFrame(d);
45472
+ return this.ui.labels.enabled ? d[TRAIL_KEY] || this.__selectedMarkers.has(d[KEY]) ? this.localise(d.frame) : this.__labelWithoutFrame(d)
45473
+ :
45474
+ d[TRAIL_KEY] ? this.__labelWithFrame(d) : this.__labelWithoutFrame(d);
45460
45475
  },
45461
45476
  getLabelPosition: (d) => {
45462
45477
  if (!d) return;
@@ -45941,7 +45956,7 @@ void main(void) {
45941
45956
  getTextAnchor: 'end',
45942
45957
  getAlignmentBaseline: 'bottom',
45943
45958
  getDragged: this.props.getDragged,
45944
- pickable: true,
45959
+ pickable: false,
45945
45960
  background: !this.ui.labels.removeLabelBox,
45946
45961
  backgroundPadding: [6, 4],
45947
45962
  getBorderWidth: 1,
@@ -46069,8 +46084,8 @@ void main(void) {
46069
46084
 
46070
46085
  __tooltipDataFilter() {
46071
46086
  const index = this.__selectedKeys.indexOf(this.activeObject[TRAIL_KEY] || this.activeObject[KEY]);
46072
- return this.MDL.trail.show ? this.activeObject.frame != this.__labelData[index]?.frame || ((this.activeObject[TRAIL_KEY] || this.activeObject[KEY]) != this.__labelData[index]?.[TRAIL_KEY])
46073
- : index == -1;
46087
+ return !this.ui.labels.enabled || (this.MDL.trail.show ? this.activeObject.frame != this.__labelData[index]?.frame || ((this.activeObject[TRAIL_KEY] || this.activeObject[KEY]) != this.__labelData[index]?.[TRAIL_KEY])
46088
+ : index == -1);
46074
46089
  }
46075
46090
 
46076
46091
  get zScale() {
@@ -46317,7 +46332,7 @@ void main(void) {
46317
46332
  }
46318
46333
  });
46319
46334
 
46320
- BubbleChart.versionInfo = { version: "5.1.0", build: 1743007947150, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
46335
+ BubbleChart.versionInfo = { version: "5.2.1", build: 1746462563188, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
46321
46336
 
46322
46337
  exports.Base = BubbleChart;
46323
46338