billboard.js 3.10.3 → 3.11.0-next.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.
Files changed (68) hide show
  1. package/README.md +0 -1
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +337 -125
  4. package/dist/billboard.min.css +2 -2
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +2539 -2280
  7. package/dist/billboard.pkgd.min.js +2 -4
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +27 -13
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +27 -13
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +27 -13
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +27 -13
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2194 -2133
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2226 -2151
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2227 -2152
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2228 -2153
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2231 -2156
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  28. package/dist/theme/dark.css +1 -1
  29. package/dist/theme/dark.min.css +2 -2
  30. package/dist/theme/datalab.css +1 -1
  31. package/dist/theme/datalab.min.css +2 -2
  32. package/dist/theme/graph.css +1 -1
  33. package/dist/theme/graph.min.css +2 -2
  34. package/dist/theme/insight.css +1 -1
  35. package/dist/theme/insight.min.css +2 -2
  36. package/dist/theme/modern.css +1 -1
  37. package/dist/theme/modern.min.css +2 -2
  38. package/dist-esm/billboard.js +325 -128
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +3 -4
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +6 -9
  42. package/dist-esm/plugin/billboardjs-plugin-tableview.js +3 -4
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +3 -4
  44. package/package.json +35 -39
  45. package/src/Chart/api/zoom.ts +5 -20
  46. package/src/ChartInternal/Axis/Axis.ts +5 -3
  47. package/src/ChartInternal/Axis/AxisRenderer.ts +14 -0
  48. package/src/ChartInternal/ChartInternal.ts +1 -1
  49. package/src/ChartInternal/data/data.ts +6 -2
  50. package/src/ChartInternal/data/load.ts +37 -1
  51. package/src/ChartInternal/interactions/eventrect.ts +11 -4
  52. package/src/ChartInternal/interactions/interaction.ts +2 -1
  53. package/src/ChartInternal/interactions/zoom.ts +28 -0
  54. package/src/ChartInternal/internals/domain.ts +24 -1
  55. package/src/ChartInternal/internals/legend.ts +28 -2
  56. package/src/ChartInternal/internals/scale.ts +3 -3
  57. package/src/ChartInternal/internals/size.axis.ts +8 -3
  58. package/src/ChartInternal/internals/size.ts +3 -1
  59. package/src/ChartInternal/internals/tooltip.ts +12 -6
  60. package/src/ChartInternal/internals/transform.ts +2 -2
  61. package/src/ChartInternal/internals/type.ts +1 -1
  62. package/src/ChartInternal/shape/radar.ts +58 -45
  63. package/src/config/Options/axis/x.ts +27 -1
  64. package/src/config/Options/axis/y2.ts +13 -0
  65. package/src/config/Options/common/legend.ts +17 -0
  66. package/src/module/Cache.ts +1 -0
  67. package/src/module/util.ts +14 -0
  68. package/types/options.d.ts +28 -4
package/dist/billboard.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.10.3
8
+ * @version 3.11.0-next.1
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -344,27 +344,27 @@ function _typeof(o) {
344
344
  }
345
345
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPrimitive.js
346
346
 
