@vizabi/bubblechart 5.0.0 → 5.0.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.0.0 build 1741212047150 Copyright 2025 Gapminder Foundation and contributors
1
+ // https://github.com/vizabi/bubblechart#readme v5.0.1 build 1742495252456 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) :
@@ -44161,7 +44161,7 @@ void main(void) {
44161
44161
  fontSettings: {
44162
44162
  sdf: true,
44163
44163
  fontSize: 9 * 3,
44164
- buffer: Math.ceil(9 * 0.3) + 1,
44164
+ buffer: 8,
44165
44165
  },
44166
44166
  characterSet:["❌"],
44167
44167
  //getPolygonOffset: null,//({layerIndex}) => [0, layerIndex * 100],
@@ -44182,6 +44182,7 @@ void main(void) {
44182
44182
  const COLOR_WHITEISH = "rgb(253, 253, 253)";
44183
44183
  const COLOR_BLACKISH = "rgb(51, 51, 51)";
44184
44184
  const THICK_LINE_THRESHOLD_FOR_DARKER_COLOR = 3;
44185
+ const SUPERHIGHLIGHT_DELAY = 500;
44185
44186
  const CHARACTER_SET =
44186
44187
  'ABCDEFGHIJKLMNOPQRSTUVWXYZÅÄÖabcdefghijklmnopqrstuvwxyzåäéö0123456789+-−–*/%,.²:() '.split('');
44187
44188
 
@@ -44445,7 +44446,9 @@ void main(void) {
44445
44446
  });
44446
44447
 
44447
44448
  this.DOM.canvasWrap.style("pointer-events", "all");
44448
- this.FONT_FAMILY = this.element.style("font-family").split(",")[0];
44449
+ this.FONT_FAMILY =
44450
+ 'ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji"';
44451
+
44449
44452
  this.deckBubble = this.getDeck();
44450
44453
  this.props = this.getProps();
44451
44454
 
@@ -44503,7 +44506,6 @@ void main(void) {
44503
44506
  this.addReaction(this.updateSize, {throttle_ms: 50});
44504
44507
  // this.addReaction(this._resetZoomMinMaxXReaction, {ignoreStatus: this._resetZoomMinMaxX});
44505
44508
  // this.addReaction(this._resetZoomMinMaxYReaction, {ignoreStatus: this._resetZoomMinMaxY});
44506
- //this.addReaction(this._updateOpacity_);
44507
44509
  this.addReaction(this._redrawOpacity);
44508
44510
  this.addReaction(this._updateHighlighted);
44509
44511
  this.addReaction(this._updateLabelFontSizes);
@@ -44511,27 +44513,18 @@ void main(void) {
44511
44513
  this.addReaction(this.updateColorPatterns);
44512
44514
  this.addReaction(this._updateShowYear);
44513
44515
  this.addReaction(this._updateYear);
44514
- //this.addReaction(this.drawData_);
44515
44516
  this.addReaction(this.drawData);
44516
44517
  this.addReaction(this._zoomToMarkerMaxMin);
44517
- //this.addReaction(this.redrawData_);
44518
44518
  this.addReaction(this.redrawData);
44519
44519
 
44520
44520
  this.addReaction(this._selectDataPoints);
44521
44521
  this.addReaction(this._highlightDataPoints);
44522
- //this.addReaction(this._blinkSuperHighlighted);
44522
+ this.addReaction(this._blinkSuperHighlighted);
44523
44523
  this.addReaction(this._drawForecastOverlay);
44524
44524
  this.addReaction(this._setupCursorMode);
44525
44525
  this.addReaction(this.updateDecorations);
44526
44526
  }
44527
44527
 
44528
- drawData_() {
44529
- this.processFrameData_();
44530
- this._updateMarkerSizeLimits();
44531
- //this._createAndDeleteBubbles();
44532
- //this.redrawData();
44533
- }
44534
-
44535
44528
  drawData() {
44536
44529
  this.perfDataStart = performance.now();
44537
44530
  this._updateMarkerSizeLimits();
@@ -44591,262 +44584,6 @@ void main(void) {
44591
44584
  return this.MDL.color.scale.palette.getColorShade({colorID: valueC}) || COLOR_BLACKISH;
44592
44585
  }
44593
44586
 
44594
- _createAndDeleteBubbles() {
44595
- const _this = this;
44596
- const duration = this.duration;
44597
- const transition = this._getTransition(duration);
44598
- const data = this.__dataProcessed_;
44599
- let trailRedrawDate;
44600
-
44601
- mobx.runInAction(()=>{
44602
- trailRedrawDate = this.MDL.frame.stepScale.invert(Math.min(this.__lastStep, this.__lastStep = this.MDL.frame.step << 0) - 1);
44603
- });
44604
-
44605
- this.bubbles = this.DOM.bubbleContainer.selectAll(".vzb-bc-entity")
44606
- .data(this.__dataProcessed_, d => d[KEY])
44607
- .join(
44608
- enter => enter
44609
- .append(d => {
44610
- const g = document.createElementNS("http://www.w3.org/2000/svg", "g");
44611
- const circle = document.createElementNS("http://www.w3.org/2000/svg", "circle");
44612
- const trailLine = document.createElementNS("http://www.w3.org/2000/svg", "line");
44613
- const diagonalLine = document.createElementNS("http://www.w3.org/2000/svg", "line");
44614
- trailLine.classList.add("vzb-trail-line");
44615
- diagonalLine.classList.add("vzb-diagonal-line");
44616
- g.appendChild(circle);
44617
- g.appendChild(diagonalLine);
44618
- if (isTrailBubble(d)) g.appendChild(trailLine);
44619
- return g;
44620
- })
44621
- .attr("class", "vzb-bc-entity")
44622
- .attr("id", d => `vzb-bc-bubble-${d[KEY]}-${this.id}`)
44623
- .style("opacity", d => d[Symbol.for("opacity")] = this._getBubbleOpacity(d))
44624
- .call(selection => {
44625
- if(!sharedComponents.LegacyUtils.isTouchDevice()){
44626
- selection
44627
- .on("mouseover", (event, d) => {
44628
- if (this.ui.cursorMode !== "arrow" && this.ui.cursorMode !== "hand") return;
44629
- if (this._labels.dragging) return;
44630
- this._bubblesInteract().mouseover(event, d);
44631
- })
44632
- .on("mouseout", (event, d) => {
44633
- if (this.ui.cursorMode !== "arrow" && this.ui.cursorMode !== "hand") return;
44634
- if (this._labels.dragging) return;
44635
- this._bubblesInteract().mouseout(event, d);
44636
- })
44637
- .on("click", (event, d) => {
44638
- if (this.ui.cursorMode !== "arrow" && this.ui.cursorMode !== "hand") return;
44639
- this._bubblesInteract().click(event, d);
44640
- });
44641
- } else {
44642
- selection
44643
- .onTap((event, d) => {
44644
- event.stopPropagation();
44645
- this._bubblesInteract().click(event, d);
44646
- })
44647
- .onLongTap(() => {});
44648
- }
44649
- })
44650
- .each(function(d, index) {
44651
- const dataNext = data[index + 1] || {};
44652
- const isTrail = isTrailBubble(d);
44653
- const isExtrapolated = d[Symbol.for("extrapolated")];
44654
- const headTrail = isTrail && !dataNext[TRAIL_KEY];
44655
- const view = d3.select(this);
44656
- const circle = view.select("circle");
44657
- const diagonalLine = view.select(".vzb-diagonal-line");
44658
-
44659
- const valueX = d[_this._alias("x")];
44660
- const valueY = d[_this._alias("y")];
44661
- const valueS = d.size;
44662
- const valueC = d.color;
44663
-
44664
- //d.hidden = (!valueS && valueS !== 0) || valueX == null || valueY == null;
44665
-
44666
- //view.classed("vzb-hidden", d.hidden);
44667
- d.r = sharedComponents.LegacyUtils.areaToRadius(_this.sScale(valueS || 0));
44668
- const scaledX = _this.xScale(valueX);
44669
- const scaledY = _this.yScale(valueY);
44670
- const scaledC = _this.__getColor(d[isTrail ? TRAIL_KEY : KEY], valueC);
44671
-
44672
- if (!duration || !headTrail) {
44673
- circle
44674
- .attr("r", d.r)
44675
- .attr("fill", scaledC)
44676
- .attr("cy", scaledY)
44677
- .attr("cx", scaledX);
44678
- //.transition(transition)
44679
-
44680
- if(isExtrapolated)
44681
- diagonalLine
44682
- .attr("x1", scaledX + d.r/Math.sqrt(2))
44683
- .attr("y1", scaledY + d.r/Math.sqrt(2))
44684
- .attr("x2", scaledX - d.r/Math.sqrt(2))
44685
- .attr("y2", scaledY - d.r/Math.sqrt(2));
44686
- diagonalLine
44687
- .classed("vzb-hidden", !isExtrapolated);
44688
-
44689
- //trail line
44690
- if (isTrail) {
44691
- const trailLine = view.select(".vzb-trail-line");
44692
-
44693
- const scaledX0 = _this.xScale(dataNext[_this._alias("x")]);
44694
- const scaledY0 = _this.yScale(dataNext[_this._alias("y")]);
44695
- const scaledCT = _this.__getColorForTrail(dataNext.color, dataNext.size);
44696
-
44697
- const nextR = sharedComponents.LegacyUtils.areaToRadius(_this.sScale(dataNext.size || 0));
44698
- const length = Math.sqrt( (scaledX - scaledX0)**2 + (scaledY - scaledY0)**2 ) - d.r - nextR;
44699
-
44700
- trailLine
44701
- .attr("x1", scaledX)
44702
- .attr("y1", scaledY)
44703
- .attr("x2", scaledX0)
44704
- .attr("y2", scaledY0)
44705
- .attr("stroke-dasharray", `0 ${d.r} ${length > 0 ? length : 0} ${nextR}`)
44706
- .style("stroke-width", _this.trailSizeScale(dataNext.size))
44707
- .style("stroke", scaledCT);
44708
- }
44709
- }
44710
-
44711
- if (duration && !isTrail) {
44712
- view
44713
- .style("opacity", 0)
44714
- .transition().duration(duration*0.9)
44715
- .style("opacity", d[Symbol.for("opacity")]);
44716
- }
44717
-
44718
- if (!isTrail) {
44719
- _this._updateLabel(d, valueX, valueY, duration, true, false);
44720
- }
44721
- }),
44722
-
44723
- update => update
44724
- .each(function(d, index) {
44725
-
44726
- const isTrail = isTrailBubble(d);
44727
- const isExtrapolated = d[Symbol.for("extrapolated")];
44728
- const dataNext = data[index + 1] || {};
44729
- const headTrail = isTrail && !dataNext[TRAIL_KEY];
44730
-
44731
- const valueS = d.size;
44732
- d.r = sharedComponents.LegacyUtils.areaToRadius(_this.sScale(valueS || 0));
44733
- if (isTrail && d["frame"] < trailRedrawDate) return;
44734
-
44735
- const valueX = d[_this._alias("x")];
44736
- const valueY = d[_this._alias("y")];
44737
- const valueC = d.color;
44738
-
44739
- //d.hidden = (!valueS && valueS !== 0) || valueX == null || valueY == null;
44740
-
44741
- //view.classed("vzb-hidden", d.hidden);
44742
- const scaledX = _this.xScale(valueX);
44743
- const scaledY = _this.yScale(valueY);
44744
- const scaledC = _this.__getColor(d[isTrail ? TRAIL_KEY : KEY], valueC);
44745
-
44746
- const group = d3.select(this);
44747
- if (!duration || !headTrail) {
44748
- const circle = group.select("circle");
44749
- if (duration && !isTrail) {
44750
- circle.transition(transition)
44751
- .attr("r", d.r)
44752
- .attr("fill", scaledC)
44753
- .attr("cy", scaledY)
44754
- .attr("cx", scaledX);
44755
- } else {
44756
- circle.interrupt()
44757
- .attr("r", d.r)
44758
- .attr("fill", scaledC)
44759
- .attr("cy", scaledY)
44760
- .attr("cx", scaledX);
44761
- }
44762
-
44763
- const diagonalLine = group.select(".vzb-diagonal-line");
44764
- if (duration && isExtrapolated && diagonalLine.classed("vzb-hidden")) {
44765
- const cx = +circle.attr("cx");
44766
- const cy = +circle.attr("cy");
44767
- const r = +circle.attr("r");
44768
- diagonalLine
44769
- .attr("x1", cx + r/Math.sqrt(2))
44770
- .attr("y1", cy + r/Math.sqrt(2))
44771
- .attr("x2", cx - r/Math.sqrt(2))
44772
- .attr("y2", cy - r/Math.sqrt(2));
44773
- }
44774
- diagonalLine
44775
- .classed("vzb-hidden", !isExtrapolated);
44776
- if(isExtrapolated){
44777
- if (duration && !isTrail){
44778
- diagonalLine.transition(transition)
44779
- .attr("x1", scaledX + d.r/Math.sqrt(2))
44780
- .attr("y1", scaledY + d.r/Math.sqrt(2))
44781
- .attr("x2", scaledX - d.r/Math.sqrt(2))
44782
- .attr("y2", scaledY - d.r/Math.sqrt(2));
44783
- } else {
44784
- diagonalLine.interrupt()
44785
- .attr("x1", scaledX + d.r/Math.sqrt(2))
44786
- .attr("y1", scaledY + d.r/Math.sqrt(2))
44787
- .attr("x2", scaledX - d.r/Math.sqrt(2))
44788
- .attr("y2", scaledY - d.r/Math.sqrt(2));
44789
- }
44790
- }
44791
-
44792
- //trail line
44793
- if (isTrail) {
44794
- const trailLine = group.select(".vzb-trail-line");
44795
- const scaledX0 = _this.xScale(dataNext[_this._alias("x")]);
44796
- const scaledY0 = _this.yScale(dataNext[_this._alias("y")]);
44797
- const scaledCT = _this.__getColorForTrail(dataNext.color, dataNext.size);
44798
-
44799
- trailLine
44800
- .attr("x1", scaledX)
44801
- .attr("y1", scaledY);
44802
- if (duration && !data[index + 2][TRAIL_KEY]) {
44803
- trailLine
44804
- .attr("x2", scaledX)
44805
- .attr("y2", scaledY)
44806
- .transition(transition)
44807
- .attr("x2", scaledX0)
44808
- .attr("y2", scaledY0);
44809
- } else {
44810
- trailLine.interrupt()
44811
- .attr("x2", scaledX0)
44812
- .attr("y2", scaledY0);
44813
- }
44814
-
44815
- const nextR = sharedComponents.LegacyUtils.areaToRadius(_this.sScale(dataNext.size || 0));
44816
- const length = Math.sqrt( (scaledX - scaledX0)**2 + (scaledY - scaledY0)**2 ) - d.r - nextR;
44817
-
44818
- trailLine
44819
- .style("stroke", scaledCT)
44820
- .style("stroke-width", _this.trailSizeScale(dataNext.size))
44821
- .attr("stroke-dasharray", `0 ${d.r} ${length > 0 ? length : 0} ${nextR}`);
44822
- }
44823
- }
44824
-
44825
- if (!isTrail)
44826
- _this._updateLabel(d, valueX, valueY, duration, false, false);
44827
- }),
44828
-
44829
- exit => exit
44830
- .each(function(d) {
44831
- const isTrail = isTrailBubble(d);
44832
-
44833
- const view = duration && !isTrail ?
44834
- d3.select(this).transition(transition)
44835
- .duration(duration*0.9)
44836
- .style("opacity", 0)
44837
- :
44838
- d3.select(this).interrupt();
44839
-
44840
- view
44841
- .remove();
44842
-
44843
- if (!isTrail)
44844
- _this._updateLabel(d, d[_this._alias("x")], d[_this._alias("y")], duration, true, true);
44845
- })
44846
- )
44847
- .order();
44848
-
44849
- }
44850
44587
 
44851
44588
  redrawData(duration = 0) {
44852
44589
  //this.services.layout.size;
@@ -44872,105 +44609,6 @@ void main(void) {
44872
44609
  }
44873
44610
  }
44874
44611
 
44875
- redrawData_(duration) {
44876
- //this.services.layout.size;
44877
- //this.MDL.x.scale.type;
44878
- //this.MDL.y.scale.type;
44879
- this.MDL.color.scale.type;
44880
- this.MDL.size.scale.type;
44881
- this.MDL.size.scale.extent;
44882
-
44883
- const _this = this;
44884
- const data = this.__dataProcessed_;
44885
- const transition = this._getTransition(duration);
44886
-
44887
- if (this.bubbles) this.bubbles.each(function(d, index) {
44888
- const isTrail = isTrailBubble(d);
44889
- const dataNext = data[index + 1] || {};
44890
- const headTrail = isTrail && !dataNext[TRAIL_KEY];
44891
- const isExtrapolated = d[Symbol.for("extrapolated")];
44892
-
44893
- const valueX = d[_this._alias("x")];
44894
- const valueY = d[_this._alias("y")];
44895
- const valueS = d.size;
44896
- const valueC = d.color;
44897
-
44898
- d.r = sharedComponents.LegacyUtils.areaToRadius(_this.sScale(valueS || 0));
44899
- const scaledX = _this.xScale(valueX);
44900
- const scaledY = _this.yScale(valueY);
44901
- const scaledC = _this.__getColor(d[isTrail ? TRAIL_KEY : KEY], valueC);
44902
-
44903
- const group = d3.select(this);
44904
-
44905
- if (duration && headTrail) {
44906
- group.style("opacity", 0)
44907
- .transition().delay(duration).duration(0)
44908
- .style("opacity", d[Symbol.for("opacity")]);
44909
- }
44910
-
44911
- const circle = group.select("circle");
44912
- if (duration && !headTrail) {
44913
- circle.transition(transition)
44914
- .attr("r", d.r)
44915
- .attr("fill", scaledC)
44916
- .attr("cy", scaledY)
44917
- .attr("cx", scaledX);
44918
- } else {
44919
- circle.interrupt()
44920
- .attr("r", d.r)
44921
- .attr("fill", scaledC)
44922
- .attr("cy", scaledY)
44923
- .attr("cx", scaledX);
44924
- }
44925
-
44926
- const diagonalLine = group.select(".vzb-diagonal-line");
44927
- diagonalLine
44928
- .classed("vzb-hidden", !isExtrapolated);
44929
- if(isExtrapolated){
44930
- if (duration && !headTrail){
44931
- diagonalLine.transition(transition)
44932
- .attr("x1", scaledX + d.r/Math.sqrt(2))
44933
- .attr("y1", scaledY + d.r/Math.sqrt(2))
44934
- .attr("x2", scaledX - d.r/Math.sqrt(2))
44935
- .attr("y2", scaledY - d.r/Math.sqrt(2));
44936
- } else {
44937
- diagonalLine.interrupt()
44938
- .attr("x1", scaledX + d.r/Math.sqrt(2))
44939
- .attr("y1", scaledY + d.r/Math.sqrt(2))
44940
- .attr("x2", scaledX - d.r/Math.sqrt(2))
44941
- .attr("y2", scaledY - d.r/Math.sqrt(2));
44942
- }
44943
- }
44944
-
44945
-
44946
- if (isTrail) {
44947
- const trailLine = (duration && !headTrail) ?
44948
- group.select(".vzb-trail-line")
44949
- .transition(transition)
44950
- : group.select(".vzb-trail-line").interrupt();
44951
-
44952
- const dataNext = data[index + 1];
44953
- const scaledX0 = _this.xScale(dataNext[_this._alias("x")]);
44954
- const scaledY0 = _this.yScale(dataNext[_this._alias("y")]);
44955
- const scaledCT = _this.__getColorForTrail(dataNext.color, dataNext.size);
44956
-
44957
- const nextR = sharedComponents.LegacyUtils.areaToRadius(_this.sScale(dataNext.size || 0));
44958
- const length = Math.sqrt( (scaledX - scaledX0)**2 + (scaledY - scaledY0)**2 ) - d.r - nextR;
44959
-
44960
- trailLine
44961
- .attr("x1", scaledX)
44962
- .attr("y1", scaledY)
44963
- .attr("x2", scaledX0)
44964
- .attr("y2", scaledY0)
44965
- .style("stroke", scaledCT)
44966
- .style("stroke-width", _this.trailSizeScale(dataNext.size))
44967
- .attr("stroke-dasharray", `0 ${d.r} ${length > 0 ? length : 0} ${nextR}`);
44968
- }
44969
- });
44970
-
44971
- mobx.runInAction(() => _this._updateLabels(duration));
44972
- }
44973
-
44974
44612
  __getZoomed(type, zoomed, domain) {
44975
44613
  //const zoomed = values[`zoomed${type}`];
44976
44614
  return d3[type.toLowerCase()](zoomed !== null ? zoomed : domain);
@@ -45177,9 +44815,6 @@ void main(void) {
45177
44815
  formatter: this.services.locale.auto({shareOrPercent: x.data?.conceptProps?.format})
45178
44816
  });
45179
44817
 
45180
- //canvasWrap.style("width", width + "px");
45181
- //canvasWrap.style("height", Math.max(0, height) + "px");
45182
-
45183
44818
  bubbleContainerCropAll
45184
44819
  .attr("width", width)
45185
44820
  .attr("height", Math.max(0, height));
@@ -45224,6 +44859,8 @@ void main(void) {
45224
44859
  (this.elementWidth - this.DOM.graph.select(".vzb-bc-axis-x-title").node().getBBox().width - infoElHeight * 3)
45225
44860
  });
45226
44861
 
44862
+ canvasWrap.style("max-width", width + "px");
44863
+ canvasWrap.style("max-height", Math.max(0, height) + "px");
45227
44864
  }
45228
44865
 
45229
44866
  _rangeBump(arg, undo) {
@@ -45383,47 +45020,6 @@ void main(void) {
45383
45020
  });
45384
45021
  }
