@vizabi/bubblechart 4.1.6 → 4.1.8

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 v4.1.6 build 1725045335558 Copyright 2024 Gapminder Foundation and contributors
1
+ // https://github.com/vizabi/bubblechart#readme v4.1.8 build 1737499944940 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) :
@@ -1597,10 +1597,12 @@
1597
1597
  this._date.setText(this.MDL.frame.value, duration);
1598
1598
  }
1599
1599
 
1600
- __getColor(key, valueC) {
1601
- return valueC != null && !sharedComponents.LegacyUtils.isNaN(valueC)
1602
- ? (this.MDL.color.scale.isPattern ? `url(#flag-${key}-${this.id})` : this.cScale(valueC))
1603
- : COLOR_WHITEISH;
1600
+ __getColor(d, valueC) {
1601
+ if (valueC == null || sharedComponents.LegacyUtils.isNaN(valueC)) return COLOR_WHITEISH;
1602
+
1603
+ if (this.MDL.color.scale.isPattern) return `url(#flag-${this.MDL.color.data.createKeyFn()(d)}-${this.id})`;
1604
+
1605
+ return this.cScale(valueC);
1604
1606
  }
1605
1607
  __getColorForTrail(valueC, valueS) {
1606
1608
  if(valueC == null || sharedComponents.LegacyUtils.isNaN(valueC) || this.MDL.color.scale.isPattern) return COLOR_BLACKISH;
@@ -1684,7 +1686,7 @@
1684
1686
  d.r = sharedComponents.LegacyUtils.areaToRadius(_this.sScale(valueS || 0));
1685
1687
  const scaledX = _this.xScale(valueX);
1686
1688
  const scaledY = _this.yScale(valueY);
1687
- const scaledC = _this.__getColor(d[Symbol.for(isTrail ? "trailHeadKey" : "key")], valueC);
1689
+ const scaledC = _this.__getColor(d, valueC);
1688
1690
 
1689
1691
  if (!duration || !headTrail) {
1690
1692
  circle
@@ -1758,7 +1760,7 @@
1758
1760
  //view.classed("vzb-hidden", d.hidden);
1759
1761
  const scaledX = _this.xScale(valueX);
1760
1762
  const scaledY = _this.yScale(valueY);
1761
- const scaledC = _this.__getColor(d[Symbol.for(isTrail ? "trailHeadKey" : "key")], valueC);
1763
+ const scaledC = _this.__getColor(d, valueC);
1762
1764
 
1763
1765
  const group = d3.select(this);
1764
1766
  if (!duration || !headTrail) {
@@ -1778,6 +1780,16 @@
1778
1780
  }
1779
1781
 
1780
1782
  const diagonalLine = group.select(".vzb-diagonal-line");
1783
+ if (duration && isExtrapolated && diagonalLine.classed("vzb-hidden")) {
1784
+ const cx = +circle.attr("cx");
1785
+ const cy = +circle.attr("cy");
1786
+ const r = +circle.attr("r");
1787
+ diagonalLine
1788
+ .attr("x1", cx + r/Math.sqrt(2))
1789
+ .attr("y1", cy + r/Math.sqrt(2))
1790
+ .attr("x2", cx - r/Math.sqrt(2))
1791
+ .attr("y2", cy - r/Math.sqrt(2));
1792
+ }
1781
1793
  diagonalLine
1782
1794
  .classed("vzb-hidden", !isExtrapolated);
1783
1795
  if(isExtrapolated){
@@ -1882,7 +1894,7 @@
1882
1894
  d.r = sharedComponents.LegacyUtils.areaToRadius(_this.sScale(valueS || 0));
1883
1895
  const scaledX = _this.xScale(valueX);
1884
1896
  const scaledY = _this.yScale(valueY);
1885
- const scaledC = _this.__getColor(d[Symbol.for(isTrail ? "trailHeadKey" : "key")], valueC);
1897
+ const scaledC = _this.__getColor(d, valueC);
1886
1898
 
1887
1899
  const group = d3.select(this);
1888
1900
 
@@ -2055,8 +2067,8 @@
2055
2067
  }
2056
2068
 
2057
2069
  _updateScales() {
2058
- this.yScale = this.MDL.y.scale.d3Scale.copy();
2059
- this.xScale = this.MDL.x.scale.d3Scale.copy();
2070
+ this.yScale = this.MDL.y.scale.d3Scale;
2071
+ this.xScale = this.MDL.x.scale.d3Scale;
2060
2072
  this._labels.setScales(this.xScale, this.yScale);
2061
2073
  }
2062
2074
 
@@ -2143,7 +2155,7 @@
2143
2155
  limitMaxTickNumber: 6,
2144
2156
  bump: this.profileConstants.maxRadiusPx / 2,
2145
2157
  viewportLength: height,
2146
- formatter: this.localise
2158
+ formatter: this.services.locale.auto(y.data?.conceptProps?.format)
2147
2159
  }, rankScaleModifications));
2148
2160
 
2149
2161
  this.xAxis.scale(this.xScale)
@@ -2156,7 +2168,7 @@
2156
2168
  toolMargin: margin,
2157
2169
  bump: this.profileConstants.maxRadiusPx / 2,
2158
2170
  viewportLength: width,
2159
- formatter: this.localise
2171
+ formatter: this.services.locale.auto(x.data?.conceptProps?.format)
2160
2172
  });
2161
2173
 
2162
2174
 
@@ -2459,7 +2471,7 @@
2459
2471
  const x = _this.xScale(d[_this._alias("x")]);
2460
2472
  const y = _this.yScale(d[_this._alias("y")]);
2461
2473
  const s = d.r;
2462
- const c = _this.__getColor(selectedKey, d.color);
2474
+ const c = _this.__getColor(d, d.color);
2463
2475
  let entityOutOfView = false;
2464
2476
 
2465
2477
  if (x + s < 0 || x - s > this.width || y + s < 0 || y - s > this.height) {
@@ -2886,7 +2898,7 @@
2886
2898
  }
2887
2899
  });
2888
2900
 
2889
- BubbleChart.versionInfo = { version: "4.1.6", build: 1725045335558, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
2901
+ BubbleChart.versionInfo = { version: "4.1.8", build: 1737499944940, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
2890
2902
 
2891
2903
  exports.Base = BubbleChart;
2892
2904