@vizabi/bubblechart 3.11.2 → 3.12.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 v3.11.2 build 1630146971062 Copyright 2021 Gapminder Foundation and contributors
1
+ // https://github.com/vizabi/bubblechart#readme v3.12.2 build 1634239701931 Copyright 2021 Gapminder Foundation and contributors
2
2
  (function (global, factory) {
3
3
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('VizabiSharedComponents'), require('mobx')) :
4
4
  typeof define === 'function' && define.amd ? define(['VizabiSharedComponents', 'mobx'], factory) :
@@ -939,14 +939,14 @@
939
939
  },
940
940
  name: "labels"
941
941
  },{
942
- type: VizabiSharedComponents.DynamicBackground,
943
- placeholder: ".vzb-bc-year"
942
+ type: VizabiSharedComponents.DateTimeBackground,
943
+ placeholder: ".vzb-bc-date"
944
944
  }];
945
945
 
946
946
  config.template = `
947
947
  <svg class="vzb-bubblechart-svg vzb-bubblechart-svg-back vzb-export">
948
948
  <g class="vzb-bc-graph">
949
- <g class="vzb-bc-year"></g>
949
+ <g class="vzb-bc-date"></g>
950
950
  <svg class="vzb-bc-axis-x"><g></g></svg>
951
951
  <svg class="vzb-bc-axis-y"><g></g></svg>
952
952
  <line class="vzb-bc-projection-x"></line>
@@ -1060,7 +1060,7 @@
1060
1060
  Object.assign(this.DOM, {
1061
1061
  yAxisElContainer: graphBack.select(".vzb-bc-axis-y"),
1062
1062
  xAxisElContainer: graphBack.select(".vzb-bc-axis-x"),
1063
- yearEl: graphBack.select(".vzb-bc-year"),
1063
+ date: graphBack.select(".vzb-bc-date"),
1064
1064
  projectionX: graphBack.select(".vzb-bc-projection-x"),
1065
1065
  projectionY: graphBack.select(".vzb-bc-projection-y"),
1066
1066
  });
@@ -1072,7 +1072,7 @@
1072
1072
  this.DOM.bubbleCrown.selectAll(".vzb-crown-glow")
1073
1073
  .attr("filter", "url(" + location.pathname + "#vzb-glow-filter)");
1074
1074
 
1075
- this._year = this.findChild({type: "DynamicBackground"});
1075
+ this._date = this.findChild({type: "DateTimeBackground"});
1076
1076
  this._labels = this.findChild({type: "Labels"});
1077
1077
  this._panZoom = new PanZoom(this);
1078
1078
  this.decorations = new BCDecorations(this);
@@ -1191,7 +1191,7 @@
1191
1191
  }
1192
1192
 
1193
1193
  draw() {
1194
- this.localise = this.services.locale.auto();
1194
+ this.localise = this.services.locale.auto(this.MDL.frame.interval);
1195
1195
 
1196
1196
  //this.MDL.trail.config.show = false;
1197
1197
  //this.ui.cursorMode = "plus";
@@ -1230,12 +1230,12 @@
1230
1230
  }
1231
1231
 
1232
1232
  _updateShowYear() {
1233
- this.DOM.yearEl.classed("vzb-hidden", !this.ui.timeInBackground);
1233
+ this.DOM.date.classed("vzb-hidden", !this.ui.timeInBackground);
1234
1234
  }
1235
1235
 
1236
1236
  _updateYear() {
1237
1237
  const duration = this._getDuration();
1238
- this._year.setText(this.localise(this.MDL.frame.value), duration);
1238
+ this._date.setText(this.MDL.frame.value, duration);
1239
1239
  }
1240
1240
 
1241
1241
  _createAndDeleteBubbles() {
@@ -1785,9 +1785,7 @@
1785
1785
  graphAll
1786
1786
  .attr("transform", "translate(" + (margin.left * this.profileConstants.leftMarginRatio) + "," + margin.top + ")");
1787
1787
 
1788
- this._year.resizeText(width, height);
1789
- //this.yearEl.classed("vzb-hidden", !this.ui.timeInBackground);
1790
- //this.year.resize(width, height);
1788
+ this._date.resizeText(width, height);
1791
1789
 
1792
1790
  eventArea
1793
1791
  .attr("width", width)
@@ -2469,7 +2467,7 @@
2469
2467
  if (typeof d.label == "object")
2470
2468
  return Object.entries(d.label)
2471
2469
  .filter(entry => entry[0] != this.MDL.frame.data.concept)
2472
- .map(entry => entry[1])
2470
+ .map(entry => VizabiSharedComponents.LegacyUtils.isNumber(entry[1]) ? (entry[0] + ": " + entry[1]) : entry[1])
2473
2471
  .join(", ");
2474
2472
  if (d.label != null) return "" + d.label;
2475
2473
  return d[Symbol.for("key")];
@@ -2538,13 +2536,14 @@
2538
2536
 
2539
2537
  constructor(config){
2540
2538
 
2541
- const fullMarker = config.model.markers.bubble;
2542
- config.Vizabi.utils.applyDefaults(fullMarker.config, BubbleChart.DEFAULT_CORE);
2539
+ const markerName = config.options.markerName || "bubble";
2540
+ const fullMarker = config.model.markers[markerName];
2541
+ config.Vizabi.utils.applyDefaults(fullMarker.config, BubbleChart.DEFAULT_CORE(markerName));
2543
2542
 
2544
2543
  const frameType = config.Vizabi.stores.encodings.modelTypes.frame;
2545
2544
  const { marker, splashMarker } = frameType.splashMarker(fullMarker);
2546
2545
 
2547
- config.model.markers.bubble = marker;
2546
+ config.model.markers[markerName] = marker;
2548
2547
 
2549
2548
  config.name = "bubblechart";
2550
2549
 
@@ -2639,14 +2638,14 @@
2639
2638
  }
2640
2639
  };
2641
2640
 
2642
- BubbleChart.DEFAULT_CORE = {
2641
+ BubbleChart.DEFAULT_CORE = (markerName) => ({
2643
2642
  requiredEncodings: ["x", "y", "size"],
2644
2643
  encoding: {
2645
2644
  "selected": {
2646
2645
  modelType: "selection",
2647
2646
  data: {
2648
2647
  filter: {
2649
- ref: "markers.bubble.encoding.trail.data.filter"
2648
+ ref: `markers.${markerName}.encoding.trail.data.filter`
2650
2649
  }
2651
2650
  }
2652
2651
  },
@@ -2656,7 +2655,7 @@
2656
2655
  "y": { },
2657
2656
  "order": { modelType: "order",
2658
2657
  data: {
2659
- ref: "markers.bubble.encoding.size.data.config"
2658
+ ref: `markers.${markerName}.encoding.size.data.config`
2660
2659
  }
2661
2660
  },
2662
2661
  "size": {
@@ -2683,9 +2682,9 @@
2683
2682
  allowEnc: ["y", "x"]
2684
2683
  }
2685
2684
  }
2686
- };
2685
+ });
2687
2686
 
2688
- BubbleChart.versionInfo = { version: "3.11.2", build: 1630146971062, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: VizabiSharedComponents.versionInfo};
2687
+ BubbleChart.versionInfo = { version: "3.12.2", build: 1634239701931, package: {"homepage":"https://github.com/vizabi/bubblechart#readme","name":"@vizabi/bubblechart","description":"Vizabi bubble chart"}, sharedComponents: VizabiSharedComponents.versionInfo};
2689
2688
 
2690
2689
  return BubbleChart;
2691
2690