45385
45022
 
45386
- processFrameData_() {
45387
- return this.__dataProcessed_ = this.model.dataArray;
45388
- }
45389
-
45390
- _getTransition(duration) {
45391
- return duration ? d3.transition()
45392
- .duration(duration)
45393
- .ease(d3.easeLinear) : d3.transition();
45394
- }
45395
-
45396
- _bubblesInteract() {
45397
- const _this = this;
45398
-
45399
- return {
45400
- mouseover(event, d) {
45401
- _this.hoverBubble = true;
45402
- _this.MDL.highlighted.data.filter.set(d);
45403
- _this._labels.showCloseCross(d, true);
45404
- },
45405
-
45406
- mouseout(event, d) {
45407
- _this.hoverBubble = false;
45408
- _this.MDL.highlighted.data.filter.delete(d);
45409
- //_this._setTooltip();
45410
- _this._labels.showCloseCross(d, false);
45411
- },
45412
-
45413
- click(event, d) {
45414
- if (_this.draggingNow) return;
45415
- // // const isSelected = d.isSelected;
45416
- if (!isTrailBubble(d)) _this.MDL.selected.data.filter.toggle(d);
45417
- //_this.MDL.selected.data.filter.toggle(d);
45418
- // // //return to highlighted state
45419
- // // if (!utils.isTouchDevice()) {
45420
- // // if (isSelected) _this.model.marker.highlightMarker(d);
45421
- // // _this.highlightDataPoints();
45422
- }
45423
- };
45424
- }
45425
-
45426
-
45427
45023
  _updateMarkerSizeLimits() {
45428
45024
  this.services.layout.size;
45429
45025
  this.MDL.size.scale.domain;
@@ -45447,30 +45043,6 @@ void main(void) {
45447
45043
  this.trailSizeScale.domain(this.MDL.size.scale.domain).range([minTrailThicknessPx, maxTrailThicknessPx]);
45448
45044
  }
45449
45045
 
45450
- _setTooltip(tooltipText, x, y, s, c, d) {
45451
- if (tooltipText) {
45452
- const labelValues = {};
45453
- if (d) {
45454
- labelValues.valueY = d[this._alias("y")];
45455
- labelValues.valueX = d[this._alias("x")];
45456
- labelValues.valueS = d.size;
45457
- labelValues.valueC = d.color;
45458
- labelValues.valueLST = d.size_label || null;
45459
- labelValues.labelText = this.__labelWithoutFrame(d, this.localise);
45460
- }
45461
-
45462
- const tooltipCache = {};
45463
- tooltipCache.labelX0 = this.xScale.invert ? this.xScale.invert(x) : d.x;
45464
- tooltipCache.labelY0 = this.yScale.invert ? this.yScale.invert(y) : d.y;
45465
- tooltipCache.scaledS0 = s;
45466
- tooltipCache.scaledC0 = null;
45467
-
45468
- this._labels.setTooltip(d, tooltipText, tooltipCache, labelValues);
45469
- } else {
45470
- this._labels.setTooltip();
45471
- }
45472
- }
45473
-
45474
45046
  _getLabelText(d) {
45475
45047
  return this.KEYS.map(key => d.label[key]).join(",");
45476
45048
  //// + (this.model.ui.chart.timeInTrails && time && (this.model.time.start - this.model.time.end !== 0) ? " " + time : "");
@@ -45519,24 +45091,6 @@ void main(void) {
45519
45091
  });
45520
45092
  }
