billboard.js 3.7.5 → 3.8.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 (73) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +468 -268
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +512 -284
  6. package/dist/billboard.pkgd.min.js +3 -3
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-sparkline.js +36 -19
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +35 -19
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +32 -18
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +33 -18
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +45 -17
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +80 -35
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +80 -36
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +77 -35
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +133 -69
  22. package/dist/theme/datalab.css +1 -1
  23. package/dist/theme/datalab.min.css +1 -1
  24. package/dist/theme/graph.css +1 -1
  25. package/dist/theme/graph.min.css +1 -1
  26. package/dist/theme/insight.css +1 -1
  27. package/dist/theme/insight.min.css +1 -1
  28. package/dist-esm/billboard.js +349 -213
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +10 -11
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +6 -11
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +7 -12
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -7
  34. package/package.json +28 -28
  35. package/src/Chart/api/focus.ts +4 -4
  36. package/src/Chart/api/grid.ts +206 -0
  37. package/src/Chart/api/load.ts +31 -21
  38. package/src/Chart/api/regions.ts +28 -24
  39. package/src/Chart/api/zoom.ts +18 -3
  40. package/src/ChartInternal/Axis/Axis.ts +1 -0
  41. package/src/ChartInternal/Axis/AxisRenderer.ts +7 -2
  42. package/src/ChartInternal/ChartInternal.ts +1 -1
  43. package/src/ChartInternal/data/convert.ts +6 -3
  44. package/src/ChartInternal/data/data.ts +19 -15
  45. package/src/ChartInternal/data/load.ts +19 -4
  46. package/src/ChartInternal/interactions/eventrect.ts +3 -2
  47. package/src/ChartInternal/interactions/subchart.ts +3 -2
  48. package/src/ChartInternal/interactions/zoom.ts +10 -3
  49. package/src/ChartInternal/internals/clip.ts +3 -2
  50. package/src/ChartInternal/internals/domain.ts +17 -8
  51. package/src/ChartInternal/internals/legend.ts +4 -1
  52. package/src/ChartInternal/internals/redraw.ts +0 -16
  53. package/src/ChartInternal/internals/region.ts +9 -9
  54. package/src/ChartInternal/internals/scale.ts +7 -4
  55. package/src/ChartInternal/internals/size.axis.ts +14 -4
  56. package/src/ChartInternal/internals/size.ts +41 -18
  57. package/src/ChartInternal/internals/transform.ts +1 -1
  58. package/src/ChartInternal/internals/type.ts +10 -0
  59. package/src/ChartInternal/shape/point.ts +3 -2
  60. package/src/Plugin/sparkline/index.ts +9 -1
  61. package/src/config/Options/axis/x.ts +17 -0
  62. package/src/config/Options/axis/y.ts +2 -1
  63. package/src/config/Options/axis/y2.ts +2 -1
  64. package/src/config/Options/common/main.ts +19 -1
  65. package/src/config/resolver/axis.ts +2 -4
  66. package/src/module/browser.ts +13 -5
  67. package/src/module/generator.ts +3 -3
  68. package/src/module/util.ts +2 -2
  69. package/types/axis.d.ts +8 -7
  70. package/types/chart.d.ts +6 -1
  71. package/types/options.d.ts +7 -4
  72. package/src/Chart/api/grid.x.ts +0 -90
  73. package/src/Chart/api/grid.y.ts +0 -92
@@ -5,10 +5,10 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.7.5
8
+ * @version 3.8.0-next.2
9
9
  *
10
10
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
- * - @types/d3-selection ^3.0.4
11
+ * - @types/d3-selection ^3.0.5
12
12
  * - @types/d3-transition ^3.0.3
13
13
  * - d3-axis ^3.0.0
14
14
  * - d3-brush ^3.0.0
@@ -295,6 +295,7 @@ __webpack_require__(512);
295
295
  __webpack_require__(517);
296
296
  __webpack_require__(518);
297
297
  __webpack_require__(519);
298
+ __webpack_require__(520);
298
299
 
299
300
  /* unused reexport */ __webpack_require__(82);
300
301
 
@@ -1170,10 +1171,10 @@ var store = __webpack_require__(37);
1170
1171
  (module.exports = function (key, value) {
1171
1172
  return store[key] || (store[key] = value !== undefined ? value : {});
1172
1173
  })('versions', []).push({
1173
- version: '3.29.0',
1174
+ version: '3.30.0',
1174
1175
  mode: IS_PURE ? 'pure' : 'global',
1175
1176
  copyright: '© 2014-2023 Denis Pushkarev (zloirock.ru)',
1176
- license: 'https://github.com/zloirock/core-js/blob/v3.29.0/LICENSE',
1177
+ license: 'https://github.com/zloirock/core-js/blob/v3.30.0/LICENSE',
1177
1178
  source: 'https://github.com/zloirock/core-js'
1178
1179
  });
1179
1180
 
@@ -3938,6 +3939,7 @@ var FIND = 'find';
3938
3939
  var SKIPS_HOLES = true;
3939
3940
 
3940
3941
  // Shouldn't skip holes
3942
+ // eslint-disable-next-line es/no-array-prototype-find -- testing
3941
3943
  if (FIND in []) Array(1)[FIND](function () { SKIPS_HOLES = false; });
3942
3944
 
3943
3945
  // `Array.prototype.find` method
@@ -3966,6 +3968,7 @@ var FIND_INDEX = 'findIndex';
3966
3968
  var SKIPS_HOLES = true;
3967
3969
 
3968
3970
  // Shouldn't skip holes
3971
+ // eslint-disable-next-line es/no-array-prototype-findindex -- testing
3969
3972
  if (FIND_INDEX in []) Array(1)[FIND_INDEX](function () { SKIPS_HOLES = false; });
3970
3973
 
3971
3974
  // `Array.prototype.findIndex` method
@@ -16080,9 +16083,7 @@ module.exports = {
16080
16083
  add: uncurryThis(SetPrototype.add),
16081
16084
  has: uncurryThis(SetPrototype.has),
16082
16085
  remove: uncurryThis(SetPrototype['delete']),
16083
- proto: SetPrototype,
16084
- $has: SetPrototype.has,
16085
- $keys: SetPrototype.keys
16086
+ proto: SetPrototype
16086
16087
  };
16087
16088
 
16088
16089
 
@@ -17857,6 +17858,33 @@ module.exports = {
17857
17858
  /* 517 */
17858
17859
  /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
17859
17860
 
17861
+ var $ = __webpack_require__(3);
17862
+ var getBuiltIn = __webpack_require__(24);
17863
+ var validateArgumentsLength = __webpack_require__(328);
17864
+ var toString = __webpack_require__(69);
17865
+
17866
+ var URL = getBuiltIn('URL');
17867
+
17868
+ // `URL.canParse` method
17869
+ // https://url.spec.whatwg.org/#dom-url-canparse
17870
+ $({ target: 'URL', stat: true }, {
17871
+ canParse: function canParse(url) {
17872
+ var length = validateArgumentsLength(arguments.length, 1);
17873
+ var urlString = toString(url);
17874
+ var base = length < 2 || arguments[1] === undefined ? undefined : toString(arguments[1]);
17875
+ try {
17876
+ return !!new URL(urlString, base);
17877
+ } catch (error) {
17878
+ return false;
17879
+ }
17880
+ }
17881
+ });
17882
+
17883
+
17884
+ /***/ }),
17885
+ /* 518 */
17886
+ /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
17887
+
17860
17888
  "use strict";
17861
17889
 
17862
17890
  var $ = __webpack_require__(3);
@@ -17872,7 +17900,7 @@ $({ target: 'URL', proto: true, enumerable: true }, {
17872
17900
 
17873
17901
 
17874
17902
  /***/ }),
17875
- /* 518 */
17903
+ /* 519 */
17876
17904
  /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
17877
17905
 
17878
17906
  // TODO: Remove this module from `core-js@4` since it's replaced to module below
@@ -17880,7 +17908,7 @@ __webpack_require__(516);
17880
17908
 
17881
17909
 
17882
17910
  /***/ }),
17883
- /* 519 */
17911
+ /* 520 */
17884
17912
  /***/ (function(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
17885
17913
 
17886
17914
  "use strict";
@@ -17908,7 +17936,7 @@ if (DESCRIPTORS && !('size' in URLSearchParamsPrototype)) {
17908
17936
 
17909
17937
 
17910
17938
  /***/ }),
17911
- /* 520 */
17939
+ /* 521 */
17912
17940
  /***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
17913
17941
 
17914
17942
  "use strict";
@@ -19612,7 +19640,7 @@ function dispatchFunction(type, params) {
19612
19640
  return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type, params));
19613
19641
  }
19614
19642
  // EXTERNAL MODULE: ./node_modules/@babel/runtime/regenerator/index.js
19615
- var regenerator = __webpack_require__(521);
19643
+ var regenerator = __webpack_require__(522);
19616
19644
  ;// CONCATENATED MODULE: ./node_modules/d3-selection/src/selection/iterator.js
19617
19645
 
19618
19646
  var _marked = /*#__PURE__*/regenerator.mark(_callee);
@@ -19757,23 +19785,25 @@ var browser_this = undefined;
19757
19785
  /* eslint-disable no-new-func, no-undef */
19758
19786
 
19759
19787
  var win = function () {
19760
- _newArrowCheck(this, browser_this);
19761
- var root = typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis || typeof global === "object" && global !== null && global.Object === Object && global || typeof self === "object" && self !== null && self.Object === Object && self;
19762
- return root || Function("return this")();
19763
- }.bind(undefined)();
19788
+ _newArrowCheck(this, browser_this);
19789
+ var root = typeof globalThis === "object" && globalThis !== null && globalThis.Object === Object && globalThis || typeof global === "object" && global !== null && global.Object === Object && global || typeof self === "object" && self !== null && self.Object === Object && self;
19790
+ return root || Function("return this")();
19791
+ }.bind(undefined)(),
19792
+ hasRAF = typeof win.requestAnimationFrame === "function",
19793
+ hasRIC = typeof win.requestIdleCallback === "function",
19794
+ requestAnimationFrame = hasRAF ? win.requestAnimationFrame : function (cb) {
19795
+ _newArrowCheck(this, browser_this);
19796
+ return setTimeout(cb, 1);
19797
+ }.bind(undefined),
19798
+ cancelAnimationFrame = hasRAF ? win.cancelAnimationFrame : function (id) {
19799
+ _newArrowCheck(this, browser_this);
19800
+ return clearTimeout(id);
19801
+ }.bind(undefined),
19802
+ requestIdleCallback = hasRIC ? win.requestIdleCallback : requestAnimationFrame,
19803
+ cancelIdleCallback = hasRIC ? win.cancelIdleCallback : cancelAnimationFrame,
19804
+ browser_doc = win == null ? void 0 : win.document;
19764
19805
  /* eslint-enable no-new-func, no-undef */
19765
-
19766
19806
  // fallback for non-supported environments
19767
- win.requestIdleCallback = win.requestIdleCallback || function (cb) {
19768
- _newArrowCheck(this, browser_this);
19769
- return setTimeout(cb, 1);
19770
- }.bind(undefined);
19771
- // win.cancelIdleCallback = win.cancelIdleCallback || (id => clearTimeout(id));
19772
- win.requestAnimationFrame = win.requestAnimationFrame || function (cb) {
19773
- _newArrowCheck(this, browser_this);
19774
- return setTimeout(cb, 1);
19775
- }.bind(undefined);
19776
- var browser_doc = win == null ? void 0 : win.document;
19777
19807
  ;// CONCATENATED MODULE: ./src/config/const.ts
19778
19808
  /**
19779
19809
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -22434,6 +22464,18 @@ var isValue = function (v) {
22434
22464
  _newArrowCheck(this, util_this);
22435
22465
  return obj && !(obj != null && obj.nodeType) && isObjectType(obj) && !isArray(obj);
22436
22466
  }.bind(undefined);
22467
+ /**
22468
+ * Check if is array
22469
+ * @param {Array} arr Data to be checked
22470
+ * @returns {boolean}
22471
+ * @private
22472
+ */
22473
+ /**
22474
+ * Check if is object
22475
+ * @param {object} obj Data to be checked
22476
+ * @returns {boolean}
22477
+ * @private
22478
+ */
22437
22479
  /**
22438
22480
  * Get specified key value from object
22439
22481
  * If default value is given, will return if given key value not found
@@ -23213,7 +23255,7 @@ function convertInputType(mouse, touch) {
23213
23255
  function runUntil(fn, conditionFn) {
23214
23256
  var _this18 = this;
23215
23257
  if (conditionFn() === !1) {
23216
- win.requestAnimationFrame(function () {
23258
+ requestAnimationFrame(function () {
23217
23259
  _newArrowCheck(this, _this18);
23218
23260
  return runUntil(fn, conditionFn);
23219
23261
  }.bind(this));
@@ -23825,15 +23867,30 @@ var Store = /*#__PURE__*/function () {
23825
23867
  * - `false`: Remove padding completely and make shape to fully occupy the container element.
23826
23868
  * - In this case, axes and subchart will be hidden.
23827
23869
  * - To adjust some padding from this state, use `axis.[x|y].padding` option.
23870
+ * @property {string} [padding.mode] padding mode
23871
+ * - `"fit"`: Reduce padding as much as possible to make chart fit to the container element for chart types w/axis.<br>When specified, all padding values will be relative from fitted value.
23828
23872
  * @property {number} [padding.top] padding on the top of chart
23829
23873
  * @property {number} [padding.right] padding on the right of chart
23830
23874
  * @property {number} [padding.bottom] padding on the bottom of chart
23831
23875
  * @property {number} [padding.left] padding on the left of chart
23832
23876
  * @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.Padding)