347
- function _toPrimitive(input, hint) {
348
- if (_typeof(input) !== "object" || input === null) return input;
349
- var prim = input[Symbol.toPrimitive];
350
- if (prim !== undefined) {
351
- var res = prim.call(input, hint || "default");
352
- if (_typeof(res) !== "object") return res;
347
+ function toPrimitive(t, r) {
348
+ if ("object" != _typeof(t) || !t) return t;
349
+ var e = t[Symbol.toPrimitive];
350
+ if (void 0 !== e) {
351
+ var i = e.call(t, r || "default");
352
+ if ("object" != _typeof(i)) return i;
353
353
  throw new TypeError("@@toPrimitive must return a primitive value.");
354
354
  }
355
- return (hint === "string" ? String : Number)(input);
355
+ return ("string" === r ? String : Number)(t);
356
356
  }
357
357
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js
358
358
 
359
359
 
360
- function _toPropertyKey(arg) {
361
- var key = _toPrimitive(arg, "string");
362
- return _typeof(key) === "symbol" ? key : String(key);
360
+ function toPropertyKey(t) {
361
+ var i = toPrimitive(t, "string");
362
+ return "symbol" == _typeof(i) ? i : String(i);
363
363
  }
364
364
  ;// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
365
365
 
366
366
  function _defineProperty(obj, key, value) {
367
- key = _toPropertyKey(key);
367
+ key = toPropertyKey(key);
368
368
  if (key in obj) {
369
369
  Object.defineProperty(obj, key, {
370
370
  value: value,
@@ -919,6 +919,20 @@ function getCssRules(styleSheets) {
919
919
  return rules;
920
920
  }
921
921
 
922
+ /**
923
+ * Get current window and container scroll position
924
+ * @param {HTMLElement} node Target element
925
+ * @returns {object} window scroll position
926
+ * @private
927
+ */
928
+ function getScrollPosition(node) {
929
+ var _ref2, _ref3, _window$pageXOffset, _ref4, _ref5, _window$pageYOffset;
930
+ return {
931
+ x: (_ref2 = ((_ref3 = (_window$pageXOffset = win.pageXOffset) != null ? _window$pageXOffset : win.scrollX) != null ? _ref3 : 0) + node.scrollLeft) != null ? _ref2 : 0,
932
+ y: (_ref4 = ((_ref5 = (_window$pageYOffset = win.pageYOffset) != null ? _window$pageYOffset : win.scrollY) != null ? _ref5 : 0) + node.scrollTop) != null ? _ref4 : 0
933
+ };
934
+ }
935
+
922
936
  /**
923
937
  * Gets the SVGMatrix of an SVGGElement
924
938
  * @param {SVGElement} node Node element
@@ -1511,7 +1525,6 @@ let Element = function () {
1511
1525
  // $$.contextLine
1512
1526
  area: null // $$.contextArea
1513
1527
  },
1514
-
1515
1528
  arcs: null,
1516
1529
  bar: null,
1517
1530
  // mainBar,
@@ -1532,7 +1545,6 @@ let Element = function () {
1532
1545
  // xgrid,
1533
1546
  y: null // ygrid,
1534
1547
  },
1535
-
1536
1548
  gridLines: {
1537
1549
  main: null,
1538
1550
  // gridLines
@@ -1540,13 +1552,11 @@ let Element = function () {
1540
1552
  // xgridLines,
1541
1553
  y: null // ygridLines
1542
1554
  },
1543
-
1544
1555
  region: {
1545
1556
  main: null,
1546
1557
  // region
1547
1558
  list: null // mainRegion
1548
1559
  },
1549
-
1550
1560
  eventRect: null,
1551
1561
  zoomResetBtn: null // drag zoom reset button
1552
1562
  };
@@ -1626,7 +1636,6 @@ let State = function () {
1626
1636
  types: [],
1627
1637
  needle: undefined // arc needle current value
1628
1638
  },
1629
-
1630
1639
  // legend
1631
1640
  isLegendRight: !1,
1632
1641
  isLegendInset: !1,
@@ -1645,7 +1654,6 @@ let State = function () {
1645
1654
  // event data bound of previoous eventRect
1646
1655
  coords: [] // coordination value of previous eventRect
1647
1656
  },
1648
-
1649
1657
  axis: {
1650
1658
  x: {
1651
1659
  padding: {
@@ -3261,7 +3269,12 @@ var data_this = undefined;
3261
3269
  * - **Available Values:**
3262
3270
  * - circle
3263
3271
  * - rectangle
3272
+ * @property {boolean} [legend.format] Set formatter function for legend text.
3273
+ * The argument:<br>
3274
+ * - `id`: legend text(which is data id) value
3275
+ * @property {boolean} [legend.tooltip=false] Show full legend text value using system tooltip(via `<title>` element).
3264
3276
  * @property {boolean} [legend.usePoint=false] Whether to use custom points in legend.
3277
+ * @see [Demo: format](https://naver.github.io/billboard.js/demo/#Legend.LegendFormat)
3265
3278
  * @see [Demo: item.interaction](https://naver.github.io/billboard.js/demo/#Legend.LegendItemInteraction)
3266
3279
  * @see [Demo: item.tile.type](https://naver.github.io/billboard.js/demo/#Legend.LegendItemTileType)
3267
3280
  * @see [Demo: position](https://naver.github.io/billboard.js/demo/#Legend.LegendPosition)
@@ -3324,6 +3337,16 @@ var data_this = undefined;
3324
3337
  * r: 10
3325
3338
  * }
3326
3339
  * },
3340
+ * format: function(id) {
3341
+ * // set ellipsis string when length is > 5
3342
+ * // to get full legend value, combine with 'legend.tooltip=true'
3343
+ * if (id.length > 5) {
3344
+ * id = id.substr(0, 5) + "...";
3345
+ * }
3346
+ *
3347
+ * return id;
3348
+ * },
3349
+ * tooltip: true,
3327
3350
  * usePoint: true
3328
3351
  * }
3329
3352
  */
@@ -3344,9 +3367,11 @@ var data_this = undefined;
3344
3367
  legend_item_tile_height: 10,
3345
3368
  legend_item_tile_r: 5,
3346
3369
  legend_item_tile_type: "rectangle",
3370
+ legend_format: undefined,
3347
3371
  legend_padding: 0,
3348
3372
  legend_position: "bottom",
3349
3373
  legend_show: !0,
3374
+ legend_tooltip: !1,
3350
3375
  legend_usePoint: !1
3351
3376
  });
3352
3377
  ;// CONCATENATED MODULE: ./src/config/Options/common/title.ts
@@ -3716,6 +3741,7 @@ const KEY = {
3716
3741
  dataTotalPerIndex: "$totalPerIndex",
3717
3742
  legendItemTextBox: "legendItemTextBox",
3718
3743
  radarPoints: "$radarPoints",
3744
+ radarTextWidth: "$radarTextWidth",
3719
3745
  setOverOut: "setOverOut",
3720
3746
  callOverOutForTouch: "callOverOutForTouch",
3721
3747
  textRect: "textRect"
@@ -4034,7 +4060,6 @@ function runWorker(useWorker, fn, callback, depsFn) {
4034
4060
  // });
4035
4061
  };
4036
4062
  }
4037
-
4038
4063
  return runFn;
4039
4064
  }
4040
4065
  // EXTERNAL MODULE: external {"commonjs":"d3-dsv","commonjs2":"d3-dsv","amd":"d3-dsv","root":"d3"}
@@ -5122,6 +5147,7 @@ function getDataKeyForJson(keysParam, config) {
5122
5147
  */
5123
5148
  getDataIndexFromEvent: function getDataIndexFromEvent(event) {
5124
5149
  const $$ = this,
5150
+ $el = $$.$el,
5125
5151
  config = $$.config,
5126
5152
  _$$$state = $$.state,
5127
5153
  hasRadar = _$$$state.hasRadar,
@@ -5141,8 +5167,9 @@ function getDataKeyForJson(keysParam, config) {
5141
5167
  index = d && Object.keys(d).length === 1 ? d.index : undefined;
5142
5168
  } else {
5143
5169
  const isRotated = config.axis_rotated,
5170
+ scrollPos = getScrollPosition($el.chart.node()),
5144
5171
  e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event; // get data based on the mouse coords
5145
- index = findIndex(coords, isRotated ? e.clientY - rect.top : e.clientX - rect.left, 0, coords.length - 1, isRotated);
5172
+ index = findIndex(coords, isRotated ? e.clientY + scrollPos.y - rect.top : e.clientX + scrollPos.x - rect.left, 0, coords.length - 1, isRotated);
5146
5173
  }
5147
5174
  return index;
5148
5175
  },
@@ -5190,6 +5217,7 @@ function getDataKeyForJson(keysParam, config) {
5190
5217
  return $$.findClosest(target.values, pos);
5191
5218
  }.bind(this));
5192
5219
  // map to array of closest points of each target
5220
+
5193
5221
  // decide closest point and return
5194
5222
  return $$.findClosest(candidates, pos);
5195
5223
  },
@@ -5546,8 +5574,16 @@ function callDone(fn, resizeAfter) {
5546
5574
  load: function load(rawTargets, args) {
5547
5575
  var _this = this;
5548
5576
  const $$ = this,
5577
+ axis = $$.axis,
5549
5578
  data = $$.data,
5550
- append = args.append;
5579
+ org = $$.org,
5580
+ scale = $$.scale,
5581
+ append = args.append,
5582
+ zoomState = {
5583
+ domain: null,
5584
+ currentDomain: null,
5585
+ x: null
5586
+ };
5551
5587
  let targets = rawTargets;
5552
5588
  if (targets) {
5553
5589
  // filter loading targets if needed
@@ -5581,6 +5617,20 @@ function callDone(fn, resizeAfter) {
5581
5617
 
5582
5618
  // Set targets
5583
5619
  $$.updateTargets(data.targets);
5620
+ if (scale.zoom) {
5621
+ zoomState.x = axis.isCategorized() ? scale.x.orgScale() : (org.xScale || scale.x).copy();
5622
+ zoomState.domain = $$.getXDomain(data.targets); // get updated xDomain
5623
+
5624
+ zoomState.x.domain(zoomState.domain);
5625
+ zoomState.currentDomain = $$.zoom.getDomain(); // current zoomed domain
5626
+
5627
+ // reset zoom state when new data loaded is out of range
5628
+ if (!$$.withinRange(zoomState.currentDomain, undefined, zoomState.domain)) {
5629
+ scale.x.domain(zoomState.domain);
5630
+ scale.zoom = null;
5631
+ $$.$el.eventRect.property("__zoom", null);
5632
+ }
5633
+ }
5584
5634
 
5585
5635
  // Redraw with new targets
5586
5636
  $$.redraw({
@@ -5589,6 +5639,20 @@ function callDone(fn, resizeAfter) {
5589
5639
  withLegend: !0
5590
5640
  });
5591
5641
 
5642
+ // when load happens on zoom state
5643
+ if (scale.zoom) {
5644
+ // const x = (axis.isCategorized() ? scale.x.orgScale() : (org.xScale || scale.x)).copy();
5645
+
5646
+ org.xDomain = zoomState.domain;
5647
+ org.xScale = zoomState.x;
5648
+ if (axis.isCategorized()) {
5649
+ zoomState.currentDomain = $$.getZoomDomainValue(zoomState.currentDomain);
5650
+ org.xDomain = $$.getZoomDomainValue(org.xDomain);
5651
+ org.xScale = zoomState.x.domain(org.xDomain);
5652
+ }
5653
+ $$.updateCurrentZoomTransform(zoomState.x, zoomState.currentDomain);
5654
+ }
5655
+
5592
5656
  // Update current state chart type and elements list after redraw
5593
5657
  $$.updateTypesElements();
5594
5658
  callDone.call($$, args.done, args.resizeAfter);
@@ -5869,7 +5933,8 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5869
5933
  screenX: x,
5870
5934
  screenY: y,
5871
5935
  clientX: x,
5872
- clientY: y
5936
+ clientY: y,
5937
+ bubbles: hasRadar // radar type needs to bubble up event
5873
5938
  });
5874
5939
  }
5875
5940
  },
@@ -6634,7 +6699,6 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
6634
6699
  x.domain(domainValue);
6635
6700
  // zoomEnabled && $$.zoom.updateScaleExtent();
6636
6701
  }
6637
-
6638
6702
  if (withUpdateOrgXDomain || withUpdateXDomain) {
6639
6703
  zoomEnabled && $$.zoom.updateScaleExtent();
6640
6704
  }
@@ -6697,6 +6761,28 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
6697
6761
  }
6698
6762
  return [min, max];
6699
6763
  },
6764
+ /**
6765
+ * Return zoom domain from given domain
6766
+ * - 'category' type need to add offset to original value
6767
+ * @param {Array} domainValue domain value
6768
+ * @returns {Array} Zoom domain
6769
+ * @private
6770
+ */
6771
+ getZoomDomainValue: function getZoomDomainValue(domainValue) {
6772
+ var _this8 = this;
6773
+ const $$ = this,
6774
+ config = $$.config,
6775
+ axis = $$.axis;
6776
+ if (axis.isCategorized() && Array.isArray(domainValue)) {
6777
+ const isInverted = config.axis_x_inverted,
6778
+ domain = domainValue.map(function (v, i) {
6779
+ _newArrowCheck(this, _this8);
6780
+ return +v + (i === 0 ? +isInverted : +!isInverted);
6781
+ }.bind(this)); // need to add offset to original value for 'category' type
6782
+ return domain;
6783
+ }
6784
+ return domainValue;
6785
+ },
6700
6786
  /**
6701
6787
  * Converts pixels to axis' scale values
6702
6788
  * @param {string} type Axis type
@@ -6727,7 +6813,10 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
6727
6813
  * @private
6728
6814
  */
6729
6815
  withinRange: function withinRange(domain, current, range) {
6730
- var _this8 = this;
6816
+ var _this9 = this;
6817
+ if (current === void 0) {
6818
+ current = [0, 0];
6819
+ }
6731
6820
  const $$ = this,
6732
6821
  isInverted = $$.config.axis_x_inverted,
6733
6822
  _ref3 = range,
@@ -6738,10 +6827,10 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
6738
6827
  isInverted && target.reverse();
6739
6828
  if (target[0] < target[1]) {
6740
6829
  return domain.every(function (v, i) {
6741
- var _this9 = this;
6742
- _newArrowCheck(this, _this8);
6830
+ var _this10 = this;
6831
+ _newArrowCheck(this, _this9);
6743
6832
  return (i === 0 ? isInverted ? +v <= min : +v >= min : isInverted ? +v >= max : +v <= max) && !domain.every(function (v, i) {
6744
- _newArrowCheck(this, _this9);
6833
+ _newArrowCheck(this, _this10);
6745
6834
  return v === current[i];
6746
6835
  }.bind(this));
6747
6836
  }.bind(this));
@@ -6860,6 +6949,21 @@ function getLegendColor(id) {
6860
6949
  color = $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data);
6861
6950
  return color;
6862
6951
  }
6952
+
6953
+ /**
6954
+ * Get formatted text value
6955
+ * @param {string} id Legend text id
6956
+ * @returns {string} Formatted legend text
6957
+ */
6958
+ function getFormattedText(id) {
6959
+ var _config$data_names$id;
6960
+ const config = this.config;
6961
+ let text = (_config$data_names$id = config.data_names[id]) != null ? _config$data_names$id : id;
6962
+ if (isFunction(config.legend_format)) {
6963
+ text = config.legend_format(text);
6964
+ }
6965
+ return text;
6966
+ }
6863
6967
  /* harmony default export */ var internals_legend = ({
6864
6968
  /**
6865
6969
  * Initialize the legend.
@@ -7357,10 +7461,13 @@ function getLegendColor(id) {
7357
7461
  if (state.isLegendInset && dimension.max.width > 0 && background.size() === 0) {
7358
7462
  background = legend.insert("g", "." + $LEGEND.legendItem).attr("class", $LEGEND.legendBackground).append("rect");
7359
7463
  }
7360
- const texts = legend.selectAll("text").data(targetIdz).text(function (id) {
7361
- _newArrowCheck(this, _this4);
7362
- return isDefined(config.data_names[id]) ? config.data_names[id] : id;
7363
- }.bind(this)) // MEMO: needed for update
7464
+ if (config.legend_tooltip) {
7465
+ legend.selectAll("title").data(targetIdz).text(function (id) {
7466
+ _newArrowCheck(this, _this4);
7467
+ return id;
7468
+ }.bind(this));
7469
+ }
7470
+ const texts = legend.selectAll("text").data(targetIdz).text(getFormattedText.bind($$)) // MEMO: needed for update
7364
7471
  .each(function (id, i) {
7365
7472
  updatePositions(this, id, i);
7366
7473
  });
@@ -7495,10 +7602,13 @@ function getLegendColor(id) {
7495
7602
  // Define g for legend area
7496
7603
 
7497
7604
  $$.setLegendItem(l);
7498
- l.append("text").text(function (id) {
7499
- _newArrowCheck(this, _this6);
7500
- return isDefined(config.data_names[id]) ? config.data_names[id] : id;
7501
- }.bind(this)).each(function (id, i) {
7605
+ if (config.legend_tooltip) {
7606
+ l.append("title").text(function (id) {
7607
+ _newArrowCheck(this, _this6);
7608
+ return id;
7609
+ }.bind(this));
7610
+ }
7611
+ l.append("text").text(getFormattedText.bind($$)).each(function (id, i) {
7502
7612
  updatePositions(this, id, i);
7503
7613
  }).style("pointer-events", $$.getStylePropValue("none")).attr("x", isLegendRightOrInset ? posFn.xText : -200).attr("y", isLegendRightOrInset ? -200 : posFn.yText);
7504
7614
  l.append("rect").attr("class", $LEGEND.legendItemEvent).style("fill-opacity", $$.getStylePropValue("0")).attr("x", isLegendRightOrInset ? posFn.xRect : -200).attr("y", isLegendRightOrInset ? -200 : posFn.yRect);
@@ -7890,8 +8000,8 @@ function getScale(type, min, max) {
7890
8000
  /* harmony default export */ var scale = ({
7891
8001
  /**
7892
8002
  * Get x Axis scale function
7893
- * @param {number} min Min value
7894
- * @param {number} max Max value
8003
+ * @param {number} min Min range value
8004
+ * @param {number} max Max range value
7895
8005
  * @param {Array} domain Domain value
7896
8006
  * @param {Function} offset The offset getter to be sum
7897
8007
  * @returns {Function} scale
@@ -7899,7 +8009,7 @@ function getScale(type, min, max) {
7899
8009
  */
7900
8010
  getXScale: function getXScale(min, max, domain, offset) {
7901
8011
  const $$ = this,
7902
- scale = $$.scale.zoom || getScale($$.axis.getAxisType("x"), min, max);
8012
+ scale = $$.state.loading !== "append" && $$.scale.zoom || getScale($$.axis.getAxisType("x"), min, max);
7903
8013
  return $$.getCustomizedXScale(domain ? scale.domain(domain) : scale, offset);
7904
8014
  },
7905
8015
  /**
@@ -8617,6 +8727,7 @@ function getGroupedDataPointsFn(d) {
8617
8727
 
8618
8728
 
8619
8729
 
8730
+
8620
8731
  /* harmony default export */ var size = ({
8621
8732
  /**
8622
8733
  * Update container size
@@ -8939,9 +9050,11 @@ function getGroupedDataPointsFn(d) {
8939
9050
 
8940
9051
  // for arc
8941
9052
  if ($$.hasArcType()) {
9053
+ var _ref;
8942
9054
  const hasGauge = $$.hasType("gauge"),
8943
- isLegendRight = config.legend_show && state.isLegendRight;
8944
- state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0);
9055
+ isLegendRight = config.legend_show && state.isLegendRight,
9056
+ textWidth = (_ref = state.hasRadar && $$.cache.get(KEY.radarTextWidth)) != null ? _ref : 0;
9057
+ state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0) - textWidth;
8945
9058
  state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10);
8946
9059
  if (hasGauge && !config.gauge_fullCircle) {
8947
9060
  state.arcHeight += state.height - $$.getPaddingBottomForGauge();
@@ -9931,6 +10044,7 @@ function getTextXPos(pos, width) {
9931
10044
  inputType = _state.inputType,
9932
10045
  hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
9933
10046
  hasTreemap = state.hasTreemap,
10047
+ hasRadar = state.hasRadar,
9934
10048
  isRotated = config.axis_rotated,
9935
10049
  hasArcType = $$.hasArcType(),
9936
10050
  svgLeft = $$.getSvgLeft(!0);
@@ -9940,13 +10054,17 @@ function getTextXPos(pos, width) {
9940
10054
  y = currPos.y;
9941
10055
 
9942
10056
  // Determine tooltip position
9943
- if (hasArcType) {
9944
- const raw = inputType === "touch" || $$.hasType("radar");
9945
- if (!raw) {
10057
+ if (hasRadar) {
10058
+ x += x >= width / 2 ? 15 : -(tWidth + 15);
10059
+ y += 15;
10060
+ } else if (hasArcType) {
10061
+ if (!(inputType === "touch")) {
9946
10062
  x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
9947
- y += hasGauge ? height : height / 2;
10063
+ y += hasGauge ? height : height / 2 + tHeight;
9948
10064
  }
9949
- } else if (!hasTreemap) {
10065
+ } else if (hasTreemap) {
10066
+ y += tHeight;
10067
+ } else {
9950
10068
  const padding = {
9951
10069
  top: $$.getCurrentPaddingByDirection("top", !0),
9952
10070
  left: $$.getCurrentPaddingByDirection("left", !0)
@@ -9966,8 +10084,8 @@ function getTextXPos(pos, width) {
9966
10084
  x -= tWidth + (hasTreemap || hasArcType ? 0 : isRotated ? 40 : 38);
9967
10085
  }
9968
10086
  if (y + tHeight > current.height) {
9969
- const gap = hasTreemap ? 0 : 30;
9970
- y -= hasGauge ? tHeight * 3 : tHeight + gap;
10087
+ const gap = hasTreemap ? tHeight + 10 : 30;
10088
+ y -= hasGauge ? tHeight * 1.5 : tHeight + gap;
9971
10089
  }
9972
10090
  const pos = {
9973
10091
  top: y,
@@ -10228,9 +10346,10 @@ function getTextXPos(pos, width) {
10228
10346
  y = state.arcHeight / 2;
10229
10347
  } else if (target === "radar") {
10230
10348
  const _$$$getRadarSize = $$.getRadarSize(),
10231
- width = _$$$getRadarSize[0];
10349
+ width = _$$$getRadarSize[0],
10350
+ height = _$$$getRadarSize[1];
10232
10351
  x = state.width / 2 - width;
10233
- y = asHalfPixel(state.margin.top);
10352
+ y = state.height / 2 - height;
10234
10353
  }
10235
10354
  return "translate(" + x + ", " + y + ")";
10236
10355
  },
@@ -10388,8 +10507,9 @@ function getTextXPos(pos, width) {
10388
10507
  * @private
10389
10508
  */
10390
10509
  isTypeOf: function isTypeOf(d, type) {
10510
+ var _this$config$data_typ;
10391
10511
  const id = isString(d) ? d : d.id,
10392
- dataType = this.config.data_types[id] || this.config.data_type;
10512
+ dataType = this.config && (((_this$config$data_typ = this.config.data_types) == null ? void 0 : _this$config$data_typ[id]) || this.config.data_type);
10393
10513
  return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type;
10394
10514
  },
10395
10515
  hasPointType: function hasPointType() {
@@ -10601,7 +10721,6 @@ let ChartInternal = /*#__PURE__*/function () {
10601
10721
  // defaultAxisTimeFormat
10602
10722
  axisTime: null // axisTimeFormat
10603
10723
  };
10604
-
10605
10724
  const $$ = this;
10606
10725
  $$.api = api; // Chart class instance alias
10607
10726
  $$.config = new Options();
@@ -10801,6 +10920,7 @@ let ChartInternal = /*#__PURE__*/function () {
10801
10920
  hasPolar = $$.hasType("polar");
10802
10921
  // for arc type, set axes to not be shown
10803
10922
  // $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
10923
+
10804
10924
  if (hasAxis) {
10805
10925
  $$.axis = $$.getAxisInstance();
10806
10926
  config.zoom_enabled && $$.initZoom();
@@ -10868,7 +10988,7 @@ let ChartInternal = /*#__PURE__*/function () {
10868
10988
  if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || config.data_labels_backgroundColors) {
10869
10989
  $el.defs = $el.svg.append("defs");
10870
10990
  if (hasAxis) {
10871
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
10991
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(function (v) {
10872
10992
  _newArrowCheck(this, _this3);
10873
10993
  $$.appendClip($el.defs, state.clip[v]);
10874
10994
  }.bind(this));
@@ -10911,7 +11031,6 @@ let ChartInternal = /*#__PURE__*/function () {
10911
11031
  main.append("text").attr("class", $TEXT.text + " " + $COMMON.empty).attr("text-anchor", "middle") // horizontal centering of text at x position in all browsers.
10912
11032
  .attr("dominant-baseline", "middle"); // vertical centering of text at y position in all browsers, except IE.
10913
11033
  }
10914
-
10915
11034
  if (hasAxis) {
10916
11035
  // Regions
10917
11036
  config.regions.length && $$.initRegion();
@@ -14259,11 +14378,23 @@ let AxisRenderer = /*#__PURE__*/function () {
14259
14378
  _newArrowCheck(this, _this4);
14260
14379
  const r2 = r / (orient === "bottom" ? 15 : 23);
14261
14380
  return r ? 11.5 - 2.5 * r2 * (r > 0 ? 1 : -1) : tickLength;
14262
- }.bind(this);
14381
+ }.bind(this),
14382
+ _this$params$owner$co = this.params.owner.config,
14383
+ isRotated = _this$params$owner$co.axis_rotated,
14384
+ inner = _this$params$owner$co.axis_x_tick_text_inner;
14263
14385
  switch (orient) {
14264
14386
  case "bottom":
14265
14387
  lineUpdate.attr("x1", tickPos.x).attr("x2", tickPos.x).attr("y2", this.getTickSize.bind(this));
14266
- textUpdate.attr("x", 0).attr("y", yForText(rotate)).style("text-anchor", textAnchorForText(rotate)).attr("transform", textTransform(rotate));
14388
+ textUpdate.attr("x", 0).attr("y", yForText(rotate)).style("text-anchor", textAnchorForText(rotate)).style("text-anchor", function (d, i, _ref) {
14389
+ let length = _ref.length;
14390
+ _newArrowCheck(this, _this4);
14391
+ if (!isRotated && i === 0 && (inner === !0 || inner.first)) {
14392
+ return "start";
14393
+ } else if (!isRotated && i === length - 1 && (inner === !0 || inner.last)) {
14394
+ return "end";
14395
+ }
14396
+ return textAnchorForText(rotate);
14397
+ }.bind(this)).attr("transform", textTransform(rotate));
14267
14398
  break;
14268
14399
  case "top":
14269
14400
  lineUpdate.attr("x2", 0).attr("y2", -innerTickSize);
@@ -15022,11 +15153,15 @@ let Axis_Axis = /*#__PURE__*/function () {
15022
15153
  const $$ = this.owner,
15023
15154
  axis = $$.axis,
15024
15155
  config = $$.config,
15025
- state = $$.state,
15156
+ _$$$state2 = $$.state,
15157
+ current = _$$$state2.current,
15158
+ isLegendRight = _$$$state2.isLegendRight,
15159
+ legendItemWidth = _$$$state2.legendItemWidth,
15026
15160
  xAxisTickRotate = $$.getAxisTickRotate("x");
15027
15161
  if ((axis.isCategorized() || axis.isTimeSeries()) && config.axis_x_tick_fit && (!config.axis_x_tick_culling || isEmpty(config.axis_x_tick_culling)) && !config.axis_x_tick_multiline && xAxisTickRotate > 0 && xAxisTickRotate < 90) {
15028
- const widthWithoutCurrentPaddingLeft = state.current.width - $$.getCurrentPaddingByDirection("left"),
15029
- maxOverflow = this.getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft - defaultPadding),
15162
+ const y2AxisWidth = config.axis_y2_show && current.maxTickSize.y2.width || 0,
15163
+ widthWithoutCurrentPaddingLeft = current.width - $$.getCurrentPaddingByDirection("left"),
15164
+ maxOverflow = this.getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft - defaultPadding) - y2AxisWidth - (isLegendRight && legendItemWidth || 0),
15030
15165
  xAxisTickTextY2Overflow = Math.max(0, maxOverflow) + defaultPadding;
15031
15166
  // for display inconsistencies between browsers
15032
15167
 
@@ -15273,9 +15408,9 @@ let Axis_Axis = /*#__PURE__*/function () {
15273
15408
  var _this19 = this;
15274
15409
  const $$ = this.owner,
15275
15410
  config = $$.config,
15276
- _$$$state2 = $$.state,
15277
- clip = _$$$state2.clip,
15278
- current = _$$$state2.current,
15411
+ _$$$state3 = $$.state,
15412
+ clip = _$$$state3.clip,
15413
+ current = _$$$state3.current,
15279
15414
  $el = $$.$el;
15280
15415
  ["subX", "x", "y", "y2"].forEach(function (type) {
15281
15416
  _newArrowCheck(this, _this19);
@@ -15498,7 +15633,12 @@ let Axis_Axis = /*#__PURE__*/function () {
15498
15633
  rectElement = eventRect || $el.eventRect,
15499
15634
  updateClientRect = function () {
15500
15635
  _newArrowCheck(this, _this3);
15501
- eventReceiver && (eventReceiver.rect = rectElement.node().getBoundingClientRect());
15636
+ if (eventReceiver) {
15637
+ const scrollPos = getScrollPosition($el.chart.node());
15638
+ eventReceiver.rect = rectElement.node().getBoundingClientRect().toJSON();
15639
+ eventReceiver.rect.top += scrollPos.y;
15640
+ eventReceiver.rect.left += scrollPos.x;
15641
+ }
15502
15642
  }.bind(this);
15503
15643
  if (!rendered || resizing || force) {
15504
15644
  rectElement.attr("x", 0).attr("y", 0).attr("width", width).attr("height", height);
@@ -16849,8 +16989,9 @@ function smoothLines(el, type) {
16849
16989
  if (id === "y2" && !config.axis_y2_show) {
16850
16990
  return isFitPadding ? 0 : rotatedPadding.top;
16851
16991
  }
16852
- const maxtickSize = $$.axis.getMaxTickSize(id);
16853
- if (maxtickSize.height > 13) {
16992
+ const maxtickSize = $$.axis.getMaxTickSize(id),
16993
+ isXAxisTickRotated = config.axis_x_tick_rotate > 0 && (!config.axis_x_tick_autorotate || $$.needToRotateXAxisTickTexts());
16994
+ if ((config.axis_x_tick_multiline || isXAxisTickRotated) && maxtickSize.height > 13) {
16854
16995
  h += maxtickSize.height - 13;
16855
16996
  }
16856
16997
  return h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id === "y2" && !isRotated ? -10 : 0);
@@ -16909,7 +17050,9 @@ function smoothLines(el, type) {
16909
17050
  _$$$state = $$.state,
16910
17051
  axis = _$$$state.axis,
16911
17052
  current = _$$$state.current,
16912
- xAxisLength = current.width - $$.getCurrentPaddingByDirection("left") - $$.getCurrentPaddingByDirection("right"),
17053
+ isLegendRight = _$$$state.isLegendRight,
17054
+ legendItemWidth = _$$$state.legendItemWidth,
17055
+ xAxisLength = current.width - (isLegendRight && legendItemWidth) - $$.getCurrentPaddingByDirection("left") - $$.getCurrentPaddingByDirection("right"),
16913
17056
  tickCountWithPadding = axis.x.tickCount + axis.x.padding.left + axis.x.padding.right,
16914
17057
  _$$$axis$getMaxTickSi2 = $$.axis.getMaxTickSize("x"),
16915
17058
  width = _$$$axis$getMaxTickSi2.width,
@@ -17314,6 +17457,31 @@ function smoothLines(el, type) {
17314
17457
  * }
17315
17458
  */
17316
17459
  axis_x_tick_text_show: !0,
17460
+ /**
17461
+ * Set the first/last axis tick text to be positioned inside of the chart on non-rotated axis.
17462
+ * @name axis․x․tick․text․inner
17463
+ * @memberof Options
17464
+ * @type {boolean|object}
17465
+ * @default false
17466
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.XAxisTickInner)
17467
+ * @example
17468
+ * axis: {
17469
+ * x: {
17470
+ * tick: {
17471
+ * text: {
17472
+ * inner: true,
17473
+ *
17474
+ * // or specify each position of the first and last tick text
17475
+ * inner: {
17476
+ * first: true,
17477
+ * last: true
17478
+ * }
17479
+ * }
17480
+ * }
17481
+ * }
17482
+ * }
17483
+ */
17484
+ axis_x_tick_text_inner: !1,
17317
17485
  /**
17318
17486
  * Set the x Axis tick text's position relatively its original position
17319
17487
  * @name axis․x․tick․text․position
@@ -17493,7 +17661,7 @@ function smoothLines(el, type) {
17493
17661
  */
17494
17662
  axis_x_tick_width: null,
17495
17663
  /**
17496
- * Set to display system tooltip(via 'title' attribute) for tick text
17664
+ * Set to display system tooltip(via `<title>` element) for tick text
17497
17665
  * - **NOTE:** Only available for category axis type (`axis.x.type='category'`)
17498
17666
  * @name axis․x․tick․tooltip
17499
17667
  * @memberof Options
@@ -18241,6 +18409,18 @@ function smoothLines(el, type) {
18241
18409
  * y2 Axis config options
18242
18410
  */
18243
18411
  /* harmony default export */ var y2 = ({
18412
+ /**
18413
+ * Set clip-path attribute for y2 axis element
18414
+ * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
18415
+ * @name axis․y2․clipPath
18416
+ * @memberof Options
18417
+ * @type {boolean}
18418
+ * @default true
18419
+ * @example
18420
+ * // don't set 'clip-path' attribute
18421
+ * clipPath: false
18422
+ */
18423
+ axis_y2_clipPath: !0,
18244
18424
  /**
18245
18425
  * Show or hide y2 axis.
18246
18426
  * - **NOTE**:
@@ -21586,7 +21766,8 @@ function getPosition(isClockwise, type, edge, pos, range, ratio) {
21586
21766
  }
21587
21767
 
21588
21768
  // cache key
21589
- const cacheKey = KEY.radarPoints;
21769
+ const cacheKeyPoints = KEY.radarPoints,
21770
+ cacheKeyTextWidth = KEY.radarTextWidth;
21590
21771
  /* harmony default export */ var radar = ({
21591
21772
  initRadar: function initRadar() {
21592
21773
  const $$ = this,
@@ -21605,6 +21786,13 @@ const cacheKey = KEY.radarPoints;
21605
21786
  // shapes
21606
21787
  $el.radar.shapes = $el.radar.append("g").attr("class", $SHAPE.shapes);
21607
21788
  current.dataMax = config.radar_axis_max || $$.getMinMaxData().max[0].value;
21789
+ if (config.radar_axis_text_show) {
21790
+ config.interaction_enabled && $$.bindRadarEvent();
21791
+
21792
+ // it needs to calculate dimension at the initialization
21793
+ $$.updateRadarLevel();
21794
+ $$.updateRadarAxes();
21795
+ }
21608
21796
  }
21609
21797
  },
21610
21798
  getRadarSize: function getRadarSize() {
@@ -21655,7 +21843,7 @@ const cacheKey = KEY.radarPoints;
21655
21843
  _$$$getRadarSize2 = $$.getRadarSize(),
21656
21844
  width = _$$$getRadarSize2[0],
21657
21845
  height = _$$$getRadarSize2[1],
21658
- points = $$.cache.get(cacheKey) || {},
21846
+ points = $$.cache.get(cacheKeyPoints) || {},
21659
21847
  size = points._size;
21660
21848
  // recalculate position only when the previous dimension has been changed
21661
21849
  if (!size || size.width !== width && size.height !== height) {
@@ -21671,7 +21859,7 @@ const cacheKey = KEY.radarPoints;
21671
21859
  width: width,
21672
21860
  height: height
21673
21861
  };
21674
- $$.cache.add(cacheKey, points);
21862
+ $$.cache.add(cacheKeyPoints, points);
21675
21863
  }
21676
21864
  },
21677
21865
  redrawRadar: function redrawRadar() {
@@ -21692,7 +21880,7 @@ const cacheKey = KEY.radarPoints;
21692
21880
  },
21693
21881
  generateGetRadarPoints: function generateGetRadarPoints() {
21694
21882
  var _this5 = this;
21695
- const points = this.cache.get(cacheKey);
21883
+ const points = this.cache.get(cacheKeyPoints);
21696
21884
  return function (d, i) {
21697
21885
  _newArrowCheck(this, _this5);
21698
21886
  const point = points[d.id][i];
@@ -21806,7 +21994,8 @@ const cacheKey = KEY.radarPoints;
21806
21994
  _config$radar_axis_te2 = _config$radar_axis_te.x,
21807
21995
  x = _config$radar_axis_te2 === void 0 ? 0 : _config$radar_axis_te2,
21808
21996
  _config$radar_axis_te3 = _config$radar_axis_te.y,
21809
- y = _config$radar_axis_te3 === void 0 ? 0 : _config$radar_axis_te3;
21997
+ y = _config$radar_axis_te3 === void 0 ? 0 : _config$radar_axis_te3,
21998
+ textWidth = $$.cache.get(cacheKeyTextWidth) || 0;
21810
21999
  axis.select("text").style("text-anchor", "middle").attr("dy", ".5em").call(function (selection) {
21811
22000
  _newArrowCheck(this, _this8);
21812
22001
  selection.each(function (d) {
@@ -21840,13 +22029,23 @@ const cacheKey = KEY.radarPoints;
21840
22029
  }
21841
22030
  return "translate(" + posX + " " + posY + ")";
21842
22031
  });
22032
+ if (!textWidth) {
22033
+ const widths = [radar.axes, radar.levels].map(function (v) {
22034
+ _newArrowCheck(this, _this8);
22035
+ return getPathBox(v.node()).width;
22036
+ }.bind(this));
22037
+ if (widths.every(function (v) {
22038
+ _newArrowCheck(this, _this8);
22039
+ return v > 0;
22040
+ }.bind(this))) {
22041
+ $$.cache.add(cacheKeyTextWidth, widths[0] - widths[1]);
22042
+ }
22043
+ }
21843
22044
  }
21844
- $$.bindRadarEvent();
21845
22045
  },
21846
22046
  bindRadarEvent: function bindRadarEvent() {
21847
22047
  var _this9 = this;
21848
22048
  const $$ = this,
21849
- config = $$.config,
21850
22049
  state = $$.state,
21851
22050
  _$$$$el2 = $$.$el,
21852
22051
  radar = _$$$$el2.radar,
@@ -21854,40 +22053,38 @@ const cacheKey = KEY.radarPoints;
21854
22053
  focusOnly = $$.isPointFocusOnly(),
21855
22054
  _state = state,
21856
22055
  inputType = _state.inputType,
21857
- transiting = _state.transiting;
21858
- if (config.interaction_enabled) {
21859
- const isMouse = inputType === "mouse",
21860
- hide = function (event) {
21861
- _newArrowCheck(this, _this9);
21862
- state.event = event;
22056
+ transiting = _state.transiting,
22057
+ isMouse = inputType === "mouse",
22058
+ hide = function (event) {
22059
+ _newArrowCheck(this, _this9);
22060
+ state.event = event;
21863
22061
 
21864
- // const index = getIndex(event);
21865
- const index = $$.getDataIndexFromEvent(event),
21866
- noIndex = isUndefined(index);
21867
- if (isMouse || noIndex) {
21868
- $$.hideTooltip();
21869
- focusOnly ? $$.hideCircleFocus() : $$.unexpandCircles();
21870
- if (isMouse) {
21871
- $$.setOverOut(!1, index);
21872
- } else if (noIndex) {
21873
- $$.callOverOutForTouch();
21874
- }
22062
+ // const index = getIndex(event);
22063
+ const index = $$.getDataIndexFromEvent(event),
22064
+ noIndex = isUndefined(index);
22065
+ if (isMouse || noIndex) {
22066
+ $$.hideTooltip();
22067
+ focusOnly ? $$.hideCircleFocus() : $$.unexpandCircles();
22068
+ if (isMouse) {
22069
+ $$.setOverOut(!1, index);
22070
+ } else if (noIndex) {
22071
+ $$.callOverOutForTouch();
21875
22072
  }
21876
- }.bind(this);
21877
- radar.axes.selectAll("text").on(isMouse ? "mouseover " : "touchstart", function (event) {
21878
- _newArrowCheck(this, _this9);
21879
- if (transiting) {
21880
- // skip while transiting
21881
- return;
21882
22073
  }
21883
- state.event = event;
21884
- const index = $$.getDataIndexFromEvent(event);
21885
- $$.selectRectForSingle(svg.node(), index);
21886
- isMouse ? $$.setOverOut(!0, index) : $$.callOverOutForTouch(index);
21887
- }.bind(this)).on("mouseout", isMouse ? hide : null);
21888
- if (!isMouse) {
21889
- svg.on("touchstart", hide);
22074
+ }.bind(this);
22075
+ radar.axes.on(isMouse ? "mouseover " : "touchstart", function (event) {
22076
+ _newArrowCheck(this, _this9);
22077
+ if (transiting) {
22078
+ // skip while transiting
22079
+ return;
21890
22080
  }
22081
+ state.event = event;
22082
+ const index = $$.getDataIndexFromEvent(event);
22083
+ $$.selectRectForSingle(svg.node(), index);
22084
+ isMouse ? $$.setOverOut(!0, index) : $$.callOverOutForTouch(index);
22085
+ }.bind(this)).on("mouseout", isMouse ? hide : null);
22086
+ if (!isMouse) {
22087
+ svg.on("touchstart", hide);
21891
22088
  }
21892
22089
  },
21893
22090
  updateRadarShape: function updateRadarShape() {
@@ -21897,7 +22094,7 @@ const cacheKey = KEY.radarPoints;
21897
22094
  _newArrowCheck(this, _this10);
21898
22095
  return $$.isRadarType(d);
21899
22096
  }.bind(this)),
21900
- points = $$.cache.get(cacheKey),
22097
+ points = $$.cache.get(cacheKeyPoints),
21901
22098
  areas = $$.$el.radar.shapes.selectAll("polygon").data(targets),
21902
22099
  areasEnter = areas.enter().append("g").attr("class", $$.getChartClass("Radar"));
21903
22100
  $$.$T(areas.exit()).remove();
@@ -21914,7 +22111,7 @@ const cacheKey = KEY.radarPoints;
21914
22111
  * @private
21915
22112
  */
21916
22113
  radarCircleX: function radarCircleX(d) {
21917
- return this.cache.get(cacheKey)[d.id][d.index][0];
22114
+ return this.cache.get(cacheKeyPoints)[d.id][d.index][0];
21918
22115
  },
21919
22116
  /**
21920
22117
  * Get data point y coordinate
@@ -21923,7 +22120,7 @@ const cacheKey = KEY.radarPoints;
21923
22120
  * @private
21924
22121
  */
21925
22122
  radarCircleY: function radarCircleY(d) {
21926
- return this.cache.get(cacheKey)[d.id][d.index][1];
22123
+ return this.cache.get(cacheKeyPoints)[d.id][d.index][1];
21927
22124
  }
21928
22125
  });
21929
22126
  // EXTERNAL MODULE: external {"commonjs":"d3-hierarchy","commonjs2":"d3-hierarchy","amd":"d3-hierarchy","root":"d3"}
@@ -23844,7 +24041,8 @@ function setSelection(isSelection, ids, indices, resetOther) {
23844
24041
  * // Get the current subchart selection domain range
23845
24042
  * // Domain value may not be exact returning approximately values.
23846
24043
  * chart.subchart();
23847
- */ // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
24044
+ */
24045
+ // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
23848
24046
  const subchart = function (domainValue) {
23849
24047
  var _this = this;
23850
24048
  const $$ = this.internal,
@@ -24014,18 +24212,17 @@ var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack
24014
24212
  * // Get the current zoomed domain range
24015
24213
  * // Domain value may not be exact returning approximately values.
24016
24214
  * chart.zoom();
24017
- */ // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
24215
+ */
24216
+ // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
24018
24217
  const zoom = function (domainValue) {
24019
24218
  var _this = this,
24020
24219
  _state$domain;
24021
24220
  const $$ = this.internal,
24022
- $el = $$.$el,
24023
24221
  axis = $$.axis,
24024
24222
  config = $$.config,
24025
24223
  org = $$.org,
24026
24224
  scale = $$.scale,
24027
24225
  state = $$.state,
24028
- isRotated = config.axis_rotated,
24029
24226
  isCategorized = axis.isCategorized();
24030
24227
  let domain;
24031
24228
  if (config.zoom_enabled) {
@@ -24040,12 +24237,7 @@ const zoom = function (domainValue) {
24040
24237
  const isWithinRange = $$.withinRange(domain, $$.getZoomDomain("zoom", !0), $$.getZoomDomain("zoom"));
24041
24238
  if (isWithinRange) {
24042
24239
  state.domain = domain;
24043
- if (isCategorized) {
24044
- domain = domain.map(function (v, i) {
24045
- _newArrowCheck(this, _this);
24046
- return +v + (i === 0 ? 0 : 1);
24047
- }.bind(this));
24048
- }
24240
+ domain = $$.getZoomDomainValue(domain);
24049
24241
 
24050
24242
  // hide any possible tooltip show before the zoom
24051
24243
  $$.api.tooltip.hide();
@@ -24054,13 +24246,9 @@ const zoom = function (domainValue) {
24054
24246
  $$.brush.getSelection().call($$.brush.move, domain.map(x));
24055
24247
  // resultDomain = domain;
24056
24248
  } else {
24057
- var _d3ZoomIdentity$scale;
24058
24249
  // in case of 'config.zoom_rescale=true', use org.xScale
24059
- const x = isCategorized ? scale.x.orgScale() : org.xScale || scale.x,
24060
- translate = [-x(domain[0]), 0],
24061
- transform = (_d3ZoomIdentity$scale = external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity.scale(x.range()[1] / (x(domain[1]) - x(domain[0])))).translate.apply(_d3ZoomIdentity$scale, isRotated ? translate.reverse() : translate); // Get transform from given domain value
24062
- // https://github.com/d3/d3-zoom/issues/57#issuecomment-246434951
24063
- $el.eventRect.call($$.zoom.transform, transform);
24250
+ const x = isCategorized ? scale.x.orgScale() : org.xScale || scale.x;
24251
+ $$.updateCurrentZoomTransform(x, domain);
24064
24252
  }
24065
24253
  $$.setZoomResetButton();
24066
24254
  }
@@ -24192,8 +24380,9 @@ extend(zoom, {
24192
24380
  _$$$$el = $$.$el,
24193
24381
  eventRect = _$$$$el.eventRect,
24194
24382
  zoomResetBtn = _$$$$el.zoomResetBtn,
24383
+ zoom = $$.scale.zoom,
24195
24384
  state = $$.state;
24196
- if ($$.scale.zoom) {
24385
+ if (zoom) {
24197
24386
  config.subchart_show ? $$.brush.getSelection().call($$.brush.move, null) : $$.zoom.updateTransformScale(external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity);
24198
24387
  $$.updateZoom(!0);
24199
24388
  zoomResetBtn == null || zoomResetBtn.style("display", "none");
@@ -24955,6 +25144,9 @@ function selection_objectSpread(e) { for (var r = 1, t; r < arguments.length; r+
24955
25144
  // copy current initial x scale in case of rescale option is used
24956
25145
  org.xScale || (org.xScale = scale.x.copy());
24957
25146
  scale.x.domain(domain);
25147
+ } else if (org.xScale) {
25148
+ scale.x.domain(org.xScale.domain());
25149
+ org.xScale = null;
24958
25150
  }
24959
25151
  }.bind(this);
24960
25152
 
@@ -25092,6 +25284,26 @@ function selection_objectSpread(e) { for (var r = 1, t; r < arguments.length; r+
25092
25284
  }
25093
25285
  }
25094
25286
  },
25287
+ /**
25288
+ * Set zoom transform to event rect
25289
+ * @param {Function} x x Axis scale function
25290
+ * @param {Array} domain Domain value to be set
25291
+ * @private
25292
+ */
25293
+ updateCurrentZoomTransform: function updateCurrentZoomTransform(x, domain) {
25294
+ var _d3ZoomIdentity$scale;
25295
+ const $$ = this,
25296
+ eventRect = $$.$el.eventRect,
25297
+ config = $$.config,
25298
+ isRotated = config.axis_rotated,
25299
+ translate = [-x(domain[0]), 0],
25300
+ transform = (_d3ZoomIdentity$scale = external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_.zoomIdentity.scale(x.range()[1] / (x(domain[1]) - x(domain[0])))).translate.apply(_d3ZoomIdentity$scale, isRotated ? translate.reverse() : translate);
25301
+
25302
+ // Get transform from given domain value
25303
+ // https://github.com/d3/d3-zoom/issues/57#issuecomment-246434951
25304
+
25305
+ eventRect.call($$.zoom.transform, transform);
25306
+ },
25095
25307
  /**
25096
25308
  * Attach zoom event on <rect>
25097
25309
  * @private
@@ -25560,7 +25772,7 @@ let _defaults = {};
25560
25772
 
25561
25773
  /**
25562
25774
  * @namespace bb
25563
- * @version 3.10.3
25775
+ * @version 3.11.0-next.1
25564
25776
  */
25565
25777
  const bb = {
25566
25778
  /**
@@ -25570,7 +25782,7 @@ const bb = {
25570
25782
  * bb.version; // "1.0.0"
25571
25783
  * @memberof bb
25572
25784
  */
25573
- version: "3.10.3",
25785
+ version: "3.11.0-next.1",
25574
25786
  /**
25575
25787
  * Generate chart
25576
25788
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: