billboard.js 3.10.3 → 3.11.0-next.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.
Files changed (82) hide show
  1. package/README.md +0 -1
  2. package/dist/billboard.css +5 -4
  3. package/dist/billboard.js +598 -220
  4. package/dist/billboard.min.css +2 -2
  5. package/dist/billboard.min.js +2 -2
  6. package/dist/billboard.pkgd.js +2828 -2456
  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 +31 -15
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +31 -15
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +30 -15
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +30 -15
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2222 -2214
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +2252 -2228
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +2253 -2229
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +2 -2
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +2253 -2230
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +2259 -2238
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  28. package/dist/theme/dark.css +7 -7
  29. package/dist/theme/dark.min.css +2 -2
  30. package/dist/theme/datalab.css +7 -7
  31. package/dist/theme/datalab.min.css +2 -2
  32. package/dist/theme/graph.css +7 -7
  33. package/dist/theme/graph.min.css +2 -2
  34. package/dist/theme/insight.css +7 -7
  35. package/dist/theme/insight.min.css +2 -2
  36. package/dist/theme/modern.css +7 -7
  37. package/dist/theme/modern.min.css +2 -2
  38. package/dist-esm/billboard.js +517 -180
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +4 -4
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +7 -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 +42 -46
  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 +12 -5
  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 +14 -1
  59. package/src/ChartInternal/internals/tooltip.ts +12 -6
  60. package/src/ChartInternal/internals/transform.ts +6 -2
  61. package/src/ChartInternal/internals/type.ts +1 -1
  62. package/src/ChartInternal/shape/arc.ts +110 -34
  63. package/src/ChartInternal/shape/gauge.ts +8 -4
  64. package/src/ChartInternal/shape/radar.ts +58 -45
  65. package/src/config/Options/axis/x.ts +27 -1
  66. package/src/config/Options/axis/y2.ts +13 -0
  67. package/src/config/Options/common/legend.ts +17 -0
  68. package/src/config/Options/common/tooltip.ts +1 -0
  69. package/src/config/Options/shape/arc.ts +40 -3
  70. package/src/config/Options/shape/gauge.ts +23 -2
  71. package/src/config/Options/shape/pie.ts +2 -2
  72. package/src/config/classes.ts +1 -0
  73. package/src/module/Cache.ts +1 -0
  74. package/src/module/util.ts +16 -2
  75. package/src/scss/billboard.scss +2 -1
  76. package/src/scss/theme/dark.scss +2 -1
  77. package/src/scss/theme/datalab.scss +2 -1
  78. package/src/scss/theme/graph.scss +2 -1
  79. package/src/scss/theme/insight.scss +2 -1
  80. package/src/scss/theme/modern.scss +2 -1
  81. package/types/options.d.ts +28 -4
  82. package/types/options.shape.d.ts +44 -0
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.2
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,
@@ -886,13 +886,14 @@ const toArray = function (v) {
886
886
  */
887
887
  function addCssRules(style, selector, prop) {
888
888
  var _this9 = this;
889
- const rootSelctor = style.rootSelctor,
889
+ const _style$rootSelector = style.rootSelector,
890
+ rootSelector = _style$rootSelector === void 0 ? "" : _style$rootSelector,
890
891
  sheet = style.sheet,
891
892
  getSelector = function (s) {
892
893
  _newArrowCheck(this, _this9);
893
894
  return s.replace(/\s?(bb-)/g, ".$1").replace(/\.+/g, ".");
894
895
  }.bind(this),
895
- rule = rootSelctor + " " + getSelector(selector) + " {" + prop.join(";") + "}";
896
+ rule = rootSelector + " " + getSelector(selector) + " {" + prop.join(";") + "}";
896
897
  return sheet[sheet.insertRule ? "insertRule" : "addRule"](rule, sheet.cssRules.length);
897
898
  }
898
899
 
@@ -919,6 +920,20 @@ function getCssRules(styleSheets) {
919
920
  return rules;
920
921
  }
921
922
 
923
+ /**
924
+ * Get current window and container scroll position
925
+ * @param {HTMLElement} node Target element
926
+ * @returns {object} window scroll position
927
+ * @private
928
+ */
929
+ function getScrollPosition(node) {
930
+ var _ref2, _ref3, _window$pageXOffset, _ref4, _ref5, _window$pageYOffset;
931
+ return {
932
+ x: (_ref2 = ((_ref3 = (_window$pageXOffset = win.pageXOffset) != null ? _window$pageXOffset : win.scrollX) != null ? _ref3 : 0) + node.scrollLeft) != null ? _ref2 : 0,
933
+ y: (_ref4 = ((_ref5 = (_window$pageYOffset = win.pageYOffset) != null ? _window$pageYOffset : win.scrollY) != null ? _ref5 : 0) + node.scrollTop) != null ? _ref4 : 0
934
+ };
935
+ }
936
+
922
937
  /**
923
938
  * Gets the SVGMatrix of an SVGGElement
924
939
  * @param {SVGElement} node Node element
@@ -1333,6 +1348,7 @@ const $COMMON = {
1333
1348
  const $ARC = {
1334
1349
  arc: "bb-arc",
1335
1350
  arcLabelLine: "bb-arc-label-line",
1351
+ arcRange: "bb-arc-range",
1336
1352
  arcs: "bb-arcs",
1337
1353
  chartArc: "bb-chart-arc",
1338
1354
  chartArcs: "bb-chart-arcs",
@@ -1511,7 +1527,6 @@ let Element = function () {
1511
1527
  // $$.contextLine
1512
1528
  area: null // $$.contextArea
1513
1529
  },
1514
-
1515
1530
  arcs: null,
1516
1531
  bar: null,
1517
1532
  // mainBar,
@@ -1532,7 +1547,6 @@ let Element = function () {
1532
1547
  // xgrid,
1533
1548
  y: null // ygrid,
1534
1549
  },
1535
-
1536
1550
  gridLines: {
1537
1551
  main: null,
1538
1552
  // gridLines
@@ -1540,13 +1554,11 @@ let Element = function () {
1540
1554
  // xgridLines,
1541
1555
  y: null // ygridLines
1542
1556
  },
1543
-
1544
1557
  region: {
1545
1558
  main: null,
1546
1559
  // region
1547
1560
  list: null // mainRegion
1548
1561
  },
1549
-
1550
1562
  eventRect: null,
1551
1563
  zoomResetBtn: null // drag zoom reset button
1552
1564
  };
@@ -1626,7 +1638,6 @@ let State = function () {
1626
1638
  types: [],
1627
1639
  needle: undefined // arc needle current value
1628
1640
  },
1629
-
1630
1641
  // legend
1631
1642
  isLegendRight: !1,
1632
1643
  isLegendInset: !1,
@@ -1645,7 +1656,6 @@ let State = function () {
1645
1656
  // event data bound of previoous eventRect
1646
1657
  coords: [] // coordination value of previous eventRect
1647
1658
  },
1648
-
1649
1659
  axis: {
1650
1660
  x: {
1651
1661
  padding: {
@@ -3261,7 +3271,12 @@ var data_this = undefined;
3261
3271
  * - **Available Values:**
3262
3272
  * - circle
3263
3273
  * - rectangle
3274
+ * @property {boolean} [legend.format] Set formatter function for legend text.
3275
+ * The argument:<br>
3276
+ * - `id`: legend text(which is data id) value
3277
+ * @property {boolean} [legend.tooltip=false] Show full legend text value using system tooltip(via `<title>` element).
3264
3278
  * @property {boolean} [legend.usePoint=false] Whether to use custom points in legend.
3279
+ * @see [Demo: format](https://naver.github.io/billboard.js/demo/#Legend.LegendFormat)
3265
3280
  * @see [Demo: item.interaction](https://naver.github.io/billboard.js/demo/#Legend.LegendItemInteraction)
3266
3281
  * @see [Demo: item.tile.type](https://naver.github.io/billboard.js/demo/#Legend.LegendItemTileType)
3267
3282
  * @see [Demo: position](https://naver.github.io/billboard.js/demo/#Legend.LegendPosition)
@@ -3324,6 +3339,16 @@ var data_this = undefined;
3324
3339
  * r: 10
3325
3340
  * }
3326
3341
  * },
3342
+ * format: function(id) {
3343
+ * // set ellipsis string when length is > 5
3344
+ * // to get full legend value, combine with 'legend.tooltip=true'
3345
+ * if (id.length > 5) {
3346
+ * id = id.substr(0, 5) + "...";
3347
+ * }
3348
+ *
3349
+ * return id;
3350
+ * },
3351
+ * tooltip: true,
3327
3352
  * usePoint: true
3328
3353
  * }
3329
3354
  */
@@ -3344,9 +3369,11 @@ var data_this = undefined;
3344
3369
  legend_item_tile_height: 10,
3345
3370
  legend_item_tile_r: 5,
3346
3371
  legend_item_tile_type: "rectangle",
3372
+ legend_format: undefined,
3347
3373
  legend_padding: 0,
3348
3374
  legend_position: "bottom",
3349
3375
  legend_show: !0,
3376
+ legend_tooltip: !1,
3350
3377
  legend_usePoint: !1
3351
3378
  });
3352
3379
  ;// CONCATENATED MODULE: ./src/config/Options/common/title.ts
@@ -3457,6 +3484,7 @@ var tooltip_this = undefined;
3457
3484
  * - **{=CLASS_TOOLTIP_NAME}**: default tooltip data class name (ex. `bb-tooltip-name-data1`)
3458
3485
  * - **{=TITLE}**: title value.
3459
3486
  * - **{=COLOR}**: data color.
3487
+ * - **{=NAME}**: data id value.
3460
3488
  * - **{=VALUE}**: data value.
3461
3489
  * @property {object} [tooltip.contents.text=undefined] Set additional text content within data loop, using template syntax.
3462
3490
  * - **NOTE:** It should contain `{ key: Array, ... }` value
@@ -3716,6 +3744,7 @@ const KEY = {
3716
3744
  dataTotalPerIndex: "$totalPerIndex",
3717
3745
  legendItemTextBox: "legendItemTextBox",
3718
3746
  radarPoints: "$radarPoints",
3747
+ radarTextWidth: "$radarTextWidth",
3719
3748
  setOverOut: "setOverOut",
3720
3749
  callOverOutForTouch: "callOverOutForTouch",
3721
3750
  textRect: "textRect"
@@ -4034,7 +4063,6 @@ function runWorker(useWorker, fn, callback, depsFn) {
4034
4063
  // });
4035
4064
  };
4036
4065
  }
4037
-
4038
4066
  return runFn;
4039
4067
  }
4040
4068
  // EXTERNAL MODULE: external {"commonjs":"d3-dsv","commonjs2":"d3-dsv","amd":"d3-dsv","root":"d3"}
@@ -5065,13 +5093,17 @@ function getDataKeyForJson(keysParam, config) {
5065
5093
  let fn;
5066
5094
  if (orderAsc || orderDesc) {
5067
5095
  const reducer = function (p, c) {
5068
- _newArrowCheck(this, _this29);
5069
- return p + Math.abs(c.value);
5070
- }.bind(this);
5096
+ _newArrowCheck(this, _this29);
5097
+ return p + Math.abs(c.value);
5098
+ }.bind(this),
5099
+ sum = function (v) {
5100
+ _newArrowCheck(this, _this29);
5101
+ return isNumber(v) ? v : "values" in v ? v.values.reduce(reducer, 0) : v.value;
5102
+ }.bind(this);
5071
5103
  fn = function (t1, t2) {
5072
5104
  _newArrowCheck(this, _this29);
5073
- const t1Sum = "values" in t1 ? t1.values.reduce(reducer, 0) : t1.value,
5074
- t2Sum = "values" in t2 ? t2.values.reduce(reducer, 0) : t2.value;
5105
+ const t1Sum = sum(t1),
5106
+ t2Sum = sum(t2);
5075
5107
  return isReversed ? orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum : orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;
5076
5108
  }.bind(this);
5077
5109
  } else if (isFunction(order)) {
@@ -5122,6 +5154,7 @@ function getDataKeyForJson(keysParam, config) {
5122
5154
  */
5123
5155
  getDataIndexFromEvent: function getDataIndexFromEvent(event) {
5124
5156
  const $$ = this,
5157
+ $el = $$.$el,
5125
5158
  config = $$.config,
5126
5159
  _$$$state = $$.state,
5127
5160
  hasRadar = _$$$state.hasRadar,
@@ -5141,8 +5174,9 @@ function getDataKeyForJson(keysParam, config) {
5141
5174
  index = d && Object.keys(d).length === 1 ? d.index : undefined;
5142
5175
  } else {
5143
5176
  const isRotated = config.axis_rotated,
5177
+ scrollPos = getScrollPosition($el.chart.node()),
5144
5178
  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);
5179
+ index = findIndex(coords, isRotated ? e.clientY + scrollPos.y - rect.top : e.clientX + scrollPos.x - rect.left, 0, coords.length - 1, isRotated);
5146
5180
  }
5147
5181
  return index;
5148
5182
  },
@@ -5190,6 +5224,7 @@ function getDataKeyForJson(keysParam, config) {
5190
5224
  return $$.findClosest(target.values, pos);
5191
5225
  }.bind(this));
5192
5226
  // map to array of closest points of each target
5227
+
5193
5228
  // decide closest point and return
5194
5229
  return $$.findClosest(candidates, pos);
5195
5230
  },
@@ -5412,7 +5447,7 @@ function getDataKeyForJson(keysParam, config) {
5412
5447
 
5413
5448
  // otherwise, based on the rendered angle value
5414
5449
  } else {
5415
- const gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.getGaugeStartAngle() * -2,
5450
+ const gaugeArcLength = config.gauge_fullCircle ? $$.getArcLength() : $$.getStartingAngle() * -2,
5416
5451
  arcLength = $$.hasType("gauge") ? gaugeArcLength : Math.PI * 2;
5417
5452
  ratio = (d.endAngle - d.startAngle) / arcLength;
5418
5453
  }
@@ -5546,8 +5581,16 @@ function callDone(fn, resizeAfter) {
5546
5581
  load: function load(rawTargets, args) {
5547
5582
  var _this = this;
5548
5583
  const $$ = this,
5584
+ axis = $$.axis,
5549
5585
  data = $$.data,
5550
- append = args.append;
5586
+ org = $$.org,
5587
+ scale = $$.scale,
5588
+ append = args.append,
5589
+ zoomState = {
5590
+ domain: null,
5591
+ currentDomain: null,
5592
+ x: null
5593
+ };
5551
5594
  let targets = rawTargets;
5552
5595
  if (targets) {
5553
5596
  // filter loading targets if needed
@@ -5581,6 +5624,20 @@ function callDone(fn, resizeAfter) {
5581
5624
 
5582
5625
  // Set targets
5583
5626
  $$.updateTargets(data.targets);
5627
+ if (scale.zoom) {
5628
+ zoomState.x = axis.isCategorized() ? scale.x.orgScale() : (org.xScale || scale.x).copy();
5629
+ zoomState.domain = $$.getXDomain(data.targets); // get updated xDomain
5630
+
5631
+ zoomState.x.domain(zoomState.domain);
5632
+ zoomState.currentDomain = $$.zoom.getDomain(); // current zoomed domain
5633
+
5634
+ // reset zoom state when new data loaded is out of range
5635
+ if (!$$.withinRange(zoomState.currentDomain, undefined, zoomState.domain)) {
5636
+ scale.x.domain(zoomState.domain);
5637
+ scale.zoom = null;
5638
+ $$.$el.eventRect.property("__zoom", null);
5639
+ }
5640
+ }
5584
5641
 
5585
5642
  // Redraw with new targets
5586
5643
  $$.redraw({
@@ -5589,6 +5646,20 @@ function callDone(fn, resizeAfter) {
5589
5646
  withLegend: !0
5590
5647
  });
5591
5648
 
5649
+ // when load happens on zoom state
5650
+ if (scale.zoom) {
5651
+ // const x = (axis.isCategorized() ? scale.x.orgScale() : (org.xScale || scale.x)).copy();
5652
+
5653
+ org.xDomain = zoomState.domain;
5654
+ org.xScale = zoomState.x;
5655
+ if (axis.isCategorized()) {
5656
+ zoomState.currentDomain = $$.getZoomDomainValue(zoomState.currentDomain);
5657
+ org.xDomain = $$.getZoomDomainValue(org.xDomain);
5658
+ org.xScale = zoomState.x.domain(org.xDomain);
5659
+ }
5660
+ $$.updateCurrentZoomTransform(zoomState.x, zoomState.currentDomain);
5661
+ }
5662
+
5592
5663
  // Update current state chart type and elements list after redraw
5593
5664
  $$.updateTypesElements();
5594
5665
  callDone.call($$, args.done, args.resizeAfter);
@@ -5869,7 +5940,8 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
5869
5940
  screenX: x,
5870
5941
  screenY: y,
5871
5942
  clientX: x,
5872
- clientY: y
5943
+ clientY: y,
5944
+ bubbles: hasRadar // radar type needs to bubble up event
5873
5945
  });
5874
5946
  }
5875
5947
  },
@@ -6634,7 +6706,6 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
6634
6706
  x.domain(domainValue);
6635
6707
  // zoomEnabled && $$.zoom.updateScaleExtent();
6636
6708
  }
6637
-
6638
6709
  if (withUpdateOrgXDomain || withUpdateXDomain) {
6639
6710
  zoomEnabled && $$.zoom.updateScaleExtent();
6640
6711
  }
@@ -6697,6 +6768,28 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
6697
6768
  }
6698
6769
  return [min, max];
6699
6770
  },
6771
+ /**
6772
+ * Return zoom domain from given domain
6773
+ * - 'category' type need to add offset to original value
6774
+ * @param {Array} domainValue domain value
6775
+ * @returns {Array} Zoom domain
6776
+ * @private
6777
+ */
6778
+ getZoomDomainValue: function getZoomDomainValue(domainValue) {
6779
+ var _this8 = this;
6780
+ const $$ = this,
6781
+ config = $$.config,
6782
+ axis = $$.axis;
6783
+ if (axis.isCategorized() && Array.isArray(domainValue)) {
6784
+ const isInverted = config.axis_x_inverted,
6785
+ domain = domainValue.map(function (v, i) {
6786
+ _newArrowCheck(this, _this8);
6787
+ return +v + (i === 0 ? +isInverted : +!isInverted);
6788
+ }.bind(this)); // need to add offset to original value for 'category' type
6789
+ return domain;
6790
+ }
6791
+ return domainValue;
6792
+ },
6700
6793
  /**
6701
6794
  * Converts pixels to axis' scale values
6702
6795
  * @param {string} type Axis type
@@ -6727,7 +6820,10 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
6727
6820
  * @private
6728
6821
  */