23877
+ * @see [Demo: Fit padding](https://naver.github.io/billboard.js/demo/#ChartOptions.FitPadding)
23833
23878
  * @example
23834
23879
  * // remove padding completely.
23835
23880
  * padding: false,
23836
23881
  *
23882
+ * padding: {
23883
+ * // specifying mode value, will reduce padding and make fit to the container element.
23884
+ * mode: "fit"
23885
+ *
23886
+ * // when mode is "fit", all padding values will be relative from fitted value.
23887
+ * // so, 0 will be initial fitted value.
23888
+ * top: 20,
23889
+ * right: 20,
23890
+ * bottom: 20,
23891
+ * left: 20
23892
+ * }
23893
+ *
23837
23894
  * // or specify padding value for each side
23838
23895
  * padding: {
23839
23896
  * top: 20,
@@ -23843,6 +23900,7 @@ var Store = /*#__PURE__*/function () {
23843
23900
  * }
23844
23901
  */
23845
23902
  padding: !0,
23903
+ padding_mode: undefined,
23846
23904
  padding_left: undefined,
23847
23905
  padding_right: undefined,
23848
23906
  padding_top: undefined,
@@ -23856,7 +23914,9 @@ var Store = /*#__PURE__*/function () {
23856
23914
  * @property {boolean} [resize.auto=true] Set chart resize automatically on viewport changes.
23857
23915
  * @property {boolean|number} [resize.timer=true] Set resize timer option.
23858
23916
  * - **NOTE:**
23859
- * - The resize function will be called using: true - `setTimeout()`, false - `requestIdleCallback()`.
23917
+ * - The resize function will be called using:
23918
+ * - true: `setTimeout()`
23919
+ * - false: `requestIdleCallback()`
23860
23920
  * - Given number(delay in ms) value, resize function will be triggered using `setTimer()` with given delay.
23861
23921
  * @example
23862
23922
  * resize: {
@@ -25697,7 +25757,7 @@ function generateResize(option) {
25697
25757
  var _this = this;
25698
25758
  // Delay all resize functions call, to prevent unintended excessive call from resize event
25699
25759
  callResizeFn.clear();
25700
- if (option === !1 && win.requestIdleCallback) {
25760
+ if (option === !1) {
25701
25761
  requestIdleCallback(function () {
25702
25762
  var _this2 = this;
25703
25763
  _newArrowCheck(this, _this);
@@ -26310,6 +26370,7 @@ function getDataKeyForJson(keysParam, config) {
26310
26370
  axis = $$.axis,
26311
26371
  config = $$.config,
26312
26372
  state = $$.state,
26373
+ chartType = config.data_type,
26313
26374
  isCategorized = !1,
26314
26375
  isTimeSeries = !1,
26315
26376
  isCustomX = !1;
@@ -26378,7 +26439,8 @@ function getDataKeyForJson(keysParam, config) {
26378
26439
  return config.axis_x_categories.indexOf(v) > -1;
26379
26440
  }.bind(this)),
26380
26441
  isDataAppend = data.__append__,
26381
- xIndex = xKey === null && isDataAppend ? $$.api.data.values(id).length : 0;
26442
+ xIndex = xKey === null && isDataAppend ? $$.api.data.values(id).length : 0; // when .load() with 'append' option is used for indexed axis
26443
+ // @ts-ignore
26382
26444
  return {
26383
26445
  id: convertedId,
26384
26446
  id_org: id,
@@ -26453,11 +26515,12 @@ function getDataKeyForJson(keysParam, config) {
26453
26515
  state.hasPositiveValue = $$.hasPositiveValueInTargets(targets);
26454
26516
 
26455
26517
  // set target types
26456
- if (config.data_type) {
26457
- $$.setTargetType($$.mapToIds(targets).filter(function (id) {
26518
+ if (chartType && $$.isValidChartType(chartType)) {
26519
+ var targetIds = $$.mapToIds(targets).filter(function (id) {
26458
26520
  _newArrowCheck(this, _this2);
26459
- return !(id in config.data_types);
26460
- }.bind(this)), config.data_type);
26521
+ return !(id in config.data_types) || !$$.isValidChartType(config.data_types[id]);
26522
+ }.bind(this));
26523
+ $$.setTargetType(targetIds, chartType);
26461
26524
  }
26462
26525
 
26463
26526
  // cache as original id keyed
@@ -26838,7 +26901,8 @@ function getDataKeyForJson(keysParam, config) {
26838
26901
  getMaxDataCountTarget: function getMaxDataCountTarget() {
26839
26902
  var _this18 = this,
26840
26903
  target = this.filterTargetsToShow() || [],
26841
- length = target.length;
26904
+ length = target.length,
26905
+ isInverted = this.config.axis_x_inverted;
26842
26906
  if (length > 1) {
26843
26907
  target = target.map(function (t) {
26844
26908
  _newArrowCheck(this, _this18);
@@ -26850,11 +26914,11 @@ function getDataKeyForJson(keysParam, config) {
26850
26914
  _newArrowCheck(this, _this18);
26851
26915
  return v.x;
26852
26916
  }.bind(this));
26853
- target = sortValue(getUnique(target)).map(function (x, index) {
26917
+ target = sortValue(getUnique(target)).map(function (x, index, array) {
26854
26918
  _newArrowCheck(this, _this18);
26855
26919
  return {
26856
26920
  x: x,
26857
- index: index
26921
+ index: isInverted ? array.length - index - 1 : index
26858
26922
  };
26859
26923
  }.bind(this));
26860
26924
  } else if (length) {
@@ -27133,6 +27197,9 @@ function getDataKeyForJson(keysParam, config) {
27133
27197
  isRotated = config.axis_rotated,
27134
27198
  e = inputType === "touch" && event.changedTouches ? event.changedTouches[0] : event,
27135
27199
  index = findIndex(coords, isRotated ? e.clientY - rect.top : e.clientX - rect.left, 0, coords.length - 1, isRotated);
27200
+
27201
+ // get data based on the mouse coords
27202
+
27136
27203
  return index;
27137
27204
  },
27138
27205
  getDataLabelLength: function getDataLabelLength(min, max, key) {
@@ -27179,7 +27246,6 @@ function getDataKeyForJson(keysParam, config) {
27179
27246
  return $$.findClosest(target.values, pos);
27180
27247
  }.bind(this));
27181
27248
  // map to array of closest points of each target
27182
-
27183
27249
  // decide closest point and return
27184
27250
  return $$.findClosest(candidates, pos);
27185
27251
  },
@@ -27248,36 +27314,40 @@ function getDataKeyForJson(keysParam, config) {
27248
27314
  return values;
27249
27315
  }
27250
27316
 
27251
- // insert & append cloning first/last value to be fully rendered covering on each gap sides
27252
- var head = converted[0],
27253
- tail = converted[converted.length - 1],
27254
- id = head.id;
27255
- var x = head.x;
27256
-
27257
- // insert head
27258
- converted.unshift({
27259
- x: --x,
27260
- value: head.value,
27261
- id: id
27262
- });
27263
- isCategorized && stepType === "step-after" && converted.unshift({
27264
- x: --x,
27265
- value: head.value,
27266
- id: id
27267
- });
27317
+ // when all datas are null, return empty array
27318
+ // https://github.com/naver/billboard.js/issues/3124
27319
+ if (converted.length) {
27320
+ // insert & append cloning first/last value to be fully rendered covering on each gap sides
27321
+ var head = converted[0],
27322
+ tail = converted[converted.length - 1],
27323
+ id = head.id;
27324
+ var x = head.x;
27325
+
27326
+ // insert head
27327
+ converted.unshift({
27328
+ x: --x,
27329
+ value: head.value,
27330
+ id: id
27331
+ });
27332
+ isCategorized && stepType === "step-after" && converted.unshift({
27333
+ x: --x,
27334
+ value: head.value,
27335
+ id: id
27336
+ });
27268
27337
 
27269
- // append tail
27270
- x = tail.x;
27271
- converted.push({
27272
- x: ++x,
27273
- value: tail.value,
27274
- id: id
27275
- });
27276
- isCategorized && stepType === "step-before" && converted.push({
27277
- x: ++x,
27278
- value: tail.value,
27279
- id: id
27280
- });
27338
+ // append tail
27339
+ x = tail.x;
27340
+ converted.push({
27341
+ x: ++x,
27342
+ value: tail.value,
27343
+ id: id
27344
+ });
27345
+ isCategorized && stepType === "step-before" && converted.push({
27346
+ x: ++x,
27347
+ value: tail.value,
27348
+ id: id
27349
+ });
27350
+ }
27281
27351
  return converted;
27282
27352
  },
27283
27353
  convertValuesToRange: function convertValuesToRange(values) {
@@ -27503,11 +27573,27 @@ function getDataKeyForJson(keysParam, config) {
27503
27573
  */
27504
27574
 
27505
27575
 
27576
+
27577
+ /**
27578
+ * Call done callback with resize after transition
27579
+ * @param {Function} fn Callback function
27580
+ * @param {boolean} resizeAfter Weather to resize chart after the load
27581
+ * @private
27582
+ */
27583
+ function callDone(fn, resizeAfter) {
27584
+ if (resizeAfter === void 0) {
27585
+ resizeAfter = !1;
27586
+ }
27587
+ var $$ = this,
27588
+ api = $$.api;
27589
+ resizeAfter && $$.api.flush(!0);
27590
+ fn == null ? void 0 : fn.call(api);
27591
+ }
27506
27592
  /* harmony default export */ var load = ({
27507
27593
  load: function load(rawTargets, args) {
27508
27594
  var _this = this,
27509
- _args$done,
27510
27595
  $$ = this,
27596
+ data = $$.data,
27511
27597
  append = args.append,
27512
27598
  targets = rawTargets;
27513
27599
  if (targets) {
@@ -27527,7 +27613,7 @@ function getDataKeyForJson(keysParam, config) {
27527
27613
  }
27528
27614
 
27529
27615
  // Update/Add data
27530
- $$.data.targets.forEach(function (d) {
27616
+ data.targets.forEach(function (d) {
27531
27617
  _newArrowCheck(this, _this);
27532
27618
  for (var i = 0; i < targets.length; i++) {
27533
27619
  if (d.id === targets[i].id) {
@@ -27537,11 +27623,11 @@ function getDataKeyForJson(keysParam, config) {
27537
27623
  }
27538
27624
  }
27539
27625
  }.bind(this));
27540
- $$.data.targets = $$.data.targets.concat(targets); // add remained
27626
+ data.targets = data.targets.concat(targets); // add remained
27541
27627
  }
27542
27628
 
27543
27629
  // Set targets
27544
- $$.updateTargets($$.data.targets);
27630
+ $$.updateTargets(data.targets);
27545
27631
 
27546
27632
  // Redraw with new targets
27547
27633
  $$.redraw({
@@ -27552,7 +27638,7 @@ function getDataKeyForJson(keysParam, config) {
27552
27638
 
27553
27639
  // Update current state chart type and elements list after redraw
27554
27640
  $$.updateTypesElements();
27555
- (_args$done = args.done) == null ? void 0 : _args$done.call($$.api);
27641
+ callDone.call($$, args.done, args.resizeAfter);
27556
27642
  },
27557
27643
  loadFromArgs: function loadFromArgs(args) {
27558
27644
  var _this2 = this,
@@ -28021,6 +28107,7 @@ function drag_defaultTouchable() {
28021
28107
  return v !== this;
28022
28108
  }.bind(this));
28023
28109
  }); // select based on the index
28110
+ // filter if has new selection
28024
28111
  // call onout callback
28025
28112
  if (!isOver || shapesAtIndex.empty() || last.length === shape.size() && shape.nodes().every(function (v, i) {
28026
28113
  _newArrowCheck(this, _this5);
@@ -29090,7 +29177,9 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
29090
29177
  getXDomain: function getXDomain(targets) {
29091
29178
  var $$ = this,
29092
29179
  axis = $$.axis,
29180
+ config = $$.config,
29093
29181
  x = $$.scale.x,
29182
+ isInverted = config.axis_x_inverted,
29094
29183
  domain = [$$.getXDomainMinMax(targets, "min"), $$.getXDomainMinMax(targets, "max")];
29095
29184
  var _domain$ = domain[0],
29096
29185
  min = _domain$ === void 0 ? 0 : _domain$,
@@ -29120,7 +29209,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
29120
29209
  max = isTimeSeries ? new Date(lastX.getTime() + padding.right) : lastX + padding.right;
29121
29210
  }
29122
29211
  }
29123
- return [min, max];
29212
+ return isInverted ? [max, min] : [min, max];
29124
29213
  },
29125
29214
  updateXDomain: function updateXDomain(targets, withUpdateXDomain, withUpdateOrgXDomain, withTrim, domain) {
29126
29215
  var $$ = this,
@@ -29132,7 +29221,7 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
29132
29221
  zoomEnabled = config.zoom_enabled;
29133
29222
  if (withUpdateOrgXDomain) {
29134
29223
  var _$$$brush;
29135
- x.domain(domain || sortValue($$.getXDomain(targets)));
29224
+ x.domain(domain || sortValue($$.getXDomain(targets), !config.axis_x_inverted));
29136
29225
  org.xDomain = x.domain();
29137
29226
  zoomEnabled && $$.zoom.updateScaleExtent();
29138
29227
  subX.domain(x.domain());
@@ -29148,15 +29237,24 @@ var schemeCategory10 = ["#1f77b4", "#ff7f0e", "#2ca02c", "#d62728", "#9467bd", "
29148
29237
  withTrim && x.domain($$.trimXDomain(x.orgDomain()));
29149
29238
  return x.domain();
29150
29239
  },
29240
+ /**
29241
+ * Trim x domain when given domain surpasses the range
29242
+ * @param {Array} domain Domain value
29243
+ * @returns {Array} Trimed domain if given domain is out of range
29244
+ * @private
29245
+ */
29151
29246
  trimXDomain: function trimXDomain(domain) {
29152
- var zoomDomain = this.getZoomDomain(),
29153
- min = zoomDomain[0],
29154
- max = zoomDomain[1];
29155
- if (domain[0] <= min) {
29156
- domain[1] = +domain[1] + (min - domain[0]);
29247
+ var $$ = this,
29248
+ isInverted = $$.config.axis_x_inverted,
29249
+ zoomDomain = $$.getZoomDomain(),
29250
+ _zoomDomain = zoomDomain,
29251
+ min = _zoomDomain[0],
29252
+ max = _zoomDomain[1];
29253
+ if (isInverted ? domain[0] >= min : domain[0] <= min) {
29157
29254
  domain[0] = min;
29255
+ domain[1] = +domain[1] + (min - domain[0]);
29158
29256
  }
29159
- if (max <= domain[1]) {
29257
+ if (isInverted ? domain[1] <= max : domain[1] >= max) {
29160
29258
  domain[0] = +domain[0] - (domain[1] - max);
29161
29259
  domain[1] = max;
29162
29260
  }
@@ -29501,13 +29599,15 @@ function getLegendColor(id) {
29501
29599
  * @private
29502
29600
  */
29503
29601
  getLegendHeight: function getLegendHeight() {
29504
- var $$ = this,
29602
+ var _$$$config$padding,
29603
+ $$ = this,
29505
29604
  _$$$state3 = $$.state,
29506
29605
  current = _$$$state3.current,
29507
29606
  isLegendRight = _$$$state3.isLegendRight,
29508
29607
  legendItemHeight = _$$$state3.legendItemHeight,
29509
- legendStep = _$$$state3.legendStep;
29510
- return $$.config.legend_show ? isLegendRight ? current.height : Math.max(20, legendItemHeight) * (legendStep + 1) : 0;
29608
+ legendStep = _$$$state3.legendStep,
29609
+ isFitPadding = ((_$$$config$padding = $$.config.padding) == null ? void 0 : _$$$config$padding.mode) === "fit";
29610
+ return $$.config.legend_show ? isLegendRight ? current.height : (isFitPadding ? 10 : Math.max(20, legendItemHeight)) * (legendStep + 1) : 0;
29511
29611
  },
29512
29612
  /**
29513
29613
  * Get the opacity of the legend that is unfocused
@@ -29720,7 +29820,7 @@ function getLegendColor(id) {
29720
29820
  return !isDefined(config.data_names[id]) || config.data_names[id] !== null;
29721
29821
  }.bind(this)),
29722
29822
  withTransition = options.withTransition,
29723
- updatePositions = $$.getUpdateLegendPositions(targetIdz, dimension, sizes);
29823
+ updatePositions = $$.getUpdateLegendPositions(targetIdz, dimension, sizes); // Skip elements when their name is set to null
29724
29824
  if (state.isLegendInset) {
29725
29825
  dimension.step = config.legend_inset_step ? config.legend_inset_step : targetIdz.length;
29726
29826
  $$.updateLegendStep(dimension.step);
@@ -29853,7 +29953,7 @@ function getLegendColor(id) {
29853
29953
  sizes.margins[dimension.step] = state.isLegendInset ? 10 : margin;
29854
29954
  sizes.offsets[id2] = dimension.totalLength;
29855
29955
  dimension.totalLength += itemLength;
29856
- };
29956
+ }; // MEMO: care about condifion of step, totalLength
29857
29957
  if (index === 0) {
29858
29958
  dimension.totalLength = 0;
29859
29959
  dimension.step = 0;
@@ -29921,6 +30021,8 @@ function getLegendColor(id) {
29921
30021
  isRectangle = legendType !== "circle",
29922
30022
  isLegendRightOrInset = state.isLegendRight || state.isLegendInset,
29923
30023
  l = legend.selectAll("." + $LEGEND.legendItem).data(targetIdz).enter().append("g");
30024
+ // Define g for legend area
30025
+
29924
30026
  $$.setLegendItem(l);
29925
30027
  l.append("text").text(function (id) {
29926
30028
  _newArrowCheck(this, _this6);
@@ -30167,7 +30269,8 @@ function getLegendColor(id) {
30167
30269
  flowFn && flowFn();
30168
30270
  state.redrawing = !1;
30169
30271
  callFn(config.onrendered, $$.api);
30170
- }.bind(this);
30272
+ }.bind(this); // redraw list
30273
+ // callback function after redraw ends
30171
30274
  if (afterRedraw) {
30172
30275
  // Only use transition when current tab is visible.
30173
30276
  if (withTransition && redrawList.length) {
@@ -30276,20 +30379,6 @@ function getLegendColor(id) {
30276
30379
 
30277
30380
  // Draw with new sizes & scales
30278
30381
  $$.redraw(options, transitions);
30279
- },
30280
- /**
30281
- * Redraw without rescale
30282
- * @private
30283
- */
30284
- redrawWithoutRescale: function redrawWithoutRescale() {
30285
- this.redraw({
30286
- withY: !1,
30287
- withDimension: !1,
30288
- withLegend: !1,
30289
- withSubchart: !1,
30290
- withEventRect: !1,
30291
- withTransitionForAxis: !1
30292
- });
30293
30382
  }
30294
30383
  });
30295
30384
  ;// CONCATENATED MODULE: ./node_modules/d3-array/src/ticks.js
@@ -31581,7 +31670,7 @@ function getScale(type, min, max) {
31581
31670
  getXScale: function getXScale(min, max, domain, offset) {
31582
31671
  var $$ = this,
31583
31672
  scale = $$.scale.zoom || getScale($$.axis.getAxisType("x"), min, max);
31584
- return $$.getCustomizedScale(domain ? scale.domain(domain) : scale, offset);
31673
+ return $$.getCustomizedXScale(domain ? scale.domain(domain) : scale, offset);
31585
31674
  },
31586
31675
  /**
31587
31676
  * Get y Axis scale function
@@ -31615,19 +31704,20 @@ function getScale(type, min, max) {
31615
31704
  return this.scale[key];
31616
31705
  },
31617
31706
  /**
31618
- * Get customized scale
31707
+ * Get customized x axis scale
31619
31708
  * @param {d3.scaleLinear|d3.scaleTime} scaleValue Scale function
31620
31709
  * @param {Function} offsetValue Offset getter to be sum
31621
31710
  * @returns {Function} Scale function
31622
31711
  * @private
31623
31712
  */
31624
- getCustomizedScale: function getCustomizedScale(scaleValue, offsetValue) {
31713
+ getCustomizedXScale: function getCustomizedXScale(scaleValue, offsetValue) {
31625
31714
  var _this = this,
31626
31715
  $$ = this,
31627
31716
  offset = offsetValue || function () {
31628
31717
  _newArrowCheck(this, _this);
31629
31718
  return $$.axis.x.tickOffset();
31630
31719
  }.bind(this),
31720
+ isInverted = $$.config.axis_x_inverted,
31631
31721
  scale = function (d, raw) {
31632
31722
  var v = scaleValue(d) + offset();
31633
31723
  return raw ? v : Math.ceil(v);
@@ -31651,7 +31741,7 @@ function getScale(type, min, max) {
31651
31741
  var domain = domainValue;
31652
31742
  if (!arguments.length) {
31653
31743
  domain = this.orgDomain();
31654
- return [domain[0], domain[1] + 1];
31744
+ return isInverted ? [domain[0] + 1, domain[1]] : [domain[0], domain[1] + 1];
31655
31745
  }
31656
31746
  scaleValue.domain(domain);
31657
31747
  return scale;
@@ -31702,6 +31792,11 @@ function getScale(type, min, max) {
31702
31792
  },
31703
31793
  xDomain = updateXDomain && ((_scale$x = scale.x) == null ? void 0 : _scale$x.orgDomain()),
31704
31794
  xSubDomain = updateXDomain && org.xDomain;
31795
+ // update edges
31796
+
31797
+ // update scales
31798
+ // x Axis
31799
+
31705
31800
  scale.x = $$.getXScale(min.x, max.x, xDomain, function () {
31706
31801
  _newArrowCheck(this, _this2);
31707
31802
  return axis.x.tickOffset();
@@ -32838,7 +32933,7 @@ function stepAfter(context) {
32838
32933
  xs = _$$$config.data_xs,
32839
32934
  removeNull = _$$$config.bar_indices_removeNull,
32840
32935
  id = d.id,
32841
- index = d.index;
32936
+ index = d.index; // eslint-disable-line
32842
32937
  if ($$.isBarType(id) && removeNull) {
32843
32938
  var ind = {};
32844
32939
 
@@ -32883,6 +32978,8 @@ function stepAfter(context) {
32883
32978
  return p + c;
32884
32979
  }.bind(this),
32885
32980
  halfWidth = isObjectType(offset) && (offset._$total.length ? offset._$total.reduce(sum) / 2 : 0);
32981
+ // total shapes half width
32982
+
32886
32983
  return function (d) {
32887
32984
  _newArrowCheck(this, _this5);
32888
32985
  var ind = $$.getIndices(indices, d, "getShapeX"),
@@ -33227,47 +33324,60 @@ function stepAfter(context) {
33227
33324
  return padding + (axesLen ? $$.getHorizontalAxisHeight(axisId) * axesLen : 0);
33228
33325
  },
33229
33326
  getCurrentPaddingLeft: function getCurrentPaddingLeft(withoutRecompute) {
33230
- var $$ = this,
33327
+ var _config$padding,
33328
+ $$ = this,
33231
33329
  config = $$.config,
33232
33330
  hasAxis = $$.state.hasAxis,
33233
33331
  isRotated = config.axis_rotated,
33332
+ isFitPadding = ((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit",
33234
33333
  axisId = isRotated ? "x" : "y",
33235
33334
  axesLen = hasAxis ? config["axis_" + axisId + "_axes"].length : 0,
33236
33335
  axisWidth = hasAxis ? $$.getAxisWidthByAxisId(axisId, withoutRecompute) : 0;
33237
- var padding;
33336
+ if (!isFitPadding) {
33337
+ axisWidth = ceil10(axisWidth);
33338
+ }
33339
+ var padding = config["axis_" + axisId + "_inner"] || !config["axis_" + axisId + "_show"] ? 0 : axisWidth;
33238
33340
  if (isValue(config.padding_left)) {
33239
- padding = config.padding_left;
33341
+ padding = config.padding_left + (isFitPadding && isRotated ? axisWidth : 0);
33240
33342
  } else if (hasAxis && isRotated) {
33241
- padding = !config.axis_x_show ? 1 : Math.max(ceil10(axisWidth), 40);
33242
- } else if (hasAxis && (!config.axis_y_show || config.axis_y_inner)) {
33243
- // && !config.axis_rotated
33244
- padding = $$.axis.getAxisLabelPosition("y").isOuter ? 30 : 1;
33245
- } else {
33246
- padding = ceil10(axisWidth);
33343
+ padding = !config.axis_x_show ? 1 : isFitPadding ? axisWidth : Math.max(axisWidth, 40);
33344
+ }
33345
+ if (hasAxis && (isFitPadding || config["axis_" + axisId + "_inner"]) && config["axis_" + axisId + "_label"].text) {
33346
+ padding += $$.axis.getAxisLabelPosition("y").isOuter ? 20 : 0;
33247
33347
  }
33248
33348
  return padding + axisWidth * axesLen;
33249
33349
  },
33250
33350
  getCurrentPaddingRight: function getCurrentPaddingRight(withXAxisTickTextOverflow) {
33351
+ var _config$padding2, _$$$axis;
33251
33352
  if (withXAxisTickTextOverflow === void 0) {
33252
33353
  withXAxisTickTextOverflow = !1;
33253
33354
  }
33254
33355
  var $$ = this,
33255
33356
  config = $$.config,
33256
33357
  hasAxis = $$.state.hasAxis,
33358
+ isRotated = config.axis_rotated,
33359
+ isFitPadding = ((_config$padding2 = config.padding) == null ? void 0 : _config$padding2.mode) === "fit",
33360
+ defaultPadding = isFitPadding ? 2 : 10,
33257
33361
  legendWidthOnRight = $$.state.isLegendRight ? $$.getLegendWidth() + 20 : 0,
33258
33362
  axesLen = hasAxis ? config.axis_y2_axes.length : 0,
33259
- axisWidth = hasAxis ? $$.getAxisWidthByAxisId("y2") : 0,
33260
- xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(10) : 0;
33261
- var padding;
33363
+ axisLabelWidth = (_$$$axis = $$.axis) != null && _$$$axis.getAxisLabelPosition("y2").isOuter ? 20 : 0,
33364
+ xAxisTickTextOverflow = withXAxisTickTextOverflow ? $$.axis.getXAxisTickTextY2Overflow(defaultPadding) : 0;
33365
+ var axisWidth = hasAxis && !config.axis_y2_inner ? $$.getAxisWidthByAxisId("y2") : 1;
33366
+ if (!isFitPadding) {
33367
+ axisWidth = ceil10(axisWidth);
33368
+ }
33369
+ var padding = isRotated ? 0 : Math.max(axisWidth + legendWidthOnRight, xAxisTickTextOverflow);
33262
33370
  if (isValue(config.padding_right)) {
33263
- padding = config.padding_right + (hasAxis ? 1 : 0); // 1 is needed not to hide tick line
33264
- } else if ($$.axis && config.axis_rotated) {
33265
- padding = 10 + legendWidthOnRight;
33371
+ // padding = config.padding_right + (hasAxis ? 1 : 0); // 1 is needed not to hide tick line
33372
+
33373
+ padding = config.padding_right + (isFitPadding && (isRotated || !config.axis_y2_show ? defaultPadding : padding)) + (hasAxis && !isFitPadding ? 1 : 0); // 1 is needed not to hide tick line
33374
+ } else if ($$.axis && isRotated) {
33375
+ padding = defaultPadding + legendWidthOnRight;
33266
33376
  } else if ($$.axis && (!config.axis_y2_show || config.axis_y2_inner)) {
33267
- // && !config.axis_rotated
33268
- padding = Math.max(2 + legendWidthOnRight + ($$.axis.getAxisLabelPosition("y2").isOuter ? 20 : 0), xAxisTickTextOverflow);
33269
- } else {
33270
- padding = Math.max(ceil10(axisWidth) + legendWidthOnRight, xAxisTickTextOverflow);
33377
+ padding = Math.max((isFitPadding && !config.axis_y2_show ? 2 : 1) + legendWidthOnRight + axisLabelWidth, xAxisTickTextOverflow);
33378
+ }
33379
+ if (hasAxis && !isRotated && isFitPadding && config.axis_y2_show && !config.axis_y2_inner && config.axis_y2_label.text) {
33380
+ padding += axisLabelWidth;
33271
33381
  }
33272
33382
  return padding + axisWidth * axesLen;
33273
33383
  },
@@ -33406,12 +33516,14 @@ function stepAfter(context) {
33406
33516
  * @private
33407
33517
  */
33408
33518
  updateSizes: function updateSizes(isInit) {
33409
- var $$ = this,
33519
+ var _config$padding3,
33520
+ $$ = this,
33410
33521
  config = $$.config,
33411
33522
  state = $$.state,
33412
33523
  legend = $$.$el.legend,
33413
33524
  isRotated = config.axis_rotated,
33414
- isNonAxis = $$.hasArcType() || state.hasTreemap;
33525
+ isNonAxis = $$.hasArcType() || state.hasTreemap,
33526
+ isFitPadding = ((_config$padding3 = config.padding) == null ? void 0 : _config$padding3.mode) === "fit";
33415
33527
  isInit || $$.setContainerSize();
33416
33528
  var currLegend = {
33417
33529
  width: legend ? $$.getLegendWidth() : 0,
@@ -33432,7 +33544,7 @@ function stepAfter(context) {
33432
33544
  bottom: $$.getHorizontalAxisHeight("y") + legendHeightForBottom + padding.bottom,
33433
33545
  left: subchartHeight + (isNonAxis ? 0 : padding.left)
33434
33546
  } : {
33435
- top: 4 + padding.top,
33547
+ top: (isFitPadding ? 0 : 4) + padding.top,
33436
33548
  // for top tick text
33437
33549
  right: isNonAxis ? 0 : $$.getCurrentPaddingRight(!0),
33438
33550
  bottom: xAxisHeight + subchartHeight + legendHeightForBottom + padding.bottom,
@@ -34050,6 +34162,8 @@ function setRotatePos(d, pos, anchor, isRotated, isInverted) {
34050
34162
  _newArrowCheck(this, _this5);
34051
34163
  return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
34052
34164
  }.bind(this);
34165
+ // Calculates the length of the hypotenuse
34166
+
34053
34167
  textNode.node() && filteredTextNodes.each(function () {
34054
34168
  var coordinate = getTranslation(this),
34055
34169
  filteredTextNode = src_select(this),
@@ -34562,6 +34676,8 @@ function getTextPos(pos, width) {
34562
34676
  y: y
34563
34677
  },
34564
34678
  data = (_selectedData$filter = selectedData.filter(Boolean)) == null ? void 0 : _selectedData$filter.shift();
34679
+ // get mouse event position
34680
+
34565
34681
  if (scale.x && data && "x" in data) {
34566
34682
  currPos.xAxis = scale.x(data.x);
34567
34683
  }
@@ -34707,7 +34823,7 @@ function getTextPos(pos, width) {
34707
34823
  y = isRotated ? state.height + padding : 0;
34708
34824
  } else if (target === "y2") {
34709
34825
  x = isRotated ? 0 : state.width + padding;
34710
- y = isRotated ? 1 - padding : 0;
34826
+ y = isRotated && padding ? 1 - padding : 0;
34711
34827
  } else if (target === "subX") {
34712
34828
  x = 0;
34713
34829
  y = isRotated ? 0 : state.height2;
@@ -34759,6 +34875,15 @@ function getTextPos(pos, width) {
34759
34875
 
34760
34876
 
34761
34877
  /* harmony default export */ var internals_type = ({
34878
+ /**
34879
+ * Check if the given chart type is valid
34880
+ * @param {string} type Chart type string
34881
+ * @returns {boolean}
34882
+ * @private
34883
+ */
34884
+ isValidChartType: function isValidChartType(type) {
34885
+ return !!(type && Object.values(TYPE).indexOf(type) > -1);
34886
+ },
34762
34887
  setTargetType: function setTargetType(targetIds, type) {
34763
34888
  var _this = this,
34764
34889
  $$ = this,
@@ -35031,38 +35156,28 @@ function getTextPos(pos, width) {
35031
35156
  * @private
35032
35157
  */
35033
35158
  var ChartInternal = /*#__PURE__*/function () {
35034
- // API interface
35035
- // config object
35036
- // cache instance
35037
- // elements
35038
- // state variables
35039
- // all Chart instances array within page (equivalent of 'bb.instances')
35040
-
35041
- // data object
35042
-
35043
- // Axis
35044
- // Axis
35045
-
35046
- // scales
35047
-
35048
- // original values
35049
-
35050
- // formatter function
35051
-
35052
- // format function
35053
-
35054
35159
  function ChartInternal(api) {
35055
35160
  this.api = void 0;
35161
+ // API interface
35056
35162
  this.config = void 0;
35163
+ // config object
35057
35164
  this.cache = void 0;
35165
+ // cache instance
35058
35166
  this.$el = void 0;
35167
+ // elements
35059
35168
  this.state = void 0;
35169
+ // state variables
35060
35170
  this.charts = void 0;
35171
+ // all Chart instances array within page (equivalent of 'bb.instances')
35172
+ // data object
35061
35173
  this.data = {
35062
35174
  xs: {},
35063
35175
  targets: []
35064
35176
  };
35177
+ // Axis
35065
35178
  this.axis = void 0;
35179
+ // Axis
35180
+ // scales
35066
35181
  this.scale = {
35067
35182
  x: null,
35068
35183
  y: null,
@@ -35072,15 +35187,18 @@ var ChartInternal = /*#__PURE__*/function () {
35072
35187
  subY2: null,
35073
35188
  zoom: null
35074
35189
  };
35190
+ // original values
35075
35191
  this.org = {
35076
35192
  xScale: null,
35077
35193
  xDomain: null
35078
35194
  };
35195
+ // formatter function
35079
35196
  this.color = void 0;
35080
35197
  this.patterns = void 0;
35081
35198
  this.levelColor = void 0;
35082
35199
  this.point = void 0;
35083
35200
  this.brush = void 0;
35201
+ // format function
35084
35202
  this.format = {
35085
35203
  extraLineClasses: null,
35086
35204
  xAxisTick: null,
@@ -35290,7 +35408,6 @@ var ChartInternal = /*#__PURE__*/function () {
35290
35408
  hasPolar = $$.hasType("polar");
35291
35409
  // for arc type, set axes to not be shown
35292
35410
  // $$.hasArcType() && ["x", "y", "y2"].forEach(id => (config[`axis_${id}_show`] = false));
35293
-
35294
35411
  if (hasAxis) {
35295
35412
  $$.axis = $$.getAxisInstance();
35296
35413
  config.zoom_enabled && $$.initZoom();
@@ -35326,7 +35443,7 @@ var ChartInternal = /*#__PURE__*/function () {
35326
35443
 
35327
35444
  // Set domains for each scale
35328
35445
  if (x) {
35329
- x.domain(sortValue($$.getXDomain($$.data.targets)));
35446
+ x.domain(sortValue($$.getXDomain($$.data.targets), !config.axis_x_inverted));
35330
35447
  subX.domain(x.domain());
35331
35448
 
35332
35449
  // Save original x domain for zoom update
@@ -36586,17 +36703,17 @@ function renderText(ctx, glyph) {
36586
36703
  state.defocusedTargetIds = targetIds;
36587
36704
  },
36588
36705
  /**
36589
- * This API reverts specified targets.<br><br>
36590
- * You can specify multiple targets by giving an array that includes id as String. If no argument is given, all of targets will be reverted.
36706
+ * Revert focused or defocused state to initial state.<br><br>
36707
+ * You can specify multiple targets by giving an array that includes id as string. If no argument is given, all of targets will be reverted.
36591
36708
  * @function revert
36592
36709
  * @instance
36593
36710
  * @memberof Chart
36594
36711
  * @param {string|Array} targetIdsValue Target ids to be reverted
36595
36712
  * @example
36596
- * // data1 will be reverted.
36713
+ * // 'data1' will be reverted.
36597
36714
  * chart.revert("data1");
36598
36715
  *
36599
- * // data1 and data2 will be reverted.
36716
+ * // 'data1' and 'data2' will be reverted.
36600
36717
  * chart.revert(["data1", "data2"]);
36601
36718
  *
36602
36719
  * // all targets will be reverted.
@@ -36698,6 +36815,7 @@ var legend_legend = {
36698
36815
  */
36699
36816
 
36700
36817
 
36818
+
36701
36819
  /* harmony default export */ var api_load = ({
36702
36820
  /**
36703
36821
  * Load data to the chart.<br><br>
@@ -36712,23 +36830,29 @@ var legend_legend = {
36712
36830
  * @memberof Chart
36713
36831
  * @param {object} args The object can consist with following members:<br>
36714
36832
  *
36715
- * | Key | Description |
36716
- * | --- | --- |
36717
- * | - url<br>- json<br>- rows<br>- columns | The data will be loaded. If data that has the same target id is given, the chart will be updated. Otherwise, new target will be added |
36718
- * | data | Data objects to be loaded. Checkout the example. |
36719
- * | append | Load data appending it to the current dataseries.<br>If the existing chart has`x` value, should provide with corresponding `x` value for newly loaded data. |
36720
- * | names | Same as data.names() |
36721
- * | xs | Same as data.xs option |
36722
- * | classes | The classes specified by data.classes will be updated. classes must be Object that has target id as keys. |
36723
- * | categories | The categories specified by axis.x.categories or data.x will be updated. categories must be Array. |
36724
- * | axes | The axes specified by data.axes will be updated. axes must be Object that has target id as keys. |
36725
- * | colors | The colors specified by data.colors will be updated. colors must be Object that has target id as keys. |
36726
- * | headers | Set request header if loading via `data.url`.<br>@see [data․headers](Options.html#.data%25E2%2580%25A4headers) |
36727
- * | keys | Choose which JSON objects keys correspond to desired data.<br>**NOTE:** Only for JSON object given as array.<br>@see [data․keys](Options.html#.data%25E2%2580%25A4keys) |
36728
- * | mimeType | Set 'json' if loading JSON via url.<br>@see [data․mimeType](Options.html#.data%25E2%2580%25A4mimeType) |
36729
- * | - type<br>- types | The type of targets will be updated. type must be String and types must be Object. |
36730
- * | unload | Specify the data will be unloaded before loading new data. If true given, all of data will be unloaded. If target ids given as String or Array, specified targets will be unloaded. If absent or false given, unload will not occur. |
36731
- * | done | The specified function will be called after data loaded.|
36833
+ * | Key | Type | Description |
36834
+ * | --- | --- | --- |
36835
+ * | columns | Array | The `columns` data will be loaded. If data that has the same target id is given, the chart will be updated. Otherwise, new target will be added |
36836
+ * | json | Array | The `json` data will be loaded. If data that has the same target id is given, the chart will be updated. Otherwise, new target will be added |
36837
+ * | rows | Array | The `rows` data will be loaded. If data that has the same target id is given, the chart will be updated. Otherwise, new target will be added |
36838
+ * | url | string | The data from `url` will be loaded. If data that has the same target id is given, the chart will be updated. Otherwise, new target will be added |
36839
+ * | &nbsp; | | |
36840
+ * | append | boolean | Load data appending it to the current dataseries.<br>If the existing chart has`x` value, should provide with corresponding `x` value for newly loaded data. |
36841
+ * | axes | Object | The axes specified by data.axes will be updated. axes must be Object that has target id as keys. |
36842
+ * | categories | Array | The categories specified by axis.x.categories or data.x will be updated. categories must be Array. |
36843
+ * | classes | Object | The classes specified by data.classes will be updated. classes must be Object that has target id as keys. |
36844
+ * | colors | Object | The colors specified by data.colors will be updated. colors must be Object that has target id as keys. |
36845
+ * | data | Obejct | Data objects to be loaded. Checkout the example. |
36846
+ * | done | Function | The specified function will be called after data loaded.|
36847
+ * | headers | string | Set request header if loading via `data.url`.<br>@see [data․headers](Options.html#.data%25E2%2580%25A4headers) |
36848
+ * | keys | Object | Choose which JSON objects keys correspond to desired data.<br>**NOTE:** Only for JSON object given as array.<br>@see [data․keys](Options.html#.data%25E2%2580%25A4keys) |
36849
+ * | mimeType | string | Set 'json' if loading JSON via url.<br>@see [data․mimeType](Options.html#.data%25E2%2580%25A4mimeType) |
36850
+ * | names | Object | Same as data.names() |
36851
+ * | resizeAfter | boolean | Resize after the load. Default value is `false`.<br>- This option won't call `onresize` neither `onresized`.<br>- When set to 'true', will call `.flush(true)` at the end of load. |
36852
+ * | type | string | The type of targets will be updated. |
36853
+ * | types | Object | The types of targets will be updated. |
36854
+ * | unload | Array | Specify the data will be unloaded before loading new data. If true given, all of data will be unloaded. If target ids given as String or Array, specified targets will be unloaded. If absent or false given, unload will not occur. |
36855
+ * | xs | string | Same as data.xs option |
36732
36856
  * @see [Demo](https://naver.github.io/billboard.js/demo/#Data.DataFromURL)
36733
36857
  * @example
36734
36858
  * // Load data1 and unload data2 and data3
@@ -36740,6 +36864,7 @@ var legend_legend = {
36740
36864
  * unload: ["data2", "data3"],
36741
36865
  * url: "...",
36742
36866
  * done: function() { ... }
36867
+ * resizeAfter: true // will resize after load
36743
36868
  * });
36744
36869
  * @example
36745
36870
  * const chart = bb.generate({
@@ -36869,7 +36994,7 @@ var legend_legend = {
36869
36994
  _newArrowCheck(this, _this);
36870
36995
  // to mitigate improper rendering for multiple consecutive calls
36871
36996
  // https://github.com/naver/billboard.js/issues/2121
36872
- win.requestIdleCallback(function () {
36997
+ requestIdleCallback(function () {
36873
36998
  _newArrowCheck(this, _this2);
36874
36999
  return $$.loadFromArgs(args);
36875
37000
  }.bind(this));
@@ -36893,13 +37018,15 @@ var legend_legend = {
36893
37018
  * | --- | --- | --- |
36894
37019
  * | ids | String &vert; Array | Target id data to be unloaded. If not given, all data will be unloaded. |
36895
37020
  * | done | Fuction | Callback after data is unloaded. |
37021
+ * | resizeAfter | boolean | Resize after the unload. Default value is `false`.<br>- This option won't call `onresize` neither `onresized`.<br>- When set to 'true', will call `.flush(true)` at the end of unload. |
36896
37022
  * @example
36897
37023
  * // Unload data2 and data3
36898
37024
  * chart.unload({
36899
37025
  * ids: ["data2", "data3"],
36900
37026
  * done: function() {
36901
37027
  * // called after the unloaded
36902
- * }
37028
+ * },
37029
+ * resizeAfter: true // will resize after unload
36903
37030
  * });
36904
37031
  */
36905
37032
  unload: function unload(argsValue) {
@@ -36924,7 +37051,7 @@ var legend_legend = {
36924
37051
  withLegend: !0
36925
37052
  });
36926
37053
  $$.cache.remove(ids);
36927
- args.done && args.done.call(this);
37054
+ callDone.call($$, args.done, args.resizeAfter);
36928
37055
  }.bind(this));
36929
37056
  }
36930
37057
  });
@@ -37611,19 +37738,61 @@ var axis = {
37611
37738
  return config.axis_x_categories;
37612
37739
  }
37613
37740
  });
37614
- ;// CONCATENATED MODULE: ./src/Chart/api/grid.x.ts
37741
+ ;// CONCATENATED MODULE: ./src/Chart/api/grid.ts
37615
37742
  /**
37616
37743
  * Copyright (c) 2017 ~ present NAVER Corp.
37617
37744
  * billboard.js project is licensed under the MIT license
37618
37745
  */
37619
37746
 
37747
+ /**
37748
+ * Update grid lines.
37749
+ * @param {Array} grids grid lines to update
37750
+ * @param {string} axisId axis' id: "x" or "y"
37751
+ * @returns {Array}
37752
+ * @private
37753
+ */
37754
+ function grid(grids, axisId) {
37755
+ var $$ = this.internal,
37756
+ config = $$.config,
37757
+ withTransition = config.transition_duration && isTabVisible(),
37758
+ gridPropLines = "grid_" + axisId + "_lines";
37759
+ if (!grids) {
37760
+ return config[gridPropLines];
37761
+ }
37762
+ config[gridPropLines] = grids;
37763
+ $$.updateGrid();
37764
+ $$.redrawGrid(withTransition);
37765
+ return config[gridPropLines];
37766
+ }
37767
+
37768
+ /**
37769
+ * Add grid lines.
37770
+ * @param {Array|object} grids grid lines to add
37771
+ * @param {string} axisId axis' id: "x" or "y"
37772
+ * @returns {Array}
37773
+ * @private
37774
+ */
37775
+ function _add(grids, axisId) {
37776
+ return grid.bind(this)(this.internal.config["grid_" + axisId + "_lines"].concat(grids || []), axisId);
37777
+ }
37778
+
37779
+ /**
37780
+ * Remove grid lines.
37781
+ * @param {object} grids grid lines to remove
37782
+ * @param {boolean} isXAxis weather is x axis or not
37783
+ * @private
37784
+ */
37785
+ function _remove(grids, isXAxis) {
37786
+ this.internal.removeGridLines(grids, isXAxis);
37787
+ }
37788
+
37620
37789
  /**
37621
37790
  * Update x grid lines.
37622
37791
  * @function xgrids
37623
37792
  * @instance
37624
37793
  * @memberof Chart
37625
37794
  * @param {Array} grids X grid lines will be replaced with this argument. The format of this argument is the same as grid.x.lines.
37626
- * @returns {object}
37795
+ * @returns {Array}
37627
37796
  * @example
37628
37797
  * // Show 2 x grid lines
37629
37798
  * chart.xgrids([
@@ -37633,14 +37802,7 @@ var axis = {
37633
37802
  * // --> Returns: [{value: 1, text: "Label 1"}, {value: 4, text: "Label 4"}]
37634
37803
  */
37635
37804
  var xgrids = function (grids) {
37636
- var $$ = this.internal,
37637
- config = $$.config;
37638
- if (!grids) {
37639
- return config.grid_x_lines;
37640
- }
37641
- config.grid_x_lines = grids;
37642
- $$.redrawWithoutRescale();
37643
- return config.grid_x_lines;
37805
+ return grid.bind(this)(grids, "x");
37644
37806
  };
37645
37807
  util_extend(xgrids, {
37646
37808
  /**
@@ -37650,7 +37812,7 @@ util_extend(xgrids, {
37650
37812
  * @instance
37651
37813
  * @memberof Chart
37652
37814
  * @param {Array|object} grids New x grid lines will be added. The format of this argument is the same as grid.x.lines and it's possible to give an Object if only one line will be added.
37653
- * @returns {object}
37815
+ * @returns {Array}
37654
37816
  * @example
37655
37817
  * // Add a new x grid line
37656
37818
  * chart.xgrids.add(
@@ -37664,7 +37826,7 @@ util_extend(xgrids, {
37664
37826
  * ]);
37665
37827
  */
37666
37828
  add: function add(grids) {
37667
- return this.xgrids(this.internal.config.grid_x_lines.concat(grids || []));
37829
+ return _add.bind(this)(grids, "x");
37668
37830
  },
37669
37831
  /**
37670
37832
  * Remove x grid lines.<br>
@@ -37672,7 +37834,10 @@ util_extend(xgrids, {
37672
37834
  * @function xgrids․remove
37673
37835
  * @instance
37674
37836
  * @memberof Chart
37675
- * @param {object} params This argument should include value or class. If value is given, the x grid lines that have specified x value will be removed. If class is given, the x grid lines that have specified class will be removed. If args is not given, all of x grid lines will be removed.
37837
+ * @param {object} grids This argument should include value or class. If value is given, the x grid lines that have specified x value will be removed. If class is given, the x grid lines that have specified class will be removed. If args is not given, all of x grid lines will be removed.
37838
+ * @param {number} [grids.value] target value
37839
+ * @param {string} [grids.class] target class
37840
+ * @returns {void}
37676
37841
  * @example
37677
37842
  * // x grid line on x = 2 will be removed
37678
37843
  * chart.xgrids.remove({value: 2});
@@ -37685,20 +37850,11 @@ util_extend(xgrids, {
37685
37850
  * // all of x grid lines will be removed
37686
37851
  * chart.xgrids.remove();
37687
37852
  */
37688
- remove: function remove(params) {
37853
+ remove: function remove(grids) {
37689
37854
  // TODO: multiple
37690
- this.internal.removeGridLines(params, !0);
37855
+ return _remove.bind(this)(grids, !0);
37691
37856
  }
37692
37857
  });
37693
- /* harmony default export */ var grid_x = ({
37694
- xgrids: xgrids
37695
- });
37696
- ;// CONCATENATED MODULE: ./src/Chart/api/grid.y.ts
37697
- /**
37698
- * Copyright (c) 2017 ~ present NAVER Corp.
37699
- * billboard.js project is licensed under the MIT license
37700
- */
37701
-
37702
37858
 
37703
37859
  /**
37704
37860
  * Update y grid lines.
@@ -37716,14 +37872,7 @@ util_extend(xgrids, {
37716
37872
  * // --> Returns: [{value: 100, text: "Label 1"}, {value: 400, text: "Label 4"}]
37717
37873
  */
37718
37874
  var ygrids = function (grids) {
37719
- var $$ = this.internal,
37720
- config = $$.config;
37721
- if (!grids) {
37722
- return config.grid_y_lines;
37723
- }
37724
- config.grid_y_lines = grids;
37725
- $$.redrawWithoutRescale();
37726
- return config.grid_y_lines;
37875
+ return grid.bind(this)(grids, "y");
37727
37876
  };
37728
37877
  util_extend(ygrids, {
37729
37878
  /**
@@ -37747,7 +37896,7 @@ util_extend(ygrids, {
37747
37896
  * ]);
37748
37897
  */
37749
37898
  add: function add(grids) {
37750
- return this.ygrids(this.internal.config.grid_y_lines.concat(grids || []));
37899
+ return _add.bind(this)(grids, "y");
37751
37900
  },
37752
37901
  /**
37753
37902
  * Remove y grid lines.<br>
@@ -37755,9 +37904,10 @@ util_extend(ygrids, {
37755
37904
  * @function ygrids․remove
37756
37905
  * @instance
37757
37906
  * @memberof Chart
37758
- * @param {object} params This argument should include value or class. If value is given, the y grid lines that have specified y value will be removed. If class is given, the y grid lines that have specified class will be removed. If args is not given, all of y grid lines will be removed.
37759
- * @param {number} [params.value] target value
37760
- * @param {string} [params.class] target class
37907
+ * @param {object} grids This argument should include value or class. If value is given, the y grid lines that have specified y value will be removed. If class is given, the y grid lines that have specified class will be removed. If args is not given, all of y grid lines will be removed.
37908
+ * @param {number} [grids.value] target value
37909
+ * @param {string} [grids.class] target class
37910
+ * @returns {void}
37761
37911
  * @example
37762
37912
  * // y grid line on y = 200 will be removed
37763
37913
  * chart.ygrids.remove({value: 200});
@@ -37770,12 +37920,13 @@ util_extend(ygrids, {
37770
37920
  * // all of y grid lines will be removed
37771
37921
  * chart.ygrids.remove();
37772
37922
  */
37773
- remove: function remove(params) {
37923
+ remove: function remove(grids) {
37774
37924
  // TODO: multiple
37775
- this.internal.removeGridLines(params, !1);
37925
+ return _remove.bind(this)(grids, !1);
37776
37926
  }
37777
37927
  });
37778
- /* harmony default export */ var grid_y = ({
37928
+ /* harmony default export */ var api_grid = ({
37929
+ xgrids: xgrids,
37779
37930
  ygrids: ygrids
37780
37931
  });
37781
37932
  ;// CONCATENATED MODULE: ./src/Chart/api/group.ts
@@ -37817,6 +37968,29 @@ util_extend(ygrids, {
37817
37968
  */
37818
37969
 
37819
37970
 
37971
+ /**
37972
+ * Region add/update function
37973
+ * @param {Array} regions Regions will be replaced with this argument. The format of this argument is the same as regions.
37974
+ * @param {boolean} isAdd If true, add new regions, otherwise update regions
37975
+ * @returns {Array} regions
37976
+ * @private
37977
+ */
37978
+ function regionsFn(regions, isAdd) {
37979
+ if (isAdd === void 0) {
37980
+ isAdd = !1;
37981
+ }
37982
+ var $$ = this.internal,
37983
+ config = $$.config,
37984
+ withTransition = config.transition_duration && isTabVisible();
37985
+ if (!regions) {
37986
+ return config.regions;
37987
+ }
37988
+ config.regions = isAdd ? config.regions.concat(regions) : regions;
37989
+ $$.updateRegion();
37990
+ $$.redrawRegion(withTransition);
37991
+ return isAdd ? config.regions : regions;
37992
+ }
37993
+
37820
37994
  /**
37821
37995
  * Update regions.
37822
37996
  * @function regions
@@ -37832,14 +38006,7 @@ util_extend(ygrids, {
37832
38006
  * ]);
37833
38007
  */
37834
38008
  var regions = function (_regions) {
37835
- var $$ = this.internal,
37836
- config = $$.config;
37837
- if (!_regions) {
37838
- return config.regions;
37839
- }
37840
- config.regions = _regions;
37841
- $$.redrawWithoutRescale();
37842
- return _regions;
38009
+ return regionsFn.bind(this)(_regions);
37843
38010
  };
37844
38011
  util_extend(regions, {
37845
38012
  /**
@@ -37863,14 +38030,7 @@ util_extend(regions, {
37863
38030
  *]);
37864
38031
  */
37865
38032
  add: function add(regions) {
37866
- var $$ = this.internal,
37867
- config = $$.config;
37868
- if (!regions) {
37869
- return config.regions;
37870
- }
37871
- config.regions = config.regions.concat(regions);
37872
- $$.redrawWithoutRescale();
37873
- return config.regions;
38033
+ return regionsFn.bind(this)(regions, !0);
37874
38034
  },
37875
38035
  /**
37876
38036
  * Remove regions.<br><br>
@@ -38379,7 +38539,7 @@ var AxisRendererHelper = /*#__PURE__*/function () {
38379
38539
  size = {
38380
38540
  w: 5.5,
38381
38541
  h: 11.5
38382
- };
38542
+ }; // default size for one character
38383
38543
  node.empty() || node.select("text").text("0").call(function (el) {
38384
38544
  _newArrowCheck(this, _this);
38385
38545
  try {
@@ -38574,6 +38734,11 @@ var AxisRenderer = /*#__PURE__*/function () {
38574
38734
  axisPx = tickTransform === helper.axisX ? "y" : "x",
38575
38735
  sign = /^(top|left)$/.test(orient) ? -1 : 1,
38576
38736
  rotate = params.tickTextRotate;
38737
+
38738
+ // line/text enter and path update
38739
+
38740
+ // tick text helpers
38741
+
38577
38742
  this.config.range = scale.rangeExtent ? scale.rangeExtent() : helper.scaleExtent((params.orgXScale || scale).range());
38578
38743
  var innerTickSize = config.innerTickSize,
38579
38744
  tickLength = config.tickLength,
@@ -38589,6 +38754,7 @@ var AxisRenderer = /*#__PURE__*/function () {
38589
38754
  tick: axisShow ? params.config[prefix + "_tick_show"] : !1,
38590
38755
  text: axisShow ? params.config[prefix + "_tick_text_show"] : !1
38591
38756
  }; // // get the axis' tick position configuration
38757
+ // tick visiblity
38592
38758
  var $g;
38593
38759
  g.each(function () {
38594
38760
  var _this = this,
@@ -38826,7 +38992,7 @@ var AxisRenderer = /*#__PURE__*/function () {
38826
38992
  }
38827
38993
  var tickWidth = params.tickWidth;
38828
38994
  if (!tickWidth || tickWidth <= 0) {
38829
- tickWidth = isLeftRight ? 95 : params.isCategory ? Math.ceil(scale(ticks[1]) - scale(ticks[0])) - 12 : 110;
38995
+ tickWidth = isLeftRight ? 95 : params.isCategory ? Math.ceil(params.isInverted ? scale(ticks[0]) - scale(ticks[1]) : scale(ticks[1]) - scale(ticks[0])) - 12 : 110;
38830
38996
  }
38831
38997
 
38832
38998
  // split given text by tick width size
@@ -39234,6 +39400,7 @@ var Axis_Axis = /*#__PURE__*/function () {
39234
39400
  owner: $$
39235
39401
  }, isX && {
39236
39402
  isCategory: isCategory,
39403
+ isInverted: config.axis_x_inverted,
39237
39404
  tickMultiline: config.axis_x_tick_multiline,
39238
39405
  tickWidth: config.axis_x_tick_width,
39239
39406
  tickTitle: isCategory && config.axis_x_tick_tooltip && $$.api.categories(),
@@ -39315,7 +39482,7 @@ var Axis_Axis = /*#__PURE__*/function () {
39315
39482
  tickFormat = forSubchart ? config.subchart_axis_x_tick_format || config.axis_x_tick_format : config.axis_x_tick_format,
39316
39483
  isTimeSeries = this.isTimeSeries(),
39317
39484
  isCategorized = this.isCategorized(),
39318
- currFormat;
39485
+ currFormat; // enable different tick format for x and subX - subX format defaults to x format if not defined
39319
39486
  if (tickFormat) {
39320
39487
  if (isFunction(tickFormat)) {
39321
39488
  currFormat = tickFormat.bind($$.api);
@@ -39858,7 +40025,8 @@ var Axis_Axis = /*#__PURE__*/function () {
39858
40025
  config = $$.config,
39859
40026
  state = $$.state,
39860
40027
  $el = $$.$el,
39861
- isMultipleX = $$.isMultipleX();
40028
+ isMultipleX = $$.isMultipleX(),
40029
+ isInverted = config.axis_x_inverted;
39862
40030
  if ($el.eventRect) {
39863
40031
  $$.updateEventRect($el.eventRect, !0);
39864
40032
  } else {
@@ -39879,10 +40047,10 @@ var Axis_Axis = /*#__PURE__*/function () {
39879
40047
  if (!isMultipleX) {
39880
40048
  // Set data and update eventReceiver.data
39881
40049
  var xAxisTickValues = $$.getMaxDataCountTarget();
39882
- if (!config.data_xSort) {
40050
+ if (!config.data_xSort || isInverted) {
39883
40051
  xAxisTickValues.sort(function (a, b) {
39884
40052
  _newArrowCheck(this, _this);
39885
- return a.x - b.x;
40053
+ return isInverted ? b.x - a.x : a.x - b.x;
39886
40054
  }.bind(this));
39887
40055
  }
39888
40056
 
@@ -39940,7 +40108,8 @@ var Axis_Axis = /*#__PURE__*/function () {
39940
40108
  event.preventDefault();
39941
40109
  }
39942
40110
  }
39943
- }.bind(this);
40111
+ }.bind(this); // call event.preventDefault()
40112
+ // according 'interaction.inputType.touch.preventDefault' option
39944
40113
  // bind touch events
39945
40114
  eventRect.on("touchstart", function (event) {
39946
40115
  _newArrowCheck(this, _this2);
@@ -40537,7 +40706,7 @@ var src_linear_linear = function (t) {
40537
40706
  flowEnd = $$.getValueOnIndex(dataValues, flowIndex + flowLength),
40538
40707
  translateX,
40539
40708
  orgDomain = x.domain(),
40540
- domain = $$.updateXDomain(targets, !0, !0);
40709
+ domain = $$.updateXDomain(targets, !0, !0); // update x domain to generate axis elements for flow
40541
40710
  // generate transform to flow
40542
40711
  if (!orgDataCount) {
40543
40712
  // if empty
@@ -40616,6 +40785,9 @@ var src_linear_linear = function (t) {
40616
40785
  y = -Math.max(15, margin.top),
40617
40786
  w = isRotated ? margin.left + 20 : width + 10 + left,
40618
40787
  h = (isRotated ? margin.top + height + 10 : margin.bottom) + 20;
40788
+
40789
+ // less than 20 is not enough to show the axis label 'outer' without legend
40790
+
40619
40791
  node.attr("x", x).attr("y", y).attr("width", w).attr("height", h);
40620
40792
  },
40621
40793
  /**
@@ -40624,7 +40796,8 @@ var src_linear_linear = function (t) {
40624
40796
  * @private
40625
40797
  */
40626
40798
  setYAxisClipPath: function setYAxisClipPath(node) {
40627
- var $$ = this,
40799
+ var _config$padding,
40800
+ $$ = this,
40628
40801
  config = $$.config,
40629
40802
  _$$$state3 = $$.state,
40630
40803
  margin = _$$$state3.margin,
@@ -40633,10 +40806,10 @@ var src_linear_linear = function (t) {
40633
40806
  isRotated = config.axis_rotated,
40634
40807
  left = Math.max(30, margin.left) - (isRotated ? 20 : 0),
40635
40808
  isInner = config.axis_y_inner,
40636
- x = isInner ? -1 : isRotated ? -(1 + left) : -(left - 1),
40809
+ x = isInner && !isRotated ? config.axis_y_label.text ? -20 : -1 : isRotated ? -(1 + left) : -(left - 1),
40637
40810
  y = -(isRotated ? 20 : margin.top),
40638
40811
  w = (isRotated ? width + 15 + left : margin.left + 20) + (isInner ? 20 : 0),
40639
- h = (isRotated ? margin.bottom : margin.top + height) + 10;
40812
+ h = (isRotated ? margin.bottom + (((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit" ? 10 : 0) : margin.top + height) + 10;
40640
40813
  node.attr("x", x).attr("y", y).attr("width", w).attr("height", h);
40641
40814
  },
40642
40815
  updateXAxisTickClip: function updateXAxisTickClip() {
@@ -40742,7 +40915,7 @@ function smoothLines(el, type) {
40742
40915
  });
40743
40916
  }
40744
40917
  }
40745
- /* harmony default export */ var grid = ({
40918
+ /* harmony default export */ var internals_grid = ({
40746
40919
  hasGrid: function hasGrid() {
40747
40920
  var _this4 = this,
40748
40921
  config = this.config;
@@ -41143,13 +41316,13 @@ function smoothLines(el, type) {
41143
41316
 
41144
41317
  // hide if arc type
41145
41318
  region.main.style("visibility", $$.hasArcType() ? "hidden" : null);
41146
- // select <g> element
41147
41319
 
41148
- var list = region.main.selectAll("." + $REGION.region).data(config.regions);
41149
- $T(list.exit()).style("opacity", "0").remove();
41150
- list = list.enter().append("g").merge(list).attr("class", $$.classRegion.bind($$));
41151
- list.append("rect").style("fill-opacity", "0");
41152
- region.list = list;
41320
+ // select <g> element
41321
+ var regions = region.main.selectAll("." + $REGION.region).data(config.regions);
41322
+ $T(regions.exit()).style("opacity", "0").remove();
41323
+ var regionsEnter = regions.enter().append("g");
41324
+ regionsEnter.append("rect").style("fill-opacity", "0");
41325
+ region.list = regionsEnter.merge(regions).attr("class", $$.classRegion.bind($$));
41153
41326
  },
41154
41327
  redrawRegion: function redrawRegion(withTransition) {
41155
41328
  var _this = this,
@@ -41254,14 +41427,16 @@ function smoothLines(el, type) {
41254
41427
  var _$$$axis,
41255
41428
  position = (_$$$axis = $$.axis) == null ? void 0 : _$$$axis.getLabelPositionById(id),
41256
41429
  width = $$.axis.getMaxTickWidth(id, withoutRecompute),
41257
- gap = width === 0 ? .5 : 0;
41258
- return width + (position.isInner ? 20 + gap : 40);
41430
+ gap = width === 0 ? .5 : 0,
41431
+ _$$$config$padding;
41432
+ return width + (((_$$$config$padding = $$.config.padding) == null ? void 0 : _$$$config$padding.mode) === "fit" ? position.isInner ? 10 + gap : 10 : position.isInner ? 20 + gap : 40);
41259
41433
  } else {
41260
41434
  return 40;
41261
41435
  }
41262
41436
  },
41263
41437
  getHorizontalAxisHeight: function getHorizontalAxisHeight(id) {
41264
- var $$ = this,
41438
+ var _config$padding,
41439
+ $$ = this,
41265
41440
  config = $$.config,
41266
41441
  state = $$.state,
41267
41442
  _state = state,
@@ -41269,8 +41444,12 @@ function smoothLines(el, type) {
41269
41444
  rotatedPadding = _state.rotatedPadding,
41270
41445
  isLegendRight = _state.isLegendRight,
41271
41446
  isLegendInset = _state.isLegendInset,
41272
- isRotated = config.axis_rotated;
41273
- var h = 30;
41447
+ isRotated = config.axis_rotated,
41448
+ isFitPadding = ((_config$padding = config.padding) == null ? void 0 : _config$padding.mode) === "fit",
41449
+ isInner = config["axis_" + id + "_inner"],
41450
+ hasLabelText = config["axis_" + id + "_label"].text,
41451
+ _config$padding2,
41452
+ h = ((_config$padding2 = config.padding) == null ? void 0 : _config$padding2.mode) === "fit" ? isInner && !hasLabelText ? id === "y" ? 1 : 0 : 20 : 30;
41274
41453
  if (id === "x" && !config.axis_x_show) {
41275
41454
  return 8;
41276
41455
  }
@@ -41281,7 +41460,7 @@ function smoothLines(el, type) {
41281
41460
  return config.legend_show && !isLegendRight && !isLegendInset ? 10 : 1;
41282
41461
  }
41283
41462
  if (id === "y2" && !config.axis_y2_show) {
41284
- return rotatedPadding.top;
41463
+ return isFitPadding ? 0 : rotatedPadding.top;
41285
41464
  }
41286
41465
  var rotate = $$.getAxisTickRotate(id);
41287
41466
 
@@ -41297,7 +41476,12 @@ function smoothLines(el, type) {
41297
41476
  return h + ($$.axis.getLabelPositionById(id).isInner ? 0 : 10) + (id === "y2" && !isRotated ? -10 : 0);
41298
41477
  },
41299
41478
  getEventRectWidth: function getEventRectWidth() {
41300
- return Math.max(0, this.axis.x.tickInterval());
41479
+ var $$ = this,
41480
+ config = $$.config,
41481
+ axis = $$.axis,
41482
+ isInverted = config.axis_x_inverted,
41483
+ tickInterval = axis.x.tickInterval();
41484
+ return Math.max(0, isInverted ? Math.abs(tickInterval) : tickInterval);
41301
41485
  },
41302
41486
  /**
41303
41487
  * Get axis tick test rotate value
@@ -41990,6 +42174,22 @@ function smoothLines(el, type) {
41990
42174
  * }
41991
42175
  */
41992
42176
  axis_x_min: undefined,
42177
+ /**
42178
+ * Change the direction of x axis.<br><br>
42179
+ * If true set, the direction will be `right -> left`.
42180
+ * @name axis․x․inverted
42181
+ * @memberof Options
42182
+ * @type {boolean}
42183
+ * @default false
42184
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.InvertedAxis)
42185
+ * @example
42186
+ * axis: {
42187
+ * x: {
42188
+ * inverted: true
42189
+ * }
42190
+ * }
42191
+ */
42192
+ axis_x_inverted: !1,
41993
42193
  /**
41994
42194
  * Set padding for x axis.<br><br>
41995
42195
  * If this option is set, the range of x axis will increase/decrease according to the values.
@@ -42252,11 +42452,12 @@ function smoothLines(el, type) {
42252
42452
  axis_y_min: undefined,
42253
42453
  /**
42254
42454
  * Change the direction of y axis.<br><br>
42255
- * If true set, the direction will be from the top to the bottom.
42455
+ * If true set, the direction will be `top -> bottom`.
42256
42456
  * @name axis․y․inverted
42257
42457
  * @memberof Options
42258
42458
  * @type {boolean}
42259
42459
  * @default false
42460
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.InvertedAxis)
42260
42461
  * @example
42261
42462
  * axis: {
42262
42463
  * y: {
@@ -42730,11 +42931,12 @@ function smoothLines(el, type) {
42730
42931
  axis_y2_min: undefined,
42731
42932
  /**
42732
42933
  * Change the direction of y2 axis.<br><br>
42733
- * If true set, the direction will be from the top to the bottom.
42934
+ * If true set, the direction will be `top -> bottom`.
42734
42935
  * @name axis․y2․inverted
42735
42936
  * @memberof Options
42736
42937
  * @type {boolean}
42737
42938
  * @default false
42939
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#Axis.InvertedAxis)
42738
42940
  * @example
42739
42941
  * axis: {
42740
42942
  * y2: {
@@ -43226,7 +43428,6 @@ function axis_objectSpread(target) { for (var i = 1, source; i < arguments.lengt
43226
43428
 
43227
43429
 
43228
43430
 
43229
-
43230
43431
  // ChartInternal
43231
43432
 
43232
43433
 
@@ -43240,8 +43441,8 @@ function axis_objectSpread(target) { for (var i = 1, source; i < arguments.lengt
43240
43441
 
43241
43442
 
43242
43443
 
43243
- var api = [api_axis, api_category, grid_x, grid_y, flow, group, api_regions, x];
43244
- var internal = [Axis, clip, eventrect, interactions_flow, grid, region, size_axis];
43444
+ var api = [api_axis, api_category, flow, api_grid, group, api_regions, x];
43445
+ var internal = [Axis, clip, eventrect, interactions_flow, internals_grid, region, size_axis];
43245
43446
  var options = [data_axis, Options_axis_axis, common_grid];
43246
43447
  ;// CONCATENATED MODULE: ./node_modules/d3-shape/src/array.js
43247
43448
  var slice = Array.prototype.slice;
@@ -44002,6 +44203,7 @@ function getAttrTweenFn(fn) {
44002
44203
  var min = config.gauge_min,
44003
44204
  max = config.gauge_max,
44004
44205
  totalSum = $$.getTotalDataSum(state.rendered); // to prevent excluding total data sum during the init(when data.hide option is used), use $$.rendered state value
44206
+ // https://github.com/naver/billboard.js/issues/2123
44005
44207
  pie = pie.startAngle(gStart).endAngle(radius * ((totalSum - min) / (max - min)) + gStart);
44006
44208
  }
44007
44209
  pie($$.filterTargetsToShow()).forEach(function (t, i) {
@@ -44850,7 +45052,7 @@ function point_y(p) {
44850
45052
  var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
44851
45053
  offset = areaOffset(d, i) || y0,
44852
45054
  posX = x(d),
44853
- value = d.value;
45055
+ value = d.value; // offset is for stacked area chart
44854
45056
  var posY = y(d);
44855
45057
 
44856
45058
  // fix posY not to overflow opposite quadrant
@@ -45014,6 +45216,8 @@ function point_y(p) {
45014
45216
  _newArrowCheck(this, _this4);
45015
45217
  return w * barRadiusRatio;
45016
45218
  }.bind(this) : null;
45219
+ // get the bar radius
45220
+
45017
45221
  return function (d, i) {
45018
45222
  _newArrowCheck(this, _this4);
45019
45223
  // 4 points that make a bar
@@ -45087,6 +45291,7 @@ function point_y(p) {
45087
45291
  _newArrowCheck(this, _this5);
45088
45292
  return v.id;
45089
45293
  }.bind(this)); // Get sorted list
45294
+ // Get sorted Ids. Filter positive or negative values Ids from given value
45090
45295
  // If the given id stays in the last position, then radius should be applied.
45091
45296
  return value !== 0 && sortedIds.indexOf(id) === sortedIds.length - 1;
45092
45297
  },
@@ -45117,6 +45322,9 @@ function point_y(p) {
45117
45322
  isInverted = config["axis_" + $$.axis.getId(id) + "_inverted"],
45118
45323
  value = d.value,
45119
45324
  posX = barX(d);
45325
+
45326
+ // offset is for stacked bar chart
45327
+
45120
45328
  var posY = barY(d);
45121
45329
 
45122
45330
  // fix posY not to overflow opposite quadrant
@@ -45224,7 +45432,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
45224
45432
  var points = getPoints(d, i),
45225
45433
  value = $$.getCandlestickData(d),
45226
45434
  isUp = (_value = value) == null ? void 0 : _value._isUp,
45227
- indexX = +isRotated;
45435
+ indexX = +isRotated; // switch points if axis is rotated, not applicable for sub chart
45228
45436
  if (g.classed) {
45229
45437
  g.classed($CANDLESTICK[isUp ? "valueUp" : "valueDown"], !0);
45230
45438
  }
@@ -45278,7 +45486,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
45278
45486
  var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
45279
45487
  offset = shapeOffset(d, i) || y0,
45280
45488
  width = isNumber(barW) ? barW : barW[d.id] || barW._$width,
45281
- value = $$.getCandlestickData(d);
45489
+ value = $$.getCandlestickData(d); // offset is for stacked bar chart
45282
45490
  var points;
45283
45491
  if (value) {
45284
45492
  var posX = {
@@ -45399,6 +45607,9 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
45399
45607
  state = $$.state,
45400
45608
  hasMultiGauge = $$.hasMultiArcGauge(),
45401
45609
  max = hasMultiGauge ? $$.getMinMaxData().max[0].value : $$.getTotalDataSum(state.rendered);
45610
+
45611
+ // to prevent excluding total data sum during the init(when data.hide option is used), use $$.rendered state value
45612
+
45402
45613
  // if gauge_max less than max, make max to max value
45403
45614
  if (max + config.gauge_min * (config.gauge_min > 0 ? -1 : 1) > config.gauge_max) {
45404
45615
  config.gauge_max = max - config.gauge_min;
@@ -45714,7 +45925,7 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
45714
45925
  xp,
45715
45926
  yp,
45716
45927
  diff,
45717
- diffx2;
45928
+ diffx2; // default value
45718
45929
  // Check start/end of regions
45719
45930
  if (isDefined(_regions)) {
45720
45931
  var getValue = function (v, def) {
@@ -45770,7 +45981,8 @@ function candlestick_objectSpread(target) { for (var i = 1, source; i < argument
45770
45981
  axisType = {
45771
45982
  x: $$.axis.getAxisType("x"),
45772
45983
  y: $$.axis.getAxisType("y")
45773
- };
45984
+ }; // Define svg generator function for region
45985
+ // Generate
45774
45986
  var path = "";
45775
45987
  for (var _i = 0, data; data = d[_i]; _i++) {
45776
45988
  var prevData = d[_i - 1],
@@ -45998,7 +46210,7 @@ var getTransitionName = function () {
45998
46210
  if (d) {
45999
46211
  circle = circle.filter(function (t) {
46000
46212
  var _this5 = this,
46001
- data = d.filter(function (v) {
46213
+ data = d.filter == null ? void 0 : d.filter(function (v) {
46002
46214
  _newArrowCheck(this, _this5);
46003
46215
  return v.id === t.id;
46004
46216
  }.bind(this));
@@ -46181,12 +46393,12 @@ var getTransitionName = function () {
46181
46393
  x = $$.getShapeX(0, lineIndices, isSub),
46182
46394
  y = $$.getShapeY(isSub),
46183
46395
  lineOffset = $$.getShapeOffset($$.isLineType, lineIndices, isSub),
46184
- yScale = $$.getYScaleById.bind($$);
46396
+ yScale = $$.getYScaleById.bind($$); // partial duplication of generateGetBarPoints
46185
46397
  return function (d, i) {
46186
46398
  _newArrowCheck(this, _this8);
46187
46399
  var y0 = yScale.call($$, d.id, isSub)($$.getShapeYMin(d.id)),
46188
46400
  offset = lineOffset(d, i) || y0,
46189
- posX = x(d);
46401
+ posX = x(d); // offset is for stacked area chart
46190
46402
  var posY = y(d);
46191
46403
 
46192
46404
  // fix posY not to overflow opposite quadrant
@@ -46610,6 +46822,8 @@ var cacheKey = KEY.radarPoints;
46610
46822
  return pos.join(" ");
46611
46823
  }.bind(this)),
46612
46824
  level = radarLevels.selectAll("." + $LEVEL.level).data(levelData);
46825
+ // Generate points
46826
+
46613
46827
  level.exit().remove();
46614
46828
  var levelEnter = level.enter().append("g").attr("class", function (d, i) {
46615
46829
  _newArrowCheck(this, _this6);
@@ -48959,7 +49173,10 @@ var _area = function area() {
48959
49173
  _newArrowCheck(this, _this19);
48960
49174
  return TYPE.TREEMAP;
48961
49175
  }.bind(this))();
48962
- }.bind(undefined);
49176
+ }.bind(undefined); // Line types
49177
+ // Arc types
49178
+ // Axis based types
49179
+ // Non Axis based types
48963
49180
  ;// CONCATENATED MODULE: ./src/Chart/api/selection.ts
48964
49181
 
48965
49182
  /**
@@ -49766,17 +49983,21 @@ function defaultConstrain(transform, extent, translateExtent) {
49766
49983
  * @param {Array} domain Target domain value
49767
49984
  * @param {Array} current Current zoom domain value
49768
49985
  * @param {Array} range Zoom range value
49986
+ * @param {boolean} isInverted Whether the axis is inverted or not
49769
49987
  * @returns {boolean}
49770
49988
  * @private
49771
49989
  */
49772
- function withinRange(domain, current, range) {
49773
- var _this = this,
49774
- min = range[0],
49990
+ function withinRange(domain, current, range, isInverted) {
49991
+ var _this = this;
49992
+ if (isInverted === void 0) {
49993
+ isInverted = !1;
49994
+ }
49995
+ var min = range[0],
49775
49996
  max = range[1];
49776
49997
  return domain.every(function (v, i) {
49777
49998
  var _this2 = this;
49778
49999
  _newArrowCheck(this, _this);
49779
- return (i === 0 ? v >= min : v <= max) && !domain.every(function (v, i) {
50000
+ return (i === 0 ? isInverted ? +v <= min : +v >= min : isInverted ? +v >= max : +v <= max) && !domain.every(function (v, i) {
49780
50001
  _newArrowCheck(this, _this2);
49781
50002
  return v === current[i];
49782
50003
  }.bind(this));
@@ -49812,6 +50033,7 @@ var zoom = function (domainValue) {
49812
50033
  org = $$.org,
49813
50034
  scale = $$.scale,
49814
50035
  isRotated = config.axis_rotated,
50036
+ isInverted = config.axis_x_inverted,
49815
50037
  isCategorized = axis.isCategorized(),
49816
50038
  domain = domainValue;
49817
50039
  if (config.zoom_enabled && domain) {
@@ -49821,7 +50043,8 @@ var zoom = function (domainValue) {
49821
50043
  return parseDate.bind($$)(x);
49822
50044
  }.bind(this));
49823
50045
  }
49824
- if (withinRange(domain, $$.getZoomDomain(!0), $$.getZoomDomain())) {
50046
+ var isWithinRange = withinRange(domain, $$.getZoomDomain(!0), $$.getZoomDomain(), isInverted);
50047
+ if (isWithinRange) {
49825
50048
  if (isCategorized) {
49826
50049
  domain = domain.map(function (v, i) {
49827
50050
  _newArrowCheck(this, _this3);
@@ -49839,7 +50062,10 @@ var zoom = function (domainValue) {
49839
50062
  var _d3ZoomIdentity$scale,
49840
50063
  _x = isCategorized ? scale.x.orgScale() : org.xScale || scale.x,
49841
50064
  translate = [-_x(domain[0]), 0],
49842
- transform = (_d3ZoomIdentity$scale = transform_identity.scale(_x.range()[1] / (_x(domain[1]) - _x(domain[0])))).translate.apply(_d3ZoomIdentity$scale, isRotated ? translate.reverse() : translate);
50065
+ transform = (_d3ZoomIdentity$scale = transform_identity.scale(_x.range()[1] / (_x(domain[1]) - _x(domain[0])))).translate.apply(_d3ZoomIdentity$scale, isRotated ? translate.reverse() : translate); // in case of 'config.zoom_rescale=true', use org.xScale
50066
+ // Get transform from given domain value
50067
+ // https://github.com/d3/d3-zoom/issues/57#issuecomment-246434951
50068
+
49843
50069
  $el.eventRect.call($$.zoom.transform, transform);
49844
50070
  }
49845
50071
  $$.setZoomResetButton();
@@ -50453,6 +50679,8 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments.
50453
50679
  isRotated = config.axis_rotated,
50454
50680
  initRange = config.subchart_init_range,
50455
50681
  path = isRotated ? ["M 5.2491724,29.749209 a 6,6 0 0 0 -5.50000003,-6.5 H -5.7508276 a 6,6 0 0 0 -6.0000004,6.5 z m -5.00000003,-2 H -6.7508276 m 6.99999997,-2 H -6.7508276Z", "M 5.2491724,23.249172 a 6,-6 0 0 1 -5.50000003,6.5 H -5.7508276 a 6,-6 0 0 1 -6.0000004,-6.5 z m -5.00000003,2 H -6.7508276 m 6.99999997,2 H -6.7508276Z"] : ["M 0 18 A 6 6 0 0 0 -6.5 23.5 V 29 A 6 6 0 0 0 0 35 Z M -2 23 V 30 M -4 23 V 30Z", "M 0 18 A 6 6 0 0 1 6.5 23.5 V 29 A 6 6 0 0 1 0 35 Z M 2 23 V 30 M 4 23 V 30Z"];
50682
+ // brush handle shape's path
50683
+
50456
50684
  $$.brush.handle = brush.selectAll(".handle--custom").data(isRotated ? [{
50457
50685
  type: "n"
50458
50686
  }, {
@@ -50712,7 +50940,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments.
50712
50940
  if (!$$.state.xTickOffset) {
50713
50941
  $$.state.xTickOffset = $$.axis.x.tickOffset();
50714
50942
  }
50715
- scale.zoom = $$.getCustomizedScale(newScale);
50943
+ scale.zoom = $$.getCustomizedXScale(newScale);
50716
50944
  $$.axis.x.scale(scale.zoom);
50717
50945
  if (rescale) {
50718
50946
  // copy current initial x scale in case of rescale option is used
@@ -50844,7 +51072,7 @@ function selection_objectSpread(target) { for (var i = 1, source; i < arguments.
50844
51072
  var zoomDomain = zoom.domain(),
50845
51073
  xDomain = subX.domain(),
50846
51074
  delta = .015,
50847
- isfullyShown = (zoomDomain[0] <= xDomain[0] || zoomDomain[0] - delta <= xDomain[0]) && (xDomain[1] <= zoomDomain[1] || xDomain[1] <= zoomDomain[1] - delta);
51075
+ isfullyShown = $$.config.axis_x_inverted ? (zoomDomain[0] >= xDomain[0] || zoomDomain[0] + delta >= xDomain[0]) && (xDomain[1] >= zoomDomain[1] || xDomain[1] >= zoomDomain[1] + delta) : (zoomDomain[0] <= xDomain[0] || zoomDomain[0] - delta <= xDomain[0]) && (xDomain[1] <= zoomDomain[1] || xDomain[1] <= zoomDomain[1] - delta); // arbitrary value
50848
51076
  // check if the zoomed chart is fully shown, then reset scale when zoom is out as initial
50849
51077
  if (force || isfullyShown) {
50850
51078
  $$.axis.x.scale(subX);
@@ -51321,7 +51549,7 @@ var _defaults = {};
51321
51549
 
51322
51550
  /**
51323
51551
  * @namespace bb
51324
- * @version 3.7.5
51552
+ * @version 3.8.0-next.2
51325
51553
  */
51326
51554
  var bb = {
51327
51555
  /**
@@ -51331,7 +51559,7 @@ var bb = {
51331
51559
  * bb.version; // "1.0.0"
51332
51560
  * @memberof bb
51333
51561
  */
51334
- version: "3.7.5",
51562
+ version: "3.8.0-next.2",
51335
51563
  /**
51336
51564
  * Generate chart
51337
51565
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
@@ -51483,12 +51711,12 @@ Object.keys(resolver_interaction_namespaceObject).forEach(function (v) {
51483
51711
 
51484
51712
 
51485
51713
  /***/ }),
51486
- /* 521 */
51714
+ /* 522 */
51487
51715
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
51488
51716
 
51489
51717
  // TODO(Babel 8): Remove this file.
51490
51718
 
51491
- var runtime = __webpack_require__(522)();
51719
+ var runtime = __webpack_require__(523)();
51492
51720
  module.exports = runtime;
51493
51721
 
51494
51722
  // Copied from https://github.com/facebook/regenerator/blob/main/packages/runtime/runtime.js#L736=
@@ -51504,10 +51732,10 @@ try {
51504
51732
 
51505
51733
 
51506
51734
  /***/ }),
51507
- /* 522 */
51735
+ /* 523 */
51508
51736
  /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
51509
51737
 
51510
- var _typeof = (__webpack_require__(523)["default"]);
51738
+ var _typeof = (__webpack_require__(524)["default"]);
51511
51739
  function _regeneratorRuntime() {
51512
51740
  "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
51513
51741
  module.exports = _regeneratorRuntime = function _regeneratorRuntime() {
@@ -51813,7 +52041,7 @@ function _regeneratorRuntime() {
51813
52041
  module.exports = _regeneratorRuntime, module.exports.__esModule = true, module.exports["default"] = module.exports;
51814
52042
 
51815
52043
  /***/ }),
51816
- /* 523 */
52044
+ /* 524 */
51817
52045
  /***/ (function(module) {
51818
52046
 
51819
52047
  function _typeof(obj) {
@@ -51889,7 +52117,7 @@ module.exports = _typeof, module.exports.__esModule = true, module.exports["defa
51889
52117
  /******/ // Load entry module and return exports
51890
52118
  /******/ // This entry module used 'module' so it can't be inlined
51891
52119
  /******/ __webpack_require__(0);
51892
- /******/ var __webpack_exports__ = __webpack_require__(520);
52120
+ /******/ var __webpack_exports__ = __webpack_require__(521);
51893
52121
  /******/
51894
52122
  /******/ return __webpack_exports__;
51895
52123
  /******/ })()