45521
45093
 
45522
- _updateOpacity_(selection) {
45523
- //this.MDL.frame.value; //listen
45524
-
45525
- const highlightedFilter = this.MDL.highlighted.data.filter;
45526
- const selectedFilter = this.MDL.selected.data.filter;
45527
-
45528
- this.__highlightedMarkers = new Map(highlightedFilter.markers);
45529
- this.__selectedMarkers = new Map(selectedFilter.markers);
45530
- this.__someSelected = this.__selectedMarkers.size != 0;
45531
- this.__someHighlighted = this.__highlightedMarkers.size != 0;
45532
-
45533
- const _selection = selection || this.bubbles;
45534
- if(!_selection) return;
45535
- _selection
45536
- .style("opacity", d => this._getBubbleOpacity(d, this.ui))
45537
- .style("pointer-events", d => this._getBubbleOpacity(d, this.ui) === 0 ? "none" : "visible");
45538
- }
45539
-
45540
45094
  _redrawOpacity() {
45541
45095
  this.ui.opacityRegular;
45542
45096
  this.ui.opacitySelect;
@@ -45725,10 +45279,31 @@ void main(void) {
45725
45279
  _blinkSuperHighlighted() {
45726
45280
  if (!this.MDL.superHighlighted) return;
45727
45281
 
45728
- this.MDL.superHighlighted.data.filter;
45729
-
45730
- //this.bubbles
45731
- // .classed("vzb-super-highlighted", d => superHighlightFilter.has(d));
45282
+ const superHighlightFilter = this.MDL.superHighlighted.data.filter;
45283
+ if (!superHighlightFilter.any() || this.duration) {
45284
+ if (this.__superHLTimeoutID) {
45285
+ clearTimeout(this.__superHLTimeoutID);
45286
+ this.__superHLTimeoutID = null;
45287
+ this.opacityUpdateTrigger++;
45288
+ this.__superHLBlink = false;
45289
+ this.deckBubble.setProps({ layers: this.getBubbleLayers(this.__data, false, 0) });
45290
+ }
45291
+ return;
45292
+ }
45293
+ const _this = this;
45294
+ this.superHighlightFilter = superHighlightFilter;
45295
+ this.__superHLBlink = false;
45296
+ loop();
45297
+
45298
+ function loop() {
45299
+ _this.__superHLTimeoutID = setTimeout(() => {
45300
+ _this.__superHLBlink = !_this.__superHLBlink;
45301
+ _this.opacityUpdateTrigger++;
45302
+ _this.deckBubble.setProps({ layers: _this.getBubbleLayers(_this.__data, false, 0) });
45303
+
45304
+ loop();
45305
+ }, SUPERHIGHLIGHT_DELAY);
45306
+ }
45732
45307
  }
45733
45308
 
45734
45309
  _selectDataPoints() {
@@ -45774,108 +45349,13 @@ void main(void) {
45774
45349
  }
45775
45350
  }
45776
45351
 
45777
- _setupCursorMode_() {
45778
- const svg = this.DOM.chartSvgAll;
45779
- if (this.ui.cursorMode === "plus") {
45780
- svg.classed("vzb-zoomin", true);
45781
- svg.classed("vzb-zoomout", false);
45782
- svg.classed("vzb-panhand", false);
45783
- } else if (this.ui.cursorMode === "minus") {
45784
- svg.classed("vzb-zoomin", false);
45785
- svg.classed("vzb-zoomout", true);
45786
- svg.classed("vzb-panhand", false);
45787
- } else if (this.ui.cursorMode === "hand") {
45788
- svg.classed("vzb-zoomin", false);
45789
- svg.classed("vzb-zoomout", false);
45790
- svg.classed("vzb-panhand", true);
45791
- } else {
45792
- svg.classed("vzb-zoomin", false);
45793
- svg.classed("vzb-zoomout", false);
45794
- svg.classed("vzb-panhand", false);
45795
- }
45796
- }
45797
-
45798
45352
  updateDecorations(){
45799
45353
  this.services.layout.size;
45800
45354
  this.MDL.x.scale.zoomed;
45801
45355
  this.MDL.y.scale.zoomed;
45802
45356
  this.decorations.update.bind(this)(this.duration);
45803
45357
  }
45804
-
45805
- _updateLabel(d, x, y, duration, showhide, hidden) {
45806
- const selectedMarkers = this.MDL.selected.data.filter.markers;
45807
- const key = d[KEY];
45808
- // only for selected markers
45809
- if (selectedMarkers.has(key)) {
45810
- const trail = this.MDL.trail;
45811
-
45812
- const cache = {};
45813
-
45814
- let labelText = "";
45815
-
45816
- //if (showhide && hidden && trail.show && trailStartTime && (trailStartTime < _this.time)) showhide = false;
45817
- if (hidden && !trail.show) showhide = true;
45818
-
45819
- if (trail.show && key in trail.starts) {
45820
- const trailStart = trail.starts[key];
45821
- //console.log("trailstart", trailStart)
45822
- // if this bubble is trail start bubble
45823
- if (trailStart >= this.MDL.frame.value || showhide) {
45824
- const trailData = this.model.getDataMapByFrameValue(trailStart, "trail.addTrails").getByStr(key);
45825
-
45826
- cache.labelText = labelText = this.__labelWithFrame(trailData);
45827
- cache.labelX0 = trailData[this._alias("x")];
45828
- cache.labelY0 = trailData[this._alias("y")];
45829
- cache.scaledC0 = trailData.color != null ? this.cScale(trailData.color) : COLOR_WHITEISH,
45830
- cache.scaledS0 = (trailData.size || trailData.size === 0) ? sharedComponents.LegacyUtils.areaToRadius(this.sScale(trailData.size)) : null;
45831
- cache.valueS0 = trailData.size;
45832
- trailData.hidden = hidden;
45833
- this._labels.updateLabel(trailData, cache, cache.labelX0, cache.labelY0, trailData.size, trailData.color, labelText, trailData.size_label, duration, showhide);
45834
- }
45835
- } else {
45836
- cache.labelText = labelText = this.__labelWithoutFrame(d);
45837
- cache.labelX0 = x;
45838
- cache.labelY0 = y;
45839
- cache.scaledC0 = d.color != null ? this.cScale(d.color) : COLOR_WHITEISH,
45840
- cache.scaledS0 = (d.size || d.size === 0) ? sharedComponents.LegacyUtils.areaToRadius(this.sScale(d.size)) : null;
45841
- cache.valueS0 = d.size;
45842
- d.hidden = hidden;
45843
- this._labels.updateLabel(d, cache, x, y, d.size, d.color, labelText, d.size_label, duration, showhide);
45844
- }
45845
- }
45846
- }
45847
45358
 
45848
- _updateLabels(duration) {
45849
- //console.log("updateLabels");
45850
-
45851
- const selectedFilter = this.MDL.selected.data.filter;
45852
- const trail = this.MDL.trail;
45853
-
45854
- for (const key of selectedFilter.markers.keys()) {
45855
- if (!(key in trail.starts))
45856
- continue;
45857
-
45858
- if (!this._labels.cached[key]) this._labels.cached[key] = {};
45859
- const cache = this._labels.cached[key];
45860
-
45861
- const datamap = (trail.show ? this.model.getDataMapByFrameValue(trail.starts[key], "trail.addTrails") : this.model.dataMap);
45862
- if (!datamap.hasByStr(key))
45863
- continue;
45864
-
45865
- const d = datamap.getByStr(key);
45866
-
45867
- cache.labelText = this[(trail.show && this.ui.timeInTrails ? "__labelWithFrame" : "__labelWithoutFrame")](d);
45868
- cache.labelX0 = d[this._alias("x")];
45869
- cache.labelY0 = d[this._alias("y")];
45870
- cache.scaledC0 = d.color != null ? this.cScale(d.color) : COLOR_WHITEISH,
45871
- cache.scaledS0 = (d.size || d.size === 0) ? sharedComponents.LegacyUtils.areaToRadius(this.sScale(d.size)) : null;
45872
- cache.valueS0 = d.size;
45873
- cache.initTextBBox = null;
45874
- cache.initFontSize = null;
45875
- this._labels.updateLabel({ [KEY]: key }, null, null, null, null, null, null, d.size_label, duration);
45876
- }
45877
- }
45878
-
45879
45359
  __labelWithoutFrame(d) {
45880
45360
  const markerSpace = this.model.data.space;
45881
45361
  if (typeof d.label == "object")
@@ -46140,7 +45620,10 @@ void main(void) {
46140
45620
 
46141
45621
  getFillColor: (d, { target }) => {
46142
45622
  if (!d) return;
46143
- this.ui;
45623
+ if (this.__superHLBlink && this.superHighlightFilter.has(d)) {
45624
+ target[3] = 0;
45625
+ return target;
45626
+ }
46144
45627
  const c = d3.color(this.__getColor(d[TRAIL_KEY] || d[KEY], d.color)).formatRgb().slice(4, -1).split(",").map(v=>+v);
46145
45628
  target[0] = c[0];
46146
45629
  target[1] = c[1];
@@ -46150,7 +45633,10 @@ void main(void) {
46150
45633
  },
46151
45634
  getTrailLineFillColor: (d, { data, index, target }) => {
46152
45635
  if (!d) return;
46153
- this.ui;
45636
+ if (this.__superHLBlink && this.superHighlightFilter.has(d)) {
45637
+ target[3] = 0;
45638
+ return target;
45639
+ }
46154
45640
  const d1 = data[index + 1] || d;
46155
45641
  const c = d3.color(this.__getColorForTrail(d1.color, d1.size)).formatRgb().slice(4, -1).split(",").map(v=>+v);
46156
45642
  target[0] = c[0];
@@ -46161,7 +45647,6 @@ void main(void) {
46161
45647
  },
46162
45648
  getLastTrailLineFillColor: (d, { target }) => {
46163
45649
  if (!d) return;
46164
- this.ui;
46165
45650
  const c = d3.color(this.__getColorForTrail(d[1].color, d[1].size)).formatRgb().slice(4, -1).split(",").map(v=>+v);
46166
45651
  target[0] = c[0];
46167
45652
  target[1] = c[1];
@@ -46171,10 +45656,13 @@ void main(void) {
46171
45656
  },
46172
45657
  getLineColor: (d, { target }) => {
46173
45658
  if (!d) return;
46174
- this.ui;
46175
- target[0] = 0x3;
46176
- target[1] = 0x3;
46177
- target[2] = 0x3;
45659
+ if (this.__superHLBlink && this.superHighlightFilter.has(d)) {
45660
+ target[3] = 0;
45661
+ return target;
45662
+ }
45663
+ target[0] = 0x33;
45664
+ target[1] = 0x33;
45665
+ target[2] = 0x33;
46178
45666
  target[3] = this._getBubbleOpacity(d) * 255;
46179
45667
  return target;
46180
45668
  },
@@ -46447,12 +45935,17 @@ void main(void) {
46447
45935
  data: this.activeObject && this.__tooltipDataFilter() ? this.activeObjectData : null,
46448
45936
  fontSettings: this.ui.labels.removeLabelBox ? {
46449
45937
  sdf: true,
46450
- fontSize: 24
45938
+ // fontSize: 24,
45939
+ fontSize: Math.ceil(this.__defaultFontSize * 1.3),
45940
+ buffer: 8,
45941
+ //radius: 10,
45942
+ //cutoff: 0.24,
45943
+ smoothing: 0.1
46451
45944
  } : { sdf: false },
46452
45945
  getPosition: this.props.getLabelPosition,
46453
45946
  getPixelOffset: this.props.getTooltipPixelOffset,
46454
45947
  getText: this.props.getTooltipText,
46455
- getColor: [10, 10, 10],
45948
+ getColor: [0x33, 0x33, 0x33],
46456
45949
  getSize: this.__defaultFontSize,
46457
45950
  getTextAnchor: 'end',
46458
45951
  getAlignmentBaseline: 'bottom',
@@ -46467,7 +45960,7 @@ void main(void) {
46467
45960
  fontFamily: this.FONT_FAMILY,
46468
45961
  characterSet: CHARACTER_SET,
46469
45962
  outlineColor: [255, 255, 255],
46470
- outlineWidth: this.ui.labels.removeLabelBox ? 4 : 0,
45963
+ outlineWidth: this.ui.labels.removeLabelBox ? 3 : 0,
46471
45964
  updateTriggers: {
46472
45965
  getPosition: [this.redrawUpdateTrigger]
46473
45966
  },
@@ -46528,14 +46021,19 @@ void main(void) {
46528
46021
  data: this.__labelData,
46529
46022
  fontSettings: this.ui.labels.removeLabelBox ? {
46530
46023
  sdf: true,
46531
- fontSize: 24
46024
+ // fontSize: 24,
46025
+ fontSize: Math.ceil((this.__isConstantFontSize ? this.__fontSize : this._labels.maxLabelTextSize) * 1.3),
46026
+ buffer: 8,
46027
+ //radius: 10,
46028
+ //cutoff: 0.24,
46029
+ smoothing: 0.1
46532
46030
  } : { sdf: false },
46533
46031
  getPosition: this.props.getLabelPositionZ,
46534
46032
  getPixelOffset: this.props.getPixelOffset,
46535
46033
  getText: this.props.getLabelText,
46536
46034
  getLineSourceFillOffset: this.props.getRadius,
46537
46035
  getRadius: this.props.getRadius,
46538
- getColor: [10, 10, 10],
46036
+ getColor: [0x33, 0x33, 0x33],
46539
46037
  getSize: this.__isConstantFontSize ? this.__fontSize : this.props.getLabelFontSize,
46540
46038
  getTextAnchor: 'end',
46541
46039
  getAlignmentBaseline: 'bottom',
@@ -46550,7 +46048,7 @@ void main(void) {
46550
46048
  fontFamily: this.FONT_FAMILY,
46551
46049
  pickable: true,
46552
46050
  outlineColor: [255, 255, 255],
46553
- outlineWidth: 4,
46051
+ outlineWidth: this.ui.labels.removeLabelBox ? 3 : 0,
46554
46052
  background: !this.ui.labels.removeLabelBox,
46555
46053
  backgroundPadding: [6, 4],
46556
46054
  getBorderWidth: 1,
@@ -46806,7 +46304,7 @@ void main(void) {
46806
46304
  }
46807
46305
  });
46808
46306
 
46809
- BubbleChart.versionInfo = { version: "5.0.0", build: 1741212047150, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
46307
+ BubbleChart.versionInfo = { version: "5.0.1", build: 1742495252456, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: sharedComponents.versionInfo};
46810
46308
 
46811
46309
  exports.Base = BubbleChart;
46812
46310