6729
6822
  withinRange: function withinRange(domain, current, range) {
6730
- var _this8 = this;
6823
+ var _this9 = this;
6824
+ if (current === void 0) {
6825
+ current = [0, 0];
6826
+ }
6731
6827
  const $$ = this,
6732
6828
  isInverted = $$.config.axis_x_inverted,
6733
6829
  _ref3 = range,
@@ -6738,10 +6834,10 @@ const schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd",
6738
6834
  isInverted && target.reverse();
6739
6835
  if (target[0] < target[1]) {
6740
6836
  return domain.every(function (v, i) {
6741
- var _this9 = this;
6742
- _newArrowCheck(this, _this8);
6837
+ var _this10 = this;
6838
+ _newArrowCheck(this, _this9);
6743
6839
  return (i === 0 ? isInverted ? +v <= min : +v >= min : isInverted ? +v >= max : +v <= max) && !domain.every(function (v, i) {
6744
- _newArrowCheck(this, _this9);
6840
+ _newArrowCheck(this, _this10);
6745
6841
  return v === current[i];
6746
6842
  }.bind(this));
6747
6843
  }.bind(this));
@@ -6860,6 +6956,21 @@ function getLegendColor(id) {
6860
6956
  color = $$.levelColor ? $$.levelColor(data.values[0].value) : $$.color(data);
6861
6957
  return color;
6862
6958
  }
6959
+
6960
+ /**
6961
+ * Get formatted text value
6962
+ * @param {string} id Legend text id
6963
+ * @returns {string} Formatted legend text
6964
+ */
6965
+ function getFormattedText(id) {
6966
+ var _config$data_names$id;
6967
+ const config = this.config;
6968
+ let text = (_config$data_names$id = config.data_names[id]) != null ? _config$data_names$id : id;
6969
+ if (isFunction(config.legend_format)) {
6970
+ text = config.legend_format(text);
6971
+ }
6972
+ return text;
6973
+ }
6863
6974
  /* harmony default export */ var internals_legend = ({
6864
6975
  /**
6865
6976
  * Initialize the legend.
@@ -7357,10 +7468,13 @@ function getLegendColor(id) {
7357
7468
  if (state.isLegendInset && dimension.max.width > 0 && background.size() === 0) {
7358
7469
  background = legend.insert("g", "." + $LEGEND.legendItem).attr("class", $LEGEND.legendBackground).append("rect");
7359
7470
  }
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
7471
+ if (config.legend_tooltip) {
7472
+ legend.selectAll("title").data(targetIdz).text(function (id) {
7473
+ _newArrowCheck(this, _this4);
7474
+ return id;
7475
+ }.bind(this));
7476
+ }
7477
+ const texts = legend.selectAll("text").data(targetIdz).text(getFormattedText.bind($$)) // MEMO: needed for update
7364
7478
  .each(function (id, i) {
7365
7479
  updatePositions(this, id, i);
7366
7480
  });
@@ -7495,10 +7609,13 @@ function getLegendColor(id) {
7495
7609
  // Define g for legend area
7496
7610
 
7497
7611
  $$.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) {
7612
+ if (config.legend_tooltip) {
7613
+ l.append("title").text(function (id) {
7614
+ _newArrowCheck(this, _this6);
7615
+ return id;
7616
+ }.bind(this));
7617
+ }
7618
+ l.append("text").text(getFormattedText.bind($$)).each(function (id, i) {
7502
7619
  updatePositions(this, id, i);
7503
7620
  }).style("pointer-events", $$.getStylePropValue("none")).attr("x", isLegendRightOrInset ? posFn.xText : -200).attr("y", isLegendRightOrInset ? -200 : posFn.yText);
7504
7621
  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 +8007,8 @@ function getScale(type, min, max) {
7890
8007
  /* harmony default export */ var scale = ({
7891
8008
  /**
7892
8009
  * Get x Axis scale function
7893
- * @param {number} min Min value
7894
- * @param {number} max Max value
8010
+ * @param {number} min Min range value
8011
+ * @param {number} max Max range value
7895
8012
  * @param {Array} domain Domain value
7896
8013
  * @param {Function} offset The offset getter to be sum
7897
8014
  * @returns {Function} scale
@@ -7899,7 +8016,7 @@ function getScale(type, min, max) {
7899
8016
  */
7900
8017
  getXScale: function getXScale(min, max, domain, offset) {
7901
8018
  const $$ = this,
7902
- scale = $$.scale.zoom || getScale($$.axis.getAxisType("x"), min, max);
8019
+ scale = $$.state.loading !== "append" && $$.scale.zoom || getScale($$.axis.getAxisType("x"), min, max);
7903
8020
  return $$.getCustomizedXScale(domain ? scale.domain(domain) : scale, offset);
7904
8021
  },
7905
8022
  /**
@@ -8617,6 +8734,7 @@ function getGroupedDataPointsFn(d) {
8617
8734
 
8618
8735
 
8619
8736
 
8737
+
8620
8738
  /* harmony default export */ var size = ({
8621
8739
  /**
8622
8740
  * Update container size
@@ -8939,10 +9057,22 @@ function getGroupedDataPointsFn(d) {
8939
9057
 
8940
9058
  // for arc
8941
9059
  if ($$.hasArcType()) {
9060
+ var _ref, _config$arc_rangeText;
8942
9061
  const hasGauge = $$.hasType("gauge"),
8943
- isLegendRight = config.legend_show && state.isLegendRight;
8944
- state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0);
9062
+ isLegendRight = config.legend_show && state.isLegendRight,
9063
+ textWidth = (_ref = state.hasRadar && $$.cache.get(KEY.radarTextWidth)) != null ? _ref : 0;
9064
+ state.arcWidth = state.width - (isLegendRight ? currLegend.width + 10 : 0) - textWidth;
8945
9065
  state.arcHeight = state.height - (isLegendRight && !hasGauge ? 0 : 10);
9066
+ if ((_config$arc_rangeText = config.arc_rangeText_values) != null && _config$arc_rangeText.length) {
9067
+ if (hasGauge) {
9068
+ state.arcWidth -= 25;
9069
+ state.arcHeight -= 10;
9070
+ state.margin.left += 10;
9071
+ } else {
9072
+ state.arcHeight -= 20;
9073
+ state.margin.top += 10;
9074
+ }
9075
+ }
8946
9076
  if (hasGauge && !config.gauge_fullCircle) {
8947
9077
  state.arcHeight += state.height - $$.getPaddingBottomForGauge();
8948
9078
  }
@@ -9931,6 +10061,7 @@ function getTextXPos(pos, width) {
9931
10061
  inputType = _state.inputType,
9932
10062
  hasGauge = $$.hasType("gauge") && !config.gauge_fullCircle,
9933
10063
  hasTreemap = state.hasTreemap,
10064
+ hasRadar = state.hasRadar,
9934
10065
  isRotated = config.axis_rotated,
9935
10066
  hasArcType = $$.hasArcType(),
9936
10067
  svgLeft = $$.getSvgLeft(!0);
@@ -9940,13 +10071,17 @@ function getTextXPos(pos, width) {
9940
10071
  y = currPos.y;
9941
10072
 
9942
10073
  // Determine tooltip position
9943
- if (hasArcType) {
9944
- const raw = inputType === "touch" || $$.hasType("radar");
9945
- if (!raw) {
10074
+ if (hasRadar) {
10075
+ x += x >= width / 2 ? 15 : -(tWidth + 15);
10076
+ y += 15;
10077
+ } else if (hasArcType) {
10078
+ if (!(inputType === "touch")) {
9946
10079
  x += (width - (isLegendRight ? $$.getLegendWidth() : 0)) / 2;
9947
- y += hasGauge ? height : height / 2;
10080
+ y += hasGauge ? height : height / 2 + tHeight;
9948
10081
  }
9949
- } else if (!hasTreemap) {
10082
+ } else if (hasTreemap) {
10083
+ y += tHeight;
10084
+ } else {
9950
10085
  const padding = {
9951
10086
  top: $$.getCurrentPaddingByDirection("top", !0),
9952
10087
  left: $$.getCurrentPaddingByDirection("left", !0)
@@ -9966,8 +10101,8 @@ function getTextXPos(pos, width) {
9966
10101
  x -= tWidth + (hasTreemap || hasArcType ? 0 : isRotated ? 40 : 38);
9967
10102
  }
9968
10103
  if (y + tHeight > current.height) {
9969
- const gap = hasTreemap ? 0 : 30;
9970
- y -= hasGauge ? tHeight * 3 : tHeight + gap;
10104
+ const gap = hasTreemap ? tHeight + 10 : 30;
10105
+ y -= hasGauge ? tHeight * 1.5 : tHeight + gap;
9971
10106
  }
9972
10107
  const pos = {
9973
10108
  top: y,
@@ -10221,16 +10356,21 @@ function getTextXPos(pos, width) {
10221
10356
  x = 0;
10222
10357
  y = isRotated ? 0 : state.height2;
10223
10358
  } else if (target === "arc") {
10359
+ var _config$arc_rangeText;
10224
10360
  x = state.arcWidth / 2;
10225
10361
  y = state.arcHeight / 2;
10362
+ if ((_config$arc_rangeText = config.arc_rangeText_values) != null && _config$arc_rangeText.length) {
10363
+ y += 5 + ($$.hasType("gauge") && config.title_text ? 10 : 0);
10364
+ }
10226
10365
  } else if (target === "polar") {
10227
10366
  x = state.arcWidth / 2;
10228
10367
  y = state.arcHeight / 2;
10229
10368
  } else if (target === "radar") {
10230
10369
  const _$$$getRadarSize = $$.getRadarSize(),
10231
- width = _$$$getRadarSize[0];
10370
+ width = _$$$getRadarSize[0],
10371
+ height = _$$$getRadarSize[1];
10232
10372
  x = state.width / 2 - width;
10233
- y = asHalfPixel(state.margin.top);
10373
+ y = state.height / 2 - height;
10234
10374
  }
10235
10375
  return "translate(" + x + ", " + y + ")";
10236
10376
  },
@@ -10388,8 +10528,9 @@ function getTextXPos(pos, width) {
10388
10528
  * @private
10389
10529
  */
10390
10530
  isTypeOf: function isTypeOf(d, type) {
10531
+ var _this$config$data_typ;
10391
10532
  const id = isString(d) ? d : d.id,
10392
- dataType = this.config.data_types[id] || this.config.data_type;
10533
+ dataType = this.config && (((_this$config$data_typ = this.config.data_types) == null ? void 0 : _this$config$data_typ[id]) || this.config.data_type);
10393
10534
  return isArray(type) ? type.indexOf(dataType) >= 0 : dataType === type;
10394
10535
  },
10395
10536
  hasPointType: function hasPointType() {
@@ -10601,7 +10742,6 @@ let ChartInternal = /*#__PURE__*/function () {
10601
10742
  // defaultAxisTimeFormat
10602
10743
  axisTime: null // axisTimeFormat
10603
10744
  };
10604
-
10605
10745
  const $$ = this;
10606
10746
  $$.api = api; // Chart class instance alias
10607
10747
  $$.config = new Options();
@@ -10801,6 +10941,7 @@ let ChartInternal = /*#__PURE__*/function () {
10801
10941
  hasPolar = $$.hasType("polar");
10802
10942
  // for arc type, set axes to not be shown
10803
10943
  // $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
10944
+
10804
10945
  if (hasAxis) {
10805
10946
  $$.axis = $$.getAxisInstance();
10806
10947
  config.zoom_enabled && $$.initZoom();
@@ -10868,7 +11009,7 @@ let ChartInternal = /*#__PURE__*/function () {
10868
11009
  if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || config.data_labels_backgroundColors) {
10869
11010
  $el.defs = $el.svg.append("defs");
10870
11011
  if (hasAxis) {
10871
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach(function (v) {
11012
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach(function (v) {
10872
11013
  _newArrowCheck(this, _this3);
10873
11014
  $$.appendClip($el.defs, state.clip[v]);
10874
11015
  }.bind(this));
@@ -10911,7 +11052,6 @@ let ChartInternal = /*#__PURE__*/function () {
10911
11052
  main.append("text").attr("class", $TEXT.text + " " + $COMMON.empty).attr("text-anchor", "middle") // horizontal centering of text at x position in all browsers.
10912
11053
  .attr("dominant-baseline", "middle"); // vertical centering of text at y position in all browsers, except IE.
10913
11054
  }
10914
-
10915
11055
  if (hasAxis) {
10916
11056
  // Regions
10917
11057
  config.regions.length && $$.initRegion();
@@ -14259,11 +14399,23 @@ let AxisRenderer = /*#__PURE__*/function () {
14259
14399
  _newArrowCheck(this, _this4);
14260
14400
  const r2 = r / (orient === "bottom" ? 15 : 23);
14261
14401
  return r ? 11.5 - 2.5 * r2 * (r > 0 ? 1 : -1) : tickLength;
14262
- }.bind(this);
14402
+ }.bind(this),
14403
+ _this$params$owner$co = this.params.owner.config,
14404
+ isRotated = _this$params$owner$co.axis_rotated,
14405
+ inner = _this$params$owner$co.axis_x_tick_text_inner;
14263
14406
  switch (orient) {
14264
14407
  case "bottom":
14265
14408
  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));
14409
+ textUpdate.attr("x", 0).attr("y", yForText(rotate)).style("text-anchor", textAnchorForText(rotate)).style("text-anchor", function (d, i, _ref) {
14410
+ let length = _ref.length;
14411
+ _newArrowCheck(this, _this4);
14412
+ if (!isRotated && i === 0 && (inner === !0 || inner.first)) {
14413
+ return "start";
14414
+ } else if (!isRotated && i === length - 1 && (inner === !0 || inner.last)) {
14415
+ return "end";
14416
+ }
14417
+ return textAnchorForText(rotate);
14418
+ }.bind(this)).attr("transform", textTransform(rotate));
14267
14419
  break;
14268
14420
  case "top":
14269
14421
  lineUpdate.attr("x2", 0).attr("y2", -innerTickSize);
@@ -15022,11 +15174,15 @@ let Axis_Axis = /*#__PURE__*/function () {
15022
15174
  const $$ = this.owner,
15023
15175
  axis = $$.axis,
15024
15176
  config = $$.config,
15025
- state = $$.state,
15177
+ _$$$state2 = $$.state,
15178
+ current = _$$$state2.current,
15179
+ isLegendRight = _$$$state2.isLegendRight,
15180
+ legendItemWidth = _$$$state2.legendItemWidth,
15026
15181
  xAxisTickRotate = $$.getAxisTickRotate("x");
15027
15182
  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),
15183
+ const y2AxisWidth = config.axis_y2_show && current.maxTickSize.y2.width || 0,
15184
+ widthWithoutCurrentPaddingLeft = current.width - $$.getCurrentPaddingByDirection("left"),
15185
+ maxOverflow = this.getXAxisTickMaxOverflow(xAxisTickRotate, widthWithoutCurrentPaddingLeft - defaultPadding) - y2AxisWidth - (isLegendRight && legendItemWidth || 0),
15030
15186
  xAxisTickTextY2Overflow = Math.max(0, maxOverflow) + defaultPadding;
15031
15187
  // for display inconsistencies between browsers
15032
15188
 
@@ -15273,9 +15429,9 @@ let Axis_Axis = /*#__PURE__*/function () {
15273
15429
  var _this19 = this;
15274
15430
  const $$ = this.owner,
15275
15431
  config = $$.config,
15276
- _$$$state2 = $$.state,
15277
- clip = _$$$state2.clip,
15278
- current = _$$$state2.current,
15432
+ _$$$state3 = $$.state,
15433
+ clip = _$$$state3.clip,
15434
+ current = _$$$state3.current,
15279
15435
  $el = $$.$el;
15280
15436
  ["subX", "x", "y", "y2"].forEach(function (type) {
15281
15437
  _newArrowCheck(this, _this19);
@@ -15498,7 +15654,12 @@ let Axis_Axis = /*#__PURE__*/function () {
15498
15654
  rectElement = eventRect || $el.eventRect,
15499
15655
  updateClientRect = function () {
15500
15656
  _newArrowCheck(this, _this3);
15501
- eventReceiver && (eventReceiver.rect = rectElement.node().getBoundingClientRect());
15657
+ if (eventReceiver) {
15658
+ const scrollPos = getScrollPosition($el.chart.node());
15659
+ eventReceiver.rect = rectElement.node().getBoundingClientRect().toJSON();
15660
+ eventReceiver.rect.top += scrollPos.y;
15661
+ eventReceiver.rect.left += scrollPos.x;
15662
+ }
15502
15663
  }.bind(this);
15503
15664
  if (!rendered || resizing || force) {
15504
15665
  rectElement.attr("x", 0).attr("y", 0).attr("width", width).attr("height", height);
@@ -16849,8 +17010,9 @@ function smoothLines(el, type) {
16849
17010
  if (id === "y2" && !config.axis_y2_show) {
16850
17011
  return isFitPadding ? 0 : rotatedPadding.top;
16851
17012
  }
16852
- const maxtickSize = $$.axis.getMaxTickSize(id);
16853
- if (maxtickSize.height > 13) {
17013
+ const maxtickSize = $$.axis.getMaxTickSize(id),
17014
+ isXAxisTickRotated = config.axis_x_tick_rotate > 0 && (!config.axis_x_tick_autorotate || $$.needToRotateXAxisTickTexts());
17015
+ if ((config.axis_x_tick_multiline || isXAxisTickRotated) && maxtickSize.height > 13) {
16854
17016
  h += maxtickSize.height - 13;
16855
17017
  }
16856
17018
  return h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id === "y2" && !isRotated ? -10 : 0);
@@ -16909,7 +17071,9 @@ function smoothLines(el, type) {
16909
17071
  _$$$state = $$.state,
16910
17072
  axis = _$$$state.axis,
16911
17073
  current = _$$$state.current,
16912
- xAxisLength = current.width - $$.getCurrentPaddingByDirection("left") - $$.getCurrentPaddingByDirection("right"),
17074
+ isLegendRight = _$$$state.isLegendRight,
17075
+ legendItemWidth = _$$$state.legendItemWidth,
17076
+ xAxisLength = current.width - (isLegendRight && legendItemWidth) - $$.getCurrentPaddingByDirection("left") - $$.getCurrentPaddingByDirection("right"),
16913
17077
  tickCountWithPadding = axis.x.tickCount + axis.x.padding.left + axis.x.padding.right,
16914
17078
  _$$$axis$getMaxTickSi2 = $$.axis.getMaxTickSize("x"),
16915
17079
  width = _$$$axis$getMaxTickSi2.width,
@@ -17314,6 +17478,31 @@ function smoothLines(el, type) {
17314
17478
  * }
17315
17479
  */
17316
17480
  axis_x_tick_text_show: !0,
17481
+ /**
17482
+ * Set the first/last axis tick text to be positioned inside of the chart on non-rotated axis.
17483
+ * @name axis․x․tick․text․inner
17484
+ * @memberof Options
17485
+ * @type {boolean|object}
17486
+ * @default false
17487
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.XAxisTickInner)
17488
+ * @example
17489
+ * axis: {
17490
+ * x: {
17491
+ * tick: {
17492
+ * text: {
17493
+ * inner: true,
17494
+ *
17495
+ * // or specify each position of the first and last tick text
17496
+ * inner: {
17497
+ * first: true,
17498
+ * last: true
17499
+ * }
17500
+ * }
17501
+ * }
17502
+ * }
17503
+ * }
17504
+ */
17505
+ axis_x_tick_text_inner: !1,
17317
17506
  /**
17318
17507
  * Set the x Axis tick text's position relatively its original position
17319
17508
  * @name axis․x․tick․text․position
@@ -17493,7 +17682,7 @@ function smoothLines(el, type) {
17493
17682
  */
17494
17683
  axis_x_tick_width: null,
17495
17684
  /**
17496
- * Set to display system tooltip(via 'title' attribute) for tick text
17685
+ * Set to display system tooltip(via `<title>` element) for tick text
17497
17686
  * - **NOTE:** Only available for category axis type (`axis.x.type='category'`)
17498
17687
  * @name axis․x․tick․tooltip
17499
17688
  * @memberof Options
@@ -18241,6 +18430,18 @@ function smoothLines(el, type) {
18241
18430
  * y2 Axis config options
18242
18431
  */
18243
18432
  /* harmony default export */ var y2 = ({
18433
+ /**
18434
+ * Set clip-path attribute for y2 axis element
18435
+ * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
18436
+ * @name axis․y2․clipPath
18437
+ * @memberof Options
18438
+ * @type {boolean}
18439
+ * @default true
18440
+ * @example
18441
+ * // don't set 'clip-path' attribute
18442
+ * clipPath: false
18443
+ */
18444
+ axis_y2_clipPath: !0,
18244
18445
  /**
18245
18446
  * Show or hide y2 axis.
18246
18447
  * - **NOTE**:
@@ -18975,12 +19176,14 @@ function getAttrTweenFn(fn) {
18975
19176
  startingAngle = config[dataType + "_startingAngle"] || 0,
18976
19177
  padAngle = (padding ? padding * .01 : config[dataType + "_padAngle"]) || 0;
18977
19178
  $$.pie = (0,external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_.pie)().startAngle(startingAngle).endAngle(startingAngle + 2 * Math.PI).padAngle(padAngle).value(function (d) {
18978
- var _this4 = this;
19179
+ var _d$values$reduce,
19180
+ _d$values,
19181
+ _this4 = this;
18979
19182
  _newArrowCheck(this, _this3);
18980
- return d.values.reduce(function (a, b) {
19183
+ return (_d$values$reduce = (_d$values = d.values) == null ? void 0 : _d$values.reduce(function (a, b) {
18981
19184
  _newArrowCheck(this, _this4);
18982
19185
  return a + b.value;
18983
- }.bind(this), 0);
19186
+ }.bind(this), 0)) != null ? _d$values$reduce : d;
18984
19187
  }.bind(this)).sort($$.getSortCompareFn.bind($$)(!0));
18985
19188
  },
18986
19189
  updateRadius: function updateRadius() {
@@ -19045,13 +19248,14 @@ function getAttrTweenFn(fn) {
19045
19248
  }
19046
19249
  return len * Math.PI;
19047
19250
  },
19048
- getGaugeStartAngle: function getGaugeStartAngle() {
19251
+ getStartingAngle: function getStartingAngle() {
19049
19252
  const $$ = this,
19050
19253
  config = $$.config,
19051
- isFullCircle = config.gauge_fullCircle,
19254
+ dataType = config.data_type,
19255
+ isFullCircle = $$.hasType("gauge") ? config.gauge_fullCircle : !1,
19052
19256
  defaultStartAngle = -1 * Math.PI / 2,
19053
19257
  defaultEndAngle = Math.PI / 2;
19054
- let startAngle = config.gauge_startingAngle;
19258
+ let startAngle = config[dataType + "_startingAngle"] || 0;
19055
19259
  if (!isFullCircle && startAngle <= defaultStartAngle) {
19056
19260
  startAngle = defaultStartAngle;
19057
19261
  } else if (!isFullCircle && startAngle >= defaultEndAngle) {
@@ -19061,49 +19265,67 @@ function getAttrTweenFn(fn) {
19061
19265
  }
19062
19266
  return startAngle;
19063
19267
  },
19064
- updateAngle: function updateAngle(dValue) {
19268
+ /**
19269
+ * Update angle data
19270
+ * @param {object} dValue Data object
19271
+ * @param {boolean} forRange Weather is for ranged text option(arc.rangeText.values)
19272
+ * @returns {object|null} Updated angle data
19273
+ * @private
19274
+ */
19275
+ updateAngle: function updateAngle(dValue, forRange) {
19065
19276
  var _this5 = this;
19277
+ if (forRange === void 0) {
19278
+ forRange = !1;
19279
+ }
19066
19280
  const $$ = this,
19067
19281
  config = $$.config,
19068
- state = $$.state;
19282
+ state = $$.state,
19283
+ hasGauge = forRange && $$.hasType("gauge");
19284
+ // to prevent excluding total data sum during the init(when data.hide option is used), use $$.rendered state value
19285
+ // const totalSum = $$.getTotalDataSum(state.rendered);
19069
19286
  let pie = $$.pie,
19070
19287
  d = dValue,
19071
19288
  found = !1;
19072
19289
  if (!config) {
19073
19290
  return null;
19074
19291
  }
19075
- const gStart = $$.getGaugeStartAngle(),
19076
- radius = config.gauge_fullCircle ? $$.getArcLength() : gStart * -2;
19292
+ const gStart = $$.getStartingAngle(),
19293
+ radius = config.gauge_fullCircle || forRange && !hasGauge ? $$.getArcLength() : gStart * -2;
19077
19294
  if (d.data && $$.isGaugeType(d.data) && !$$.hasMultiArcGauge()) {
19078
- const min = config.gauge_min,
19079
- max = config.gauge_max,
19295
+ const gMin = config.gauge_min,
19296
+ gMax = config.gauge_max,
19080
19297
  totalSum = $$.getTotalDataSum(state.rendered); // to prevent excluding total data sum during the init(when data.hide option is used), use $$.rendered state value
19081
19298
  // https://github.com/naver/billboard.js/issues/2123
19082
- pie = pie.startAngle(gStart).endAngle(radius * ((totalSum - min) / (max - min)) + gStart);
19299
+ pie = pie.startAngle(gStart).endAngle(radius * ((totalSum - gMin) / (gMax - gMin)) + gStart);
19300
+ }
19301
+ if (forRange === !1) {
19302
+ pie($$.filterTargetsToShow()).forEach(function (t, i) {
19303
+ var _d$data;
19304
+ _newArrowCheck(this, _this5);
19305
+ if (!found && t.data.id === ((_d$data = d.data) == null ? void 0 : _d$data.id)) {
19306
+ found = !0;
19307
+ d = t;
19308
+ d.index = i;
19309
+ }
19310
+ }.bind(this));
19083
19311
  }
19084
- pie($$.filterTargetsToShow()).forEach(function (t, i) {
19085
- var _d$data;
19086
- _newArrowCheck(this, _this5);
19087
- if (!found && t.data.id === ((_d$data = d.data) == null ? void 0 : _d$data.id)) {
19088
- found = !0;
19089
- d = t;
19090
- d.index = i;
19091
- }
19092
- }.bind(this));
19093
19312
  if (isNaN(d.startAngle)) {
19094
19313
  d.startAngle = 0;
19095
19314
  }
19096
19315
  if (isNaN(d.endAngle)) {
19097
19316
  d.endAngle = d.startAngle;
19098
19317
  }
19099
- if (d.data && $$.hasMultiArcGauge()) {
19318
+ if (forRange || d.data && (config.gauge_enforceMinMax || $$.hasMultiArcGauge())) {
19319
+ var _d$value;
19100
19320
  const gMin = config.gauge_min,
19101
19321
  gMax = config.gauge_max,
19102
- gValue = d.value < gMin ? 0 : d.value < gMax ? d.value - gMin : gMax - gMin;
19322
+ max = forRange && !hasGauge ? $$.getTotalDataSum(state.rendered) : gMax,
19323
+ value = (_d$value = d.value) != null ? _d$value : 0,
19324
+ gValue = value < gMin ? 0 : value < max ? value - gMin : max - gMin;
19103
19325
  d.startAngle = gStart;
19104
- d.endAngle = gStart + radius / (gMax - gMin) * gValue;
19326
+ d.endAngle = gStart + radius / (max - gMin) * gValue;
19105
19327
  }
19106
- return found ? d : null;
19328
+ return found || forRange ? d : null;
19107
19329
  },
19108
19330
  getSvgArc: function getSvgArc() {
19109
19331
  const $$ = this,
@@ -19158,24 +19380,83 @@ function getAttrTweenFn(fn) {
19158
19380
  getArc: function getArc(d, withoutUpdate, force) {
19159
19381
  return force || this.isArcType(d.data) ? this.svgArc(d, withoutUpdate) : "M 0 0";
19160
19382
  },
19383
+ /**
19384
+ * Render range value text
19385
+ * @private
19386
+ */
19387
+ redrawArcRangeText: function redrawArcRangeText() {
19388
+ var _values,
19389
+ _this7 = this;
19390
+ const $$ = this,
19391
+ config = $$.config,
19392
+ arcs = $$.$el.arcs,
19393
+ state = $$.state,
19394
+ $T = $$.$T,
19395
+ format = config.arc_rangeText_format,
19396
+ fixed = $$.hasType("gauge") && config.arc_rangeText_fixed;
19397
+ let values = config.arc_rangeText_values;
19398
+ if ((_values = values) != null && _values.length) {
19399
+ const isPercent = config.arc_rangeText_unit === "%",
19400
+ totalSum = $$.getTotalDataSum(state.rendered);
19401
+ if (isPercent) {
19402
+ values = values.map(function (v) {
19403
+ _newArrowCheck(this, _this7);
19404
+ return totalSum / 100 * v;
19405
+ }.bind(this));
19406
+ }
19407
+ const pieData = $$.pie(values).map(function (d, i) {
19408
+ _newArrowCheck(this, _this7);
19409
+ return d.index = i, d;
19410
+ }.bind(this));
19411
+ let rangeText = arcs.selectAll("." + $ARC.arcRange).data(values);
19412
+ rangeText.exit();
19413
+ rangeText = $T(rangeText.enter().append("text").attr("class", $ARC.arcRange).style("text-anchor", "middle").style("pointer-events", "none").style("opacity", "0").text(function (v) {
19414
+ _newArrowCheck(this, _this7);
19415
+ const range = isPercent ? v / totalSum * 100 : v;
19416
+ return isFunction(format) ? format(range) : "" + range + (isPercent ? "%" : "");
19417
+ }.bind(this)).merge(rangeText));
19418
+ if ((!state.rendered || state.rendered && !fixed) && totalSum > 0) {
19419
+ rangeText.attr("transform", function (d, i) {
19420
+ _newArrowCheck(this, _this7);
19421
+ return $$.transformForArcLabel(pieData[i], !0);
19422
+ }.bind(this));
19423
+ }
19424
+ rangeText.style("opacity", function (d) {
19425
+ _newArrowCheck(this, _this7);
19426
+ return !fixed && (d > totalSum || totalSum === 0) ? "0" : null;
19427
+ }.bind(this));
19428
+ }
19429
+ },
19161
19430
  /**
19162
19431
  * Set transform attributes to arc label text
19163
19432
  * @param {object} d Data object
19433
+ * @param {boolean} forRange Weather is for ranged text option(arc.rangeText.values)
19164
19434
  * @returns {string} Translate attribute string
19165
19435
  * @private
19166
19436
  */
19167
- transformForArcLabel: function transformForArcLabel(d) {
19168
- var _this7 = this;
19437
+ transformForArcLabel: function transformForArcLabel(d, forRange) {
19438
+ var _this8 = this;
19439
+ if (forRange === void 0) {
19440
+ forRange = !1;
19441
+ }
19169
19442
  const $$ = this,
19170
19443
  config = $$.config,
19171
19444
  radiusExpanded = $$.state.radiusExpanded,
19172
- updated = $$.updateAngle(d);
19445
+ updated = $$.updateAngle(d, forRange);
19173
19446
  let translate = "";
19174
19447
  if (updated) {
19175
- if ($$.hasMultiArcGauge()) {
19448
+ if (forRange || $$.hasMultiArcGauge()) {
19176
19449
  const y1 = Math.sin(updated.endAngle - Math.PI / 2),
19177
- x = Math.cos(updated.endAngle - Math.PI / 2) * (radiusExpanded + 25),
19450
+ rangeTextPosition = config.arc_rangeText_position;
19451
+ let x = Math.cos(updated.endAngle - Math.PI / 2) * (radiusExpanded + (forRange ? 5 : 25)),
19178
19452
  y = y1 * (radiusExpanded + 15 - Math.abs(y1 * 10)) + 3;
19453
+ if (forRange && rangeTextPosition) {
19454
+ var _pos$x, _pos, _pos$y, _pos2;
19455
+ const rangeValues = config.arc_rangeText_values,
19456
+ pos = isFunction(rangeTextPosition) ? rangeTextPosition(rangeValues[d.index]) : rangeTextPosition;
19457
+ x += (_pos$x = (_pos = pos) == null ? void 0 : _pos.x) != null ? _pos$x : 0;
19458
+ y += (_pos$y = (_pos2 = pos) == null ? void 0 : _pos2.y) != null ? _pos$y : 0;
19459
+ }
19179
19460
  translate = "translate(" + x + "," + y + ")";
19180
19461
  } else if (!$$.hasType("gauge") || $$.data.targets.length > 1) {
19181
19462
  var _filter$map;
@@ -19186,14 +19467,14 @@ function getAttrTweenFn(fn) {
19186
19467
  }
19187
19468
  const c = this.svgArc.centroid(updated),
19188
19469
  _c$map = c.map(function (v) {
19189
- _newArrowCheck(this, _this7);
19470
+ _newArrowCheck(this, _this8);
19190
19471
  return isNaN(v) ? 0 : v;
19191
19472
  }.bind(this)),
19192
19473
  x = _c$map[0],
19193
19474
  y = _c$map[1],
19194
19475
  h = Math.sqrt(x * x + y * y);
19195
- let ratio = (_filter$map = ["donut", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
19196
- _newArrowCheck(this, _this7);
19476
+ let ratio = (_filter$map = ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).map(function (v) {
19477
+ _newArrowCheck(this, _this8);
19197
19478
  return config[v + "_label_ratio"];
19198
19479
  }.bind(this))) == null ? void 0 : _filter$map[0];
19199
19480
  if (ratio) {
@@ -19235,14 +19516,14 @@ function getAttrTweenFn(fn) {
19235
19516
  }
19236
19517
  },
19237
19518
  expandArc: function expandArc(targetIds) {
19238
- var _this8 = this;
19519
+ var _this9 = this;
19239
19520
  const $$ = this,
19240
19521
  transiting = $$.state.transiting,
19241
19522
  $el = $$.$el;
19242
19523
  // MEMO: avoid to cancel transition
19243
19524
  if (transiting) {
19244
19525
  const interval = setInterval(function () {
19245
- _newArrowCheck(this, _this8);
19526
+ _newArrowCheck(this, _this9);
19246
19527
  if (!transiting) {
19247
19528
  clearInterval(interval);
19248
19529
  $el.legend.selectAll("." + $FOCUS.legendItemFocused).size() > 0 && $$.expandArc(targetIds);
@@ -19261,7 +19542,7 @@ function getAttrTweenFn(fn) {
19261
19542
  });
19262
19543
  },
19263
19544
  unexpandArc: function unexpandArc(targetIds) {
19264
- var _this9 = this;
19545
+ var _this10 = this;
19265
19546
  const $$ = this,
19266
19547
  transiting = $$.state.transiting,
19267
19548
  svg = $$.$el.svg;
@@ -19270,7 +19551,7 @@ function getAttrTweenFn(fn) {
19270
19551
  }
19271
19552
  const newTargetIds = $$.mapToTargetIds(targetIds);
19272
19553
  svg.selectAll($$.selectorTargets(newTargetIds, "." + $ARC.chartArc)).selectAll("path").transition().duration(function (d) {
19273
- _newArrowCheck(this, _this9);
19554
+ _newArrowCheck(this, _this10);
19274
19555
  return $$.getExpandConfig(d.data.id, "duration");
19275
19556
  }.bind(this)).attrTween("d", getAttrTweenFn($$.svgArc.bind($$)));
19276
19557
  svg.selectAll("" + $ARC.arc).style("opacity", null);
@@ -19304,30 +19585,30 @@ function getAttrTweenFn(fn) {
19304
19585
  return $$.isDonutType(id) && config.donut_expand || $$.isGaugeType(id) && config.gauge_expand || $$.isPieType(id) && config.pie_expand;
19305
19586
  },
19306
19587
  shouldShowArcLabel: function shouldShowArcLabel() {
19307
- var _this10 = this;
19588
+ var _this11 = this;
19308
19589
  const $$ = this,
19309
19590
  config = $$.config;
19310
19591
  return ["donut", "gauge", "pie", "polar"].some(function (v) {
19311
- _newArrowCheck(this, _this10);
19592
+ _newArrowCheck(this, _this11);
19312
19593
  return $$.hasType(v) && config[v + "_label_show"];
19313
19594
  }.bind(this));
19314
19595
  },
19315
19596
  getArcLabelFormat: function getArcLabelFormat() {
19316
- var _this11 = this;
19597
+ var _this12 = this;
19317
19598
  const $$ = this,
19318
19599
  config = $$.config;
19319
19600
  let format = function (v) {
19320
- _newArrowCheck(this, _this11);
19601
+ _newArrowCheck(this, _this12);
19321
19602
  return v;
19322
19603
  }.bind(this);
19323
19604
  ["donut", "gauge", "pie", "polar"].filter($$.hasType.bind($$)).forEach(function (v) {
19324
- _newArrowCheck(this, _this11);
19605
+ _newArrowCheck(this, _this12);
19325
19606
  format = config[v + "_label_format"];
19326
19607
  }.bind(this));
19327
19608
  return isFunction(format) ? format.bind($$.api) : format;
19328
19609
  },
19329
19610
  updateTargetsForArc: function updateTargetsForArc(targets) {
19330
- var _this12 = this;
19611
+ var _this13 = this;
19331
19612
  const $$ = this,
19332
19613
  $el = $$.$el,
19333
19614
  hasGauge = $$.hasType("gauge"),
@@ -19336,7 +19617,7 @@ function getAttrTweenFn(fn) {
19336
19617
  classFocus = $$.classFocus.bind($$),
19337
19618
  chartArcs = $el.main.select("." + $ARC.chartArcs),
19338
19619
  mainPieUpdate = chartArcs.selectAll("." + $ARC.chartArc).data($$.pie(targets)).attr("class", function (d) {
19339
- _newArrowCheck(this, _this12);
19620
+ _newArrowCheck(this, _this13);
19340
19621
  return classChartArc(d) + classFocus(d.data);
19341
19622
  }.bind(this)),
19342
19623
  mainPieEnter = mainPieUpdate.enter().append("g").attr("class", classChartArc).call(this.setCssRule(!1, "." + $ARC.chartArcs + " text", ["pointer-events:none", "text-anchor:middle"]));
@@ -19403,7 +19684,7 @@ function getAttrTweenFn(fn) {
19403
19684
  return !1;
19404
19685
  },
19405
19686
  redrawArc: function redrawArc(duration, durationForExit, withTransform) {
19406
- var _this13 = this;
19687
+ var _this14 = this;
19407
19688
  const $$ = this,
19408
19689
  config = $$.config,
19409
19690
  state = $$.state,
@@ -19413,10 +19694,10 @@ function getAttrTweenFn(fn) {
19413
19694
  let mainArc = main.selectAll("." + $ARC.arcs).selectAll("." + $ARC.arc).data($$.arcData.bind($$));
19414
19695
  mainArc.exit().transition().duration(durationForExit).style("opacity", "0").remove();
19415
19696
  mainArc = mainArc.enter().append("path").attr("class", $$.getClass("arc", !0)).style("fill", function (d) {
19416
- _newArrowCheck(this, _this13);
19697
+ _newArrowCheck(this, _this14);
19417
19698
  return $$.color(d.data);
19418
19699
  }.bind(this)).style("cursor", function (d) {
19419
- _newArrowCheck(this, _this13);
19700
+ _newArrowCheck(this, _this14);
19420
19701
  return isSelectable != null && isSelectable.bind != null && isSelectable.bind($$.api)(d) ? "pointer" : null;
19421
19702
  }.bind(this)).style("opacity", "0").each(function (d) {
19422
19703
  if ($$.isGaugeType(d.data)) {
@@ -19427,22 +19708,22 @@ function getAttrTweenFn(fn) {
19427
19708
  }).merge(mainArc);
19428
19709
  if ($$.hasType("gauge")) {
19429
19710
  $$.updateGaugeMax();
19430
- $$.hasMultiArcGauge() && $$.redrawMultiArcGauge();
19711
+ $$.hasMultiArcGauge() && $$.redrawArcGaugeLine();
19431
19712
  }
19432
19713
  mainArc.attr("transform", function (d) {
19433
- _newArrowCheck(this, _this13);
19714
+ _newArrowCheck(this, _this14);
19434
19715
  return !$$.isGaugeType(d.data) && withTransform ? "scale(0)" : "";
19435
19716
  }.bind(this)).style("opacity", function (d) {
19436
19717
  return d === this._current ? "0" : null;
19437
19718
  }).each(function () {
19438
- _newArrowCheck(this, _this13);
19719
+ _newArrowCheck(this, _this14);
19439
19720
  state.transiting = !0;
19440
19721
  }.bind(this)).transition().duration(duration).attrTween("d", function (d) {
19441
- var _this14 = this;
19722
+ var _this15 = this;
19442
19723
  const updated = $$.updateAngle(d);
19443
19724
  if (!updated) {
19444
19725
  return function () {
19445
- _newArrowCheck(this, _this14);
19726
+ _newArrowCheck(this, _this15);
19446
19727
  return "M 0 0";
19447
19728
  }.bind(this);
19448
19729
  }
@@ -19461,7 +19742,7 @@ function getAttrTweenFn(fn) {
19461
19742
  return $$.getArc(interpolated, !0);
19462
19743
  };
19463
19744
  }).attr("transform", withTransform ? "scale(1)" : "").style("fill", function (d) {
19464
- _newArrowCheck(this, _this13);
19745
+ _newArrowCheck(this, _this14);
19465
19746
  let color;
19466
19747
  if ($$.levelColor) {
19467
19748
  color = $$.levelColor(d.data.values[0].value);
@@ -19490,13 +19771,14 @@ function getAttrTweenFn(fn) {
19490
19771
  $$.hasType("gauge") && $$.redrawBackgroundArcs();
19491
19772
  config.arc_needle_show && $$.redrawNeedle();
19492
19773
  $$.redrawArcText(duration);
19774
+ $$.redrawArcRangeText();
19493
19775
  },
19494
19776
  /**
19495
19777
  * Update needle element
19496
19778
  * @private
19497
19779
  */
19498
19780
  redrawNeedle: function redrawNeedle() {
19499
- var _this15 = this;
19781
+ var _this16 = this;
19500
19782
  const $$ = this,
19501
19783
  $el = $$.$el,
19502
19784
  config = $$.config,
@@ -19518,7 +19800,7 @@ function getAttrTweenFn(fn) {
19518
19800
  bottomRy = config.arc_needle_bottom_ry,
19519
19801
  needleAngle = $$.getNeedleAngle(),
19520
19802
  updateNeedleValue = function () {
19521
- _newArrowCheck(this, _this15);
19803
+ _newArrowCheck(this, _this16);
19522
19804
  const title = $$.getArcTitleWithNeedleValue();
19523
19805
  title && $$.setArcTitle(title);
19524
19806
  }.bind(this);
@@ -19534,14 +19816,14 @@ function getAttrTweenFn(fn) {
19534
19816
  * @private
19535
19817
  */
19536
19818
  $el.needle.updateHelper = function (v, updateConfig) {
19537
- var _this16 = this;
19819
+ var _this17 = this;
19538
19820
  if (updateConfig === void 0) {
19539
19821
  updateConfig = !1;
19540
19822
  }
19541
- _newArrowCheck(this, _this15);
19823
+ _newArrowCheck(this, _this16);
19542
19824
  if ($el.needle.style("display") !== "none") {
19543
19825
  $$.$T($el.needle).style("transform", "rotate(" + $$.getNeedleAngle(v) + "deg)").call(endall, function () {
19544
- _newArrowCheck(this, _this16);
19826
+ _newArrowCheck(this, _this17);
19545
19827
  updateConfig && (config.arc_needle_value = v);
19546
19828
  updateNeedleValue();
19547
19829
  }.bind(this));
@@ -19576,7 +19858,7 @@ function getAttrTweenFn(fn) {
19576
19858
  }
19577
19859
  state.current.needle = value;
19578
19860
  if (hasGauge) {
19579
- startingAngle = $$.getGaugeStartAngle();
19861
+ startingAngle = $$.getStartingAngle();
19580
19862
  const radius = config.gauge_fullCircle ? arcLength : startingAngle * -2,
19581
19863
  min = config.gauge_min,
19582
19864
  max = config.gauge_max;
@@ -19587,25 +19869,25 @@ function getAttrTweenFn(fn) {
19587
19869
  return (startingAngle + radian) * (180 / Math.PI);
19588
19870
  },
19589
19871
  redrawBackgroundArcs: function redrawBackgroundArcs() {
19590
- var _this17 = this;
19872
+ var _this18 = this;
19591
19873
  const $$ = this,
19592
19874
  config = $$.config,
19593
19875
  state = $$.state,
19594
19876
  hasMultiArcGauge = $$.hasMultiArcGauge(),
19595
19877
  isFullCircle = config.gauge_fullCircle,
19596
19878
  showEmptyTextLabel = $$.filterTargetsToShow($$.data.targets).length === 0 && !!config.data_empty_label_text,
19597
- startAngle = $$.getGaugeStartAngle(),
19879
+ startAngle = $$.getStartingAngle(),
19598
19880
  endAngle = isFullCircle ? startAngle + $$.getArcLength() : startAngle * -1;
19599
19881
  let backgroundArc = $$.$el.arcs.select((hasMultiArcGauge ? "g" : "") + "." + $ARC.chartArcsBackground);
19600
19882
  if (hasMultiArcGauge) {
19601
19883
  let index = 0;
19602
19884
  backgroundArc = backgroundArc.selectAll("path." + $ARC.chartArcsBackground).data($$.data.targets);
19603
19885
  backgroundArc.enter().append("path").attr("class", function (d, i) {
19604
- _newArrowCheck(this, _this17);
19886
+ _newArrowCheck(this, _this18);
19605
19887
  return $ARC.chartArcsBackground + " " + $ARC.chartArcsBackground + "-" + i;
19606
19888
  }.bind(this)).merge(backgroundArc).style("fill", config.gauge_background || null).attr("d", function (_ref3) {
19607
19889
  let id = _ref3.id;
19608
- _newArrowCheck(this, _this17);
19890
+ _newArrowCheck(this, _this18);
19609
19891
  if (showEmptyTextLabel || state.hiddenTargetIds.indexOf(id) >= 0) {
19610
19892
  return "M 0 0";
19611
19893
  }
@@ -19622,7 +19904,7 @@ function getAttrTweenFn(fn) {
19622
19904
  backgroundArc.exit().remove();
19623
19905
  } else {
19624
19906
  backgroundArc.attr("d", showEmptyTextLabel ? "M 0 0" : function () {
19625
- _newArrowCheck(this, _this17);
19907
+ _newArrowCheck(this, _this18);
19626
19908
  const d = {
19627
19909
  data: [{
19628
19910
  value: config.gauge_max
@@ -19635,7 +19917,7 @@ function getAttrTweenFn(fn) {
19635
19917
  }
19636
19918
  },
19637
19919
  bindArcEvent: function bindArcEvent(arc) {
19638
- var _this18 = this;
19920
+ var _this19 = this;
19639
19921
  const $$ = this,
19640
19922
  config = $$.config,
19641
19923
  state = $$.state,
@@ -19683,7 +19965,7 @@ function getAttrTweenFn(fn) {
19683
19965
  selectArc(this, arcData, id);
19684
19966
  $$.setOverOut(!0, arcData);
19685
19967
  }).on("mouseout", function (event, d) {
19686
- _newArrowCheck(this, _this18);
19968
+ _newArrowCheck(this, _this19);
19687
19969
  if (state.transiting) {
19688
19970
  // skip while transiting
19689
19971
  return;
@@ -19705,7 +19987,7 @@ function getAttrTweenFn(fn) {
19705
19987
  if (isTouch && $$.hasArcType() && !$$.radars) {
19706
19988
  const getEventArc = function (event) {
19707
19989
  var _event$changedTouches, _event$changedTouches2;
19708
- _newArrowCheck(this, _this18);
19990
+ _newArrowCheck(this, _this19);
19709
19991
  const _ref4 = (_event$changedTouches = (_event$changedTouches2 = event.changedTouches) == null ? void 0 : _event$changedTouches2[0]) != null ? _event$changedTouches : {
19710
19992
  clientX: 0,
19711
19993
  clientY: 0
@@ -19733,7 +20015,7 @@ function getAttrTweenFn(fn) {
19733
20015
  }
19734
20016
  },
19735
20017
  redrawArcText: function redrawArcText(duration) {
19736
- var _this19 = this;
20018
+ var _this20 = this;
19737
20019
  const $$ = this,
19738
20020
  config = $$.config,
19739
20021
  state = $$.state,
@@ -19747,13 +20029,16 @@ function getAttrTweenFn(fn) {
19747
20029
  // for gauge type, update text when has no title & multi data
19748
20030
  if (!(hasGauge && $$.data.targets.length === 1 && config.gauge_title)) {
19749
20031
  text = main.selectAll("." + $ARC.chartArc).select("text").style("opacity", "0").attr("class", function (d) {
19750
- _newArrowCheck(this, _this19);
20032
+ _newArrowCheck(this, _this20);
19751
20033
  return $$.isGaugeType(d.data) ? $GAUGE.gaugeValue : null;
19752
- }.bind(this)).call($$.textForArcLabel.bind($$)).attr("transform", $$.transformForArcLabel.bind($$)).style("font-size", function (d) {
19753
- _newArrowCheck(this, _this19);
20034
+ }.bind(this)).call($$.textForArcLabel.bind($$)).attr("transform", function (d) {
20035
+ _newArrowCheck(this, _this20);
20036
+ return $$.transformForArcLabel.bind($$)(d);
20037
+ }.bind(this)).style("font-size", function (d) {
20038
+ _newArrowCheck(this, _this20);
19754
20039
  return $$.isGaugeType(d.data) && $$.data.targets.length === 1 && !hasMultiArcGauge ? Math.round(state.radius / 5) + "px" : null;
19755
20040
  }.bind(this)).transition().duration(duration).style("opacity", function (d) {
19756
- _newArrowCheck(this, _this19);
20041
+ _newArrowCheck(this, _this20);
19757
20042
  return $$.isTargetToShow(d.data.id) && $$.isArcType(d.data) ? null : "0";
19758
20043
  }.bind(this));
19759
20044
  hasMultiArcGauge && text.attr("dy", "-.1em");
@@ -19779,14 +20064,14 @@ function getAttrTweenFn(fn) {
19779
20064
  * @private
19780
20065
  */
19781
20066
  getArcElementByIdOrIndex: function getArcElementByIdOrIndex(value) {
19782
- var _this20 = this;
20067
+ var _this21 = this;
19783
20068
  const $$ = this,
19784
20069
  arcs = $$.$el.arcs,
19785
20070
  filterFn = isNumber(value) ? function (d) {
19786
- _newArrowCheck(this, _this20);
20071
+ _newArrowCheck(this, _this21);
19787
20072
  return d.index === value;
19788
20073
  }.bind(this) : function (d) {
19789
- _newArrowCheck(this, _this20);
20074
+ _newArrowCheck(this, _this21);
19790
20075
  return d.data.id === value;
19791
20076
  }.bind(this);
19792
20077
  return arcs == null ? void 0 : arcs.selectAll("." + $COMMON.target + " path").filter(filterFn);
@@ -20459,14 +20744,22 @@ function candlestick_objectSpread(e) { for (var r = 1, t; r < arguments.length;
20459
20744
  const $$ = this,
20460
20745
  config = $$.config,
20461
20746
  arcs = $$.$el.arcs,
20462
- appendText = function (className) {
20747
+ appendText = function (className, value) {
20748
+ if (className === void 0) {
20749
+ className = null;
20750
+ }
20751
+ if (value === void 0) {
20752
+ value = "";
20753
+ }
20463
20754
  _newArrowCheck(this, _this);
20464
- arcs.append("text").attr("class", className).style("text-anchor", "middle").style("pointer-events", "none");
20755
+ arcs.append("text").attr("class", className).style("text-anchor", "middle").style("pointer-events", "none").text(value);
20465
20756
  }.bind(this);
20466
20757
  if ($$.hasType("gauge")) {
20467
20758
  const hasMulti = $$.hasMultiArcGauge();
20468
20759
  arcs.append(hasMulti ? "g" : "path").attr("class", $ARC.chartArcsBackground).style("fill", !hasMulti && config.gauge_background || null);
20469
20760
  config.gauge_units && appendText($GAUGE.chartArcsGaugeUnit);
20761
+
20762
+ // append min/max value text
20470
20763
  if (config.gauge_label_show) {
20471
20764
  appendText($GAUGE.chartArcsGaugeMin);
20472
20765
  config.gauge_fullCircle || appendText($GAUGE.chartArcsGaugeMax);
@@ -20483,11 +20776,11 @@ function candlestick_objectSpread(e) { for (var r = 1, t; r < arguments.length;
20483
20776
  // to prevent excluding total data sum during the init(when data.hide option is used), use $$.rendered state value
20484
20777
 
20485
20778
  // if gauge_max less than max, make max to max value
20486
- if (max + config.gauge_min * (config.gauge_min > 0 ? -1 : 1) > config.gauge_max) {
20779
+ if (!config.gauge_enforceMinMax && max + config.gauge_min * (config.gauge_min > 0 ? -1 : 1) > config.gauge_max) {
20487
20780
  config.gauge_max = max - config.gauge_min;
20488
20781
  }
20489
20782
  },
20490
- redrawMultiArcGauge: function redrawMultiArcGauge() {
20783
+ redrawArcGaugeLine: function redrawArcGaugeLine() {
20491
20784
  var _this2 = this;
20492
20785
  const $$ = this,
20493
20786
  config = $$.config,
@@ -21586,7 +21879,8 @@ function getPosition(isClockwise, type, edge, pos, range, ratio) {
21586
21879
  }
21587
21880
 
21588
21881
  // cache key
21589
- const cacheKey = KEY.radarPoints;
21882
+ const cacheKeyPoints = KEY.radarPoints,
21883
+ cacheKeyTextWidth = KEY.radarTextWidth;
21590
21884
  /* harmony default export */ var radar = ({
21591
21885
  initRadar: function initRadar() {
21592
21886
  const $$ = this,
@@ -21605,6 +21899,13 @@ const cacheKey = KEY.radarPoints;
21605
21899
  // shapes
21606
21900
  $el.radar.shapes = $el.radar.append("g").attr("class", $SHAPE.shapes);
21607
21901
  current.dataMax = config.radar_axis_max || $$.getMinMaxData().max[0].value;
21902
+ if (config.radar_axis_text_show) {
21903
+ config.interaction_enabled && $$.bindRadarEvent();
21904
+
21905
+ // it needs to calculate dimension at the initialization
21906
+ $$.updateRadarLevel();
21907
+ $$.updateRadarAxes();
21908
+ }
21608
21909
  }
21609
21910
  },
21610
21911
  getRadarSize: function getRadarSize() {
@@ -21655,7 +21956,7 @@ const cacheKey = KEY.radarPoints;
21655
21956
  _$$$getRadarSize2 = $$.getRadarSize(),
21656
21957
  width = _$$$getRadarSize2[0],
21657
21958
  height = _$$$getRadarSize2[1],
21658
- points = $$.cache.get(cacheKey) || {},
21959
+ points = $$.cache.get(cacheKeyPoints) || {},
21659
21960
  size = points._size;
21660
21961
  // recalculate position only when the previous dimension has been changed
21661
21962
  if (!size || size.width !== width && size.height !== height) {
@@ -21671,7 +21972,7 @@ const cacheKey = KEY.radarPoints;
21671
21972
  width: width,
21672
21973
  height: height
21673
21974
  };
21674
- $$.cache.add(cacheKey, points);
21975
+ $$.cache.add(cacheKeyPoints, points);
21675
21976
  }
21676
21977
  },
21677
21978
  redrawRadar: function redrawRadar() {
@@ -21692,7 +21993,7 @@ const cacheKey = KEY.radarPoints;
21692
21993
  },
21693
21994
  generateGetRadarPoints: function generateGetRadarPoints() {
21694
21995
  var _this5 = this;
21695
- const points = this.cache.get(cacheKey);
21996
+ const points = this.cache.get(cacheKeyPoints);
21696
21997
  return function (d, i) {
21697
21998
  _newArrowCheck(this, _this5);
21698
21999
  const point = points[d.id][i];
@@ -21806,7 +22107,8 @@ const cacheKey = KEY.radarPoints;
21806
22107
  _config$radar_axis_te2 = _config$radar_axis_te.x,
21807
22108
  x = _config$radar_axis_te2 === void 0 ? 0 : _config$radar_axis_te2,
21808
22109
  _config$radar_axis_te3 = _config$radar_axis_te.y,
21809
- y = _config$radar_axis_te3 === void 0 ? 0 : _config$radar_axis_te3;
22110
+ y = _config$radar_axis_te3 === void 0 ? 0 : _config$radar_axis_te3,
22111
+ textWidth = $$.cache.get(cacheKeyTextWidth) || 0;
21810
22112
  axis.select("text").style("text-anchor", "middle").attr("dy", ".5em").call(function (selection) {
21811
22113
  _newArrowCheck(this, _this8);
21812
22114
  selection.each(function (d) {
@@ -21840,13 +22142,23 @@ const cacheKey = KEY.radarPoints;
21840
22142
  }
21841
22143
  return "translate(" + posX + " " + posY + ")";
21842
22144
  });
22145
+ if (!textWidth) {
22146
+ const widths = [radar.axes, radar.levels].map(function (v) {
22147
+ _newArrowCheck(this, _this8);
22148
+ return getPathBox(v.node()).width;
22149
+ }.bind(this));
22150
+ if (widths.every(function (v) {
22151
+ _newArrowCheck(this, _this8);
22152
+ return v > 0;
22153
+ }.bind(this))) {
22154
+ $$.cache.add(cacheKeyTextWidth, widths[0] - widths[1]);
22155
+ }
22156
+ }
21843
22157
  }
21844
- $$.bindRadarEvent();
21845
22158
  },
21846
22159
  bindRadarEvent: function bindRadarEvent() {
21847
22160
  var _this9 = this;
21848
22161
  const $$ = this,
21849
- config = $$.config,
21850
22162
  state = $$.state,
21851
22163
  _$$$$el2 = $$.$el,
21852
22164
  radar = _$$$$el2.radar,
@@ -21854,40 +22166,38 @@ const cacheKey = KEY.radarPoints;
21854
22166
  focusOnly = $$.isPointFocusOnly(),
21855
22167
  _state = state,
21856
22168
  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;
22169
+ transiting = _state.transiting,
22170
+ isMouse = inputType === "mouse",
22171
+ hide = function (event) {
22172
+ _newArrowCheck(this, _this9);
22173
+ state.event = event;
21863
22174
 
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
- }
22175
+ // const index = getIndex(event);
22176
+ const index = $$.getDataIndexFromEvent(event),
22177
+ noIndex = isUndefined(index);
22178
+ if (isMouse || noIndex) {
22179
+ $$.hideTooltip();
22180
+ focusOnly ? $$.hideCircleFocus() : $$.unexpandCircles();
22181
+ if (isMouse) {
22182
+ $$.setOverOut(!1, index);
22183
+ } else if (noIndex) {
22184
+ $$.callOverOutForTouch();
21875
22185
  }
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
22186
  }
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);
22187
+ }.bind(this);
22188
+ radar.axes.on(isMouse ? "mouseover " : "touchstart", function (event) {
22189
+ _newArrowCheck(this, _this9);
22190
+ if (transiting) {
22191
+ // skip while transiting
22192
+ return;
21890
22193
  }
22194
+ state.event = event;
22195
+ const index = $$.getDataIndexFromEvent(event);
22196
+ $$.selectRectForSingle(svg.node(), index);
22197
+ isMouse ? $$.setOverOut(!0, index) : $$.callOverOutForTouch(index);
22198
+ }.bind(this)).on("mouseout", isMouse ? hide : null);
22199
+ if (!isMouse) {
22200
+ svg.on("touchstart", hide);
21891
22201
  }
21892
22202
  },
21893
22203
  updateRadarShape: function updateRadarShape() {
@@ -21897,7 +22207,7 @@ const cacheKey = KEY.radarPoints;
21897
22207
  _newArrowCheck(this, _this10);
21898
22208
  return $$.isRadarType(d);
21899
22209
  }.bind(this)),
21900
- points = $$.cache.get(cacheKey),
22210
+ points = $$.cache.get(cacheKeyPoints),
21901
22211
  areas = $$.$el.radar.shapes.selectAll("polygon").data(targets),
21902
22212
  areasEnter = areas.enter().append("g").attr("class", $$.getChartClass("Radar"));
21903
22213
  $$.$T(areas.exit()).remove();
@@ -21914,7 +22224,7 @@ const cacheKey = KEY.radarPoints;
21914
22224
  * @private
21915
22225
  */
21916
22226
  radarCircleX: function radarCircleX(d) {
21917
- return this.cache.get(cacheKey)[d.id][d.index][0];
22227
+ return this.cache.get(cacheKeyPoints)[d.id][d.index][0];
21918
22228
  },
21919
22229
  /**
21920
22230
  * Get data point y coordinate
@@ -21923,7 +22233,7 @@ const cacheKey = KEY.radarPoints;
21923
22233
  * @private
21924
22234
  */
21925
22235
  radarCircleY: function radarCircleY(d) {
21926
- return this.cache.get(cacheKey)[d.id][d.index][1];
22236
+ return this.cache.get(cacheKeyPoints)[d.id][d.index][1];
21927
22237
  }
21928
22238
  });
21929
22239
  // EXTERNAL MODULE: external {"commonjs":"d3-hierarchy","commonjs2":"d3-hierarchy","amd":"d3-hierarchy","root":"d3"}
@@ -22838,11 +23148,23 @@ function convertDataToTreemapData(data) {
22838
23148
  * @property {number} [arc.needle.bottom.ry=1] Set needle bottom [ry radius value](https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d#elliptical_arc_curve).
22839
23149
  * @property {number} [arc.needle.bottom.width=15] Set needle bottom width in pixel.
22840
23150
  * @property {number} [arc.needle.bottom.len=0] Set needle bottom length in pixel. Setting this value, will make bottom larger starting from center.
23151
+ * @property {object} [arc.rangeText] Set rangeText options.
23152
+ * @property {Array} [arc.rangeText.values] Set range text values to be shown around Arc.
23153
+ * - When `unit: 'absolute'`: Given values are treated as absolute values.
23154
+ * - When `unit: '%'`: Given values are treated as percentages.
23155
+ * @property {string} [arc.rangeText.unit="absolute"] Specify the range text unit.
23156
+ * - "absolute": Show absolute value
23157
+ * - "%": Show percentage value
23158
+ * @property {boolean} [arc.rangeText.fiexed=false] Set if range text shown will be fixed w/o data toggle update. Only available for gauge chart.
23159
+ * @property {Function} [arc.rangeText.format] Set format function for the range text.
23160
+ * @property {number} [arc.rangeText.position] Set position function or object for the range text.
22841
23161
  * @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutCornerRadius)
22842
- * @see [Demo: Gauge corner radius](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeCornerRadius)
22843
23162
  * @see [Demo: Donut corner radius](https://naver.github.io/billboard.js/demo/#PieChartOptions.CornerRadius)
22844
23163
  * @see [Demo: Donut needle](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutNeedle)
22845
- * @see [Demo: Gauge needle](https://naver.github.io/billboard.js/demo/##GaugeChartOptions.GaugeNeedle)
23164
+ * @see [Demo: Donut RangeText](https://naver.github.io/billboard.js/demo/#DonutChartOptions.DonutRangeText)
23165
+ * @see [Demo: Gauge corner radius](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeCornerRadius)
23166
+ * @see [Demo: Gauge needle](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeNeedle)
23167
+ * @see [Demo: Gauge RangeText](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeRangeText)
22846
23168
  * @example
22847
23169
  * arc: {
22848
23170
  * cornerRadius: 12,
@@ -22899,6 +23221,21 @@ function convertDataToTreemapData(data) {
22899
23221
  * width: 10
22900
23222
  * len: 10
22901
23223
  * }
23224
+ * },
23225
+ *
23226
+ * rangeText: {
23227
+ * values: [15, 30, 50, 75, 95],
23228
+ * unit: "%",
23229
+ * fixed: false, // only available for gauge chart
23230
+ * format: function(v) {
23231
+ * return v === 15 ? "Fifteen" : v;
23232
+ * },
23233
+ *
23234
+ * position: function(v) {
23235
+ * return v === 15 ? {x: 20, y: 10} : null; // can return one props value also.
23236
+ * },
23237
+ * position: {x: 10, y: 15},
23238
+ * position: {x: 10}
22902
23239
  * }
22903
23240
  * }
22904
23241
  */
@@ -22915,7 +23252,12 @@ function convertDataToTreemapData(data) {
22915
23252
  arc_needle_bottom_rx: 1,
22916
23253
  arc_needle_bottom_ry: 1,
22917
23254
  arc_needle_bottom_width: 15,
22918
- arc_needle_bottom_len: 0
23255
+ arc_needle_bottom_len: 0,
23256
+ arc_rangeText_values: undefined,
23257
+ arc_rangeText_unit: "absolute",
23258
+ arc_rangeText_fixed: !1,
23259
+ arc_rangeText_format: undefined,
23260
+ arc_rangeText_position: undefined
22919
23261
  });
22920
23262
  ;// CONCATENATED MODULE: ./src/config/Options/shape/donut.ts
22921
23263
  /**
@@ -23022,16 +23364,20 @@ function convertDataToTreemapData(data) {
23022
23364
  * @property {boolean} [gauge.background=""] Set background color. (The `.bb-chart-arcs-background` element)
23023
23365
  * @property {boolean} [gauge.fullCircle=false] Show full circle as donut. When set to 'true', the max label will not be showed due to start and end points are same location.
23024
23366
  * @property {boolean} [gauge.label.show=true] Show or hide label on gauge.
23367
+ * @property {Function} [gauge.label.extents] Set customized min/max label text.
23025
23368
  * @property {Function} [gauge.label.format] Set formatter for the label on gauge. Label text can be multilined with `\n` character.<br>
23026
23369
  * Will pass following arguments to the given function:
23027
23370
  * - value {number}: absolute value
23028
23371
  * - ratio {number}: value's ratio
23029
23372
  * - id {string}: data's id value
23030
- * @property {Function} [gauge.label.extents] Set customized min/max label text.
23373
+ * @property {number|Function} [gauge.label.ratio=undefined] Set ratio of labels position.
23031
23374
  * @property {number} [gauge.label.threshold=0] Set threshold ratio to show/hide labels.
23032
23375
  * @property {boolean} [gauge.expand=true] Enable or disable expanding gauge.
23033
23376
  * @property {number} [gauge.expand.rate=0.98] Set expand rate.
23034
23377
  * @property {number} [gauge.expand.duration=50] Set the expand transition time in milliseconds.
23378
+ * @property {boolean} [gauge.enforceMinMax=false] Enforce to given min/max value.
23379
+ * - When `gauge.min=50` and given value is `30`, gauge will render as empty value.
23380
+ * - When `gauge.max=100` and given value is `120`, gauge will render till 100, not surpassing max value.
23035
23381
  * @property {number} [gauge.min=0] Set min value of the gauge.
23036
23382
  * @property {number} [gauge.max=100] Set max value of the gauge.
23037
23383
  * @property {number} [gauge.startingAngle=-1 * Math.PI / 2] Set starting angle where data draws.
@@ -23062,8 +23408,10 @@ function convertDataToTreemapData(data) {
23062
23408
  * - single
23063
23409
  * - multi
23064
23410
  * @property {number} [gauge.arcs.minWidth=5] Set minimal width of gauge arcs until the innerRadius disappears.
23411
+ * @see [Demo: enforceMinMax, min/max](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeMinMax)
23065
23412
  * @see [Demo: archLength](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeArcLength)
23066
23413
  * @see [Demo: startingAngle](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeStartingAngle)
23414
+ * @see [Demo: labelRatio](https://naver.github.io/billboard.js/demo/#GaugeChartOptions.GaugeLabelRatio)
23067
23415
  * @example
23068
23416
  * gauge: {
23069
23417
  * background: "#eee", // will set 'fill' css prop for '.bb-chart-arcs-background' classed element.
@@ -23084,6 +23432,14 @@ function convertDataToTreemapData(data) {
23084
23432
  * // 0.1(10%) ratio value means, the minimum ratio to show text label relative to the total value.
23085
23433
  * // if data value is below than 0.1, text label will be hidden.
23086
23434
  * threshold: 0.1,
23435
+ *
23436
+ * // set ratio callback. Should return ratio value
23437
+ * ratio: function(d, radius, h) {
23438
+ * ...
23439
+ * return ratio;
23440
+ * },
23441
+ * // or set ratio number
23442
+ * ratio: 0.5
23087
23443
  * },
23088
23444
  *
23089
23445
  * // disable expand transition for interaction
@@ -23097,6 +23453,11 @@ function convertDataToTreemapData(data) {
23097
23453
  * rate: 1
23098
23454
  * },
23099
23455
  *
23456
+ * // enforce min/max value.
23457
+ * // when given value < min, will render as empty value.
23458
+ * // when value > max, will render to given max value not surpassing it.
23459
+ * enforceMinMax: true,
23460
+ *
23100
23461
  * min: -100,
23101
23462
  * max: 200,
23102
23463
  * type: "single" // or 'multi'
@@ -23117,9 +23478,11 @@ function convertDataToTreemapData(data) {
23117
23478
  gauge_background: "",
23118
23479
  gauge_fullCircle: !1,
23119
23480
  gauge_label_show: !0,
23120
- gauge_label_format: undefined,
23121
23481
  gauge_label_extents: undefined,
23482
+ gauge_label_format: undefined,
23483
+ gauge_label_ratio: undefined,
23122
23484
  gauge_label_threshold: 0,
23485
+ gauge_enforceMinMax: !1,
23123
23486
  gauge_min: 0,
23124
23487
  gauge_max: 100,
23125
23488
  gauge_type: "single",
@@ -23150,8 +23513,8 @@ function convertDataToTreemapData(data) {
23150
23513
  * @property {object} pie Pie object
23151
23514
  * @property {boolean} [pie.label.show=true] Show or hide label on each pie piece.
23152
23515
  * @property {Function} [pie.label.format] Set formatter for the label on each pie piece.
23153
- * @property {number} [pie.label.threshold=0.05] Set threshold ratio to show/hide labels.
23154
23516
  * @property {number|Function} [pie.label.ratio=undefined] Set ratio of labels position.
23517
+ * @property {number} [pie.label.threshold=0.05] Set threshold ratio to show/hide labels.
23155
23518
  * @property {boolean|object} [pie.expand=true] Enable or disable expanding pie pieces.
23156
23519
  * @property {number} [pie.expand.rate=0.98] Set expand rate.
23157
23520
  * @property {number} [pie.expand.duration=50] Set expand transition time in ms.
@@ -23222,8 +23585,8 @@ function convertDataToTreemapData(data) {
23222
23585
  */
23223
23586
  pie_label_show: !0,
23224
23587
  pie_label_format: undefined,
23225
- pie_label_threshold: .05,
23226
23588
  pie_label_ratio: undefined,
23589
+ pie_label_threshold: .05,
23227
23590
  pie_expand: {},
23228
23591
  pie_expand_rate: .98,
23229
23592
  pie_expand_duration: 50,
@@ -23844,7 +24207,8 @@ function setSelection(isSelection, ids, indices, resetOther) {
23844
24207
  * // Get the current subchart selection domain range
23845
24208
  * // Domain value may not be exact returning approximately values.
23846
24209
  * chart.subchart();
23847
- */ // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
24210
+ */
24211
+ // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
23848
24212
  const subchart = function (domainValue) {
23849
24213
  var _this = this;
23850
24214
  const $$ = this.internal,
@@ -24014,18 +24378,17 @@ var external_commonjs_d3_zoom_commonjs2_d3_zoom_amd_d3_zoom_root_d3_ = __webpack
24014
24378
  * // Get the current zoomed domain range
24015
24379
  * // Domain value may not be exact returning approximately values.
24016
24380
  * chart.zoom();
24017
- */ // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
24381
+ */
24382
+ // NOTE: declared funciton assigning to variable to prevent duplicated method generation in JSDoc.
24018
24383
  const zoom = function (domainValue) {
24019
24384
  var _this = this,
24020
24385
  _state$domain;
24021
24386
  const $$ = this.internal,
24022
- $el = $$.$el,
24023
24387
  axis = $$.axis,
24024
24388
  config = $$.config,
24025
24389
  org = $$.org,
24026
24390
  scale = $$.scale,
24027
24391
  state = $$.state,
24028
- isRotated = config.axis_rotated,
24029
24392
  isCategorized = axis.isCategorized();
24030
24393
  let domain;
24031
24394
  if (config.zoom_enabled) {
@@ -24040,12 +24403,7 @@ const zoom = function (domainValue) {
24040
24403
  const isWithinRange = $$.withinRange(domain, $$.getZoomDomain("zoom", !0), $$.getZoomDomain("zoom"));
24041
24404
  if (isWithinRange) {
24042
24405
  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
- }
24406
+ domain = $$.getZoomDomainValue(domain);
24049
24407
 
24050
24408
  // hide any possible tooltip show before the zoom
24051
24409
  $$.api.tooltip.hide();
@@ -24054,13 +24412,9 @@ const zoom = function (domainValue) {
24054
24412
  $$.brush.getSelection().call($$.brush.move, domain.map(x));
24055
24413
  // resultDomain = domain;
24056
24414
  } else {
24057
- var _d3ZoomIdentity$scale;
24058
24415
  // 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);
24416
+ const x = isCategorized ? scale.x.orgScale() : org.xScale || scale.x;
24417
+ $$.updateCurrentZoomTransform(x, domain);
24064
24418
  }
24065
24419
  $$.setZoomResetButton();
24066
24420
  }
@@ -24192,8 +24546,9 @@ extend(zoom, {
24192
24546
  _$$$$el = $$.$el,
24193
24547
  eventRect = _$$$$el.eventRect,
24194
24548
  zoomResetBtn = _$$$$el.zoomResetBtn,
24549
+ zoom = $$.scale.zoom,
24195
24550
  state = $$.state;
24196
- if ($$.scale.zoom) {
24551
+ if (zoom) {
24197
24552
  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
24553
  $$.updateZoom(!0);
24199
24554
  zoomResetBtn == null || zoomResetBtn.style("display", "none");
@@ -24955,6 +25310,9 @@ function selection_objectSpread(e) { for (var r = 1, t; r < arguments.length; r+
24955
25310
  // copy current initial x scale in case of rescale option is used
24956
25311
  org.xScale || (org.xScale = scale.x.copy());
24957
25312
  scale.x.domain(domain);
25313
+ } else if (org.xScale) {
25314
+ scale.x.domain(org.xScale.domain());
25315
+ org.xScale = null;
24958
25316
  }
24959
25317
  }.bind(this);
24960
25318
 
@@ -25092,6 +25450,26 @@ function selection_objectSpread(e) { for (var r = 1, t; r < arguments.length; r+
25092
25450
  }
25093
25451
  }
25094
25452
  },
25453
+ /**
25454
+ * Set zoom transform to event rect
25455
+ * @param {Function} x x Axis scale function
25456
+ * @param {Array} domain Domain value to be set
25457
+ * @private
25458
+ */
25459
+ updateCurrentZoomTransform: function updateCurrentZoomTransform(x, domain) {
25460
+ var _d3ZoomIdentity$scale;
25461
+ const $$ = this,
25462
+ eventRect = $$.$el.eventRect,
25463
+ config = $$.config,
25464
+ isRotated = config.axis_rotated,
25465
+ translate = [-x(domain[0]), 0],
25466
+ 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);
25467
+
25468
+ // Get transform from given domain value
25469
+ // https://github.com/d3/d3-zoom/issues/57#issuecomment-246434951
25470
+
25471
+ eventRect.call($$.zoom.transform, transform);
25472
+ },
25095
25473
  /**
25096
25474
  * Attach zoom event on <rect>
25097
25475
  * @private
@@ -25560,7 +25938,7 @@ let _defaults = {};
25560
25938
 
25561
25939
  /**
25562
25940
  * @namespace bb
25563
- * @version 3.10.3
25941
+ * @version 3.11.0-next.2
25564
25942
  */
25565
25943
  const bb = {
25566
25944
  /**
@@ -25570,7 +25948,7 @@ const bb = {
25570
25948
  * bb.version; // "1.0.0"
25571
25949
  * @memberof bb
25572
25950
  */
25573
- version: "3.10.3",
25951
+ version: "3.11.0-next.2",
25574
25952
  /**
25575
25953
  * Generate chart
25576
25954
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: