billboard.js 3.2.0 → 3.3.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 (79) hide show
  1. package/dist/billboard.css +2 -3
  2. package/dist/billboard.js +422 -147
  3. package/dist/billboard.min.css +2 -2
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +5645 -3320
  6. package/dist/billboard.pkgd.min.js +3 -3
  7. package/dist/plugin/billboardjs-plugin-bubblecompare.d.ts +7 -0
  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.d.ts +7 -0
  11. package/dist/plugin/billboardjs-plugin-sparkline.js +19 -14
  12. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-stanford.d.ts +7 -0
  14. package/dist/plugin/billboardjs-plugin-stanford.js +17 -12
  15. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  16. package/dist/plugin/billboardjs-plugin-tableview.d.ts +7 -0
  17. package/dist/plugin/billboardjs-plugin-tableview.js +19 -14
  18. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  19. package/dist/plugin/billboardjs-plugin-textoverlap.d.ts +7 -0
  20. package/dist/plugin/billboardjs-plugin-textoverlap.js +17 -12
  21. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  22. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +5061 -3202
  23. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +5087 -3223
  24. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +5086 -3222
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +5080 -3216
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +5079 -3215
  27. package/dist/theme/datalab.css +2 -2
  28. package/dist/theme/datalab.min.css +2 -2
  29. package/dist/theme/graph.css +2 -2
  30. package/dist/theme/graph.min.css +2 -2
  31. package/dist/theme/insight.css +2 -2
  32. package/dist/theme/insight.min.css +2 -2
  33. package/dist-esm/billboard.js +723 -484
  34. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.d.ts +7 -0
  35. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  36. package/dist-esm/plugin/billboardjs-plugin-sparkline.d.ts +7 -0
  37. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +8 -8
  38. package/dist-esm/plugin/billboardjs-plugin-stanford.d.ts +7 -0
  39. package/dist-esm/plugin/billboardjs-plugin-stanford.js +15 -15
  40. package/dist-esm/plugin/billboardjs-plugin-tableview.d.ts +7 -0
  41. package/dist-esm/plugin/billboardjs-plugin-tableview.js +6 -6
  42. package/dist-esm/plugin/billboardjs-plugin-textoverlap.d.ts +7 -0
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +4 -4
  44. package/package.json +60 -60
  45. package/src/Chart/api/data.ts +3 -4
  46. package/src/ChartInternal/Axis/Axis.ts +15 -9
  47. package/src/ChartInternal/ChartInternal.ts +11 -2
  48. package/src/ChartInternal/data/IData.ts +9 -0
  49. package/src/ChartInternal/data/convert.ts +1 -1
  50. package/src/ChartInternal/data/data.ts +29 -12
  51. package/src/ChartInternal/internals/domain.ts +31 -31
  52. package/src/ChartInternal/internals/legend.ts +2 -1
  53. package/src/ChartInternal/internals/redraw.ts +2 -2
  54. package/src/ChartInternal/internals/scale.ts +3 -2
  55. package/src/ChartInternal/internals/size.ts +32 -1
  56. package/src/ChartInternal/internals/text.ts +4 -4
  57. package/src/ChartInternal/internals/tooltip.ts +4 -0
  58. package/src/ChartInternal/shape/arc.ts +3 -5
  59. package/src/ChartInternal/shape/bar.ts +89 -34
  60. package/src/ChartInternal/shape/radar.ts +2 -0
  61. package/src/ChartInternal/shape/shape.ts +72 -11
  62. package/src/Plugin/sparkline/index.ts +2 -2
  63. package/src/Plugin/tableview/index.ts +1 -1
  64. package/src/config/Options/axis/x.ts +27 -7
  65. package/src/config/Options/axis/y.ts +24 -3
  66. package/src/config/Options/axis/y2.ts +24 -3
  67. package/src/config/Options/common/main.ts +11 -1
  68. package/src/config/Options/data/data.ts +25 -3
  69. package/src/config/Options/shape/bar.ts +9 -2
  70. package/src/module/util.ts +19 -20
  71. package/src/scss/billboard.scss +1 -13
  72. package/src/scss/theme/datalab.scss +1 -7
  73. package/src/scss/theme/graph.scss +1 -2
  74. package/src/scss/theme/insight.scss +1 -2
  75. package/types/axis.d.ts +18 -4
  76. package/types/options.d.ts +43 -36
  77. package/types/plugin/tableview/index.d.ts +3 -3
  78. package/types/plugin/tableview/options.d.ts +1 -1
  79. package/types/types.d.ts +9 -6
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.2.0
8
+ * @version 3.3.0-next.2
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -432,9 +432,9 @@ var external_commonjs_d3_brush_commonjs2_d3_brush_amd_d3_brush_root_d3_ = __webp
432
432
  ;// CONCATENATED MODULE: ./src/module/util.ts
433
433
 
434
434
 
435
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
435
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
436
436
 
437
- function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
437
+ function _objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
438
438
 
439
439
  /**
440
440
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -524,18 +524,19 @@ function hasValue(dict, value) {
524
524
  /**
525
525
  * Call function with arguments
526
526
  * @param {Function} fn Function to be called
527
- * @param {*} args Arguments
527
+ * @param {*} thisArg "this" value for fn
528
+ * @param {*} args Arguments for fn
528
529
  * @returns {boolean} true: fn is function, false: fn is not function
529
530
  * @private
530
531
  */
531
532
 
532
533
 
533
- function callFn(fn) {
534
- for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
535
- args[_key - 1] = arguments[_key];
534
+ function callFn(fn, thisArg) {
535
+ for (var isFn = isFunction(fn), _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
536
+ args[_key - 2] = arguments[_key];
536
537
  }
537
538
 
538
- isFn && fn.call.apply(fn, args);
539
+ isFn && fn.call.apply(fn, [thisArg].concat(args));
539
540
  return isFn;
540
541
  }
541
542
  /**
@@ -691,9 +692,13 @@ function getPathBox(path) {
691
692
 
692
693
 
693
694
  function getPointer(event, element) {
694
- var touches = event && (event.touches || event.sourceEvent && event.sourceEvent.touches),
695
- pointer = event ? (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches ? touches[0] : event, element) : [0, 0];
696
- return pointer;
695
+ var _ref,
696
+ touches = event && ((_ref = event.touches || event.sourceEvent && event.sourceEvent.touches) == null ? void 0 : _ref[0]),
697
+ pointer = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.pointer)(touches || event, element);
698
+
699
+ return pointer.map(function (v) {
700
+ return isNaN(v) ? 0 : v;
701
+ });
697
702
  }
698
703
  /**
699
704
  * Return brush selection array
@@ -1681,12 +1686,21 @@ var Store = /*#__PURE__*/function () {
1681
1686
  * @name padding
1682
1687
  * @memberof Options
1683
1688
  * @type {object}
1684
- * @property {object} [padding] padding object
1689
+ * @property {object|boolean} [padding=true] Set padding of chart, and accepts object or boolean type.
1690
+ * - `Object`: Specify each side's padding.
1691
+ * - `false`: Remove padding completely and make shape to fully occupy the container element.
1692
+ * - In this case, axes and subchart will be hidden.
1693
+ * - To adjust some padding from this state, use `axis.[x|y].padding` option.
1685
1694
  * @property {number} [padding.top] padding on the top of chart
1686
1695
  * @property {number} [padding.right] padding on the right of chart
1687
1696
  * @property {number} [padding.bottom] padding on the bottom of chart
1688
1697
  * @property {number} [padding.left] padding on the left of chart
1698
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.Padding)
1689
1699
  * @example
1700
+ * // remove padding completely.
1701
+ * padding: false,
1702
+ *
1703
+ * // or specify padding value for each side
1690
1704
  * padding: {
1691
1705
  * top: 20,
1692
1706
  * right: 20,
@@ -1694,6 +1708,7 @@ var Store = /*#__PURE__*/function () {
1694
1708
  * left: 20
1695
1709
  * }
1696
1710
  */
1711
+ padding: !0,
1697
1712
  padding_left: undefined,
1698
1713
  padding_right: undefined,
1699
1714
  padding_top: undefined,
@@ -2224,8 +2239,8 @@ var Store = /*#__PURE__*/function () {
2224
2239
  * The arguments are:<br>
2225
2240
  * - `v` is the value of the data point where the label is shown.
2226
2241
  * - `id` is the id of the data where the label is shown.
2227
- * - `i` is the index of the data point where the label is shown.
2228
- * - `j` is the sub index of the data point where the label is shown.<br><br>
2242
+ * - `i` is the index of the data series point where the label is shown.
2243
+ * - `texts` is the array of whole corresponding data series' text labels.<br><br>
2229
2244
  * Formatter function can be defined for each data by specifying as an object and D3 formatter function can be set (ex. d3.format('$'))
2230
2245
  * @property {string|object} [data.labels.backgroundColors] Set label text background colors.
2231
2246
  * @property {string|object|Function} [data.labels.colors] Set label text colors.
@@ -2255,7 +2270,7 @@ var Store = /*#__PURE__*/function () {
2255
2270
  *
2256
2271
  * // it's possible to set for each data
2257
2272
  * format: {
2258
- * data1: function(v, id, i, j) { ... },
2273
+ * data1: function(v, id, i, texts) { ... },
2259
2274
  * ...
2260
2275
  * },
2261
2276
  *
@@ -2552,6 +2567,18 @@ var Store = /*#__PURE__*/function () {
2552
2567
  * ]
2553
2568
  * }
2554
2569
  *
2570
+ * // for 'bar' type, data can contain:
2571
+ * // - an array of [start, end] data following the order
2572
+ * data: {
2573
+ * rows: [
2574
+ * ["data1", "data2"],
2575
+ * [[100, 150], 120],
2576
+ * [[200, 300], 55],
2577
+ * [[-400, 500], 60]
2578
+ * ],
2579
+ * type: "bar"
2580
+ * }
2581
+ *
2555
2582
  * // for 'range' types('area-line-range' or 'area-spline-range'), data should contain:
2556
2583
  * // - an array of [high, mid, low] data following the order
2557
2584
  * // - or an object with 'high', 'mid' and 'low' key value
@@ -2628,6 +2655,16 @@ var Store = /*#__PURE__*/function () {
2628
2655
  * ]
2629
2656
  * }
2630
2657
  *
2658
+ * // for 'bar' type, data can contain:
2659
+ * // - an array of [start, end] data following the order
2660
+ * data: {
2661
+ * columns: [
2662
+ * ["data1", -100, 50, [100, 200], [200, 300]],
2663
+ * ["data2", -200, 300, [-100, 100], [-50, -30]],
2664
+ * ],
2665
+ * type: "bar"
2666
+ * }
2667
+ *
2631
2668
  * // for 'range' types('area-line-range' or 'area-spline-range'), data should contain:
2632
2669
  * // - an array of [high, mid, low] data following the order
2633
2670
  * // - or an object with 'high', 'mid' and 'low' key value
@@ -3244,9 +3281,9 @@ var Store = /*#__PURE__*/function () {
3244
3281
  ;// CONCATENATED MODULE: ./src/config/Options/Options.ts
3245
3282
 
3246
3283
 
3247
- function Options_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
3284
+ function Options_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3248
3285
 
3249
- function Options_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { Options_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { Options_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
3286
+ function Options_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? Options_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : Options_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
3250
3287
 
3251
3288
  /**
3252
3289
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -3987,7 +4024,7 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
3987
4024
 
3988
4025
  if (filterNull) {
3989
4026
  value = value.filter(function (v) {
3990
- return isValue(v.value);
4027
+ return v && "value" in v && isValue(v.value);
3991
4028
  });
3992
4029
  }
3993
4030
 
@@ -4421,6 +4458,7 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4421
4458
 
4422
4459
  /**
4423
4460
  * Sort targets data
4461
+ * Note: For stacked bar, will sort from the total sum of data series, not for each stacked bar
4424
4462
  * @param {Array} targetsValue Target value
4425
4463
  * @returns {Array}
4426
4464
  * @private
@@ -4457,8 +4495,8 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4457
4495
  };
4458
4496
 
4459
4497
  fn = function (t1, t2) {
4460
- var t1Sum = t1.values.reduce(reducer, 0),
4461
- t2Sum = t2.values.reduce(reducer, 0);
4498
+ var t1Sum = "values" in t1 ? t1.values.reduce(reducer, 0) : t1.value,
4499
+ t2Sum = "values" in t2 ? t2.values.reduce(reducer, 0) : t2.value;
4462
4500
  return isArc ? orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum : orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;
4463
4501
  };
4464
4502
  } else if (isFunction(order)) {
@@ -4572,19 +4610,20 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4572
4610
  }),
4573
4611
  minDist = config.point_sensitivity,
4574
4612
  closest;
4575
- // find mouseovering bar
4613
+ // find mouseovering bar/candlestick
4614
+ // https://github.com/naver/billboard.js/issues/2434
4576
4615
  data.filter(function (v) {
4577
- return $$.isBarType(v.id);
4616
+ return $$.isBarType(v.id) || $$.isCandlestickType(v.id);
4578
4617
  }).forEach(function (v) {
4579
- var shape = main.select("." + config_classes.bars + $$.getTargetSelectorSuffix(v.id) + " ." + config_classes.bar + "-" + v.index).node();
4618
+ var selector = $$.isBarType(v.id) ? "." + config_classes.chartBar + "." + config_classes.target + $$.getTargetSelectorSuffix(v.id) + " ." + config_classes.bar + "-" + v.index : "." + config_classes.chartCandlestick + "." + config_classes.target + $$.getTargetSelectorSuffix(v.id) + " ." + config_classes.candlestick + "-" + v.index + " path";
4580
4619
 
4581
- if (!closest && $$.isWithinBar(shape)) {
4620
+ if (!closest && $$.isWithinBar(main.select(selector).node())) {
4582
4621
  closest = v;
4583
4622
  }
4584
- }); // find closest point from non-bar
4623
+ }); // find closest point from non-bar/candlestick
4585
4624
 
4586
4625
  data.filter(function (v) {
4587
- return !$$.isBarType(v.id);
4626
+ return !$$.isBarType(v.id) && !$$.isCandlestickType(v.id);
4588
4627
  }).forEach(function (v) {
4589
4628
  var d = $$.dist(v, pos);
4590
4629
 
@@ -4817,6 +4856,20 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4817
4856
  return $$.isBubbleType(d) && (isObject(d.value) && ("z" in d.value || "y" in d.value) || isArray(d.value) && d.value.length === 2);
4818
4857
  },
4819
4858
 
4859
+ /**
4860
+ * Determine if bar has ranged data
4861
+ * @param {Array} d data value
4862
+ * @returns {boolean}
4863
+ * @private
4864
+ */
4865
+ isBarRangeType: function isBarRangeType(d) {
4866
+ var $$ = this,
4867
+ value = d.value;
4868
+ return $$.isBarType(d) && isArray(value) && value.length === 2 && value.every(function (v) {
4869
+ return isNumber(v);
4870
+ });
4871
+ },
4872
+
4820
4873
  /**
4821
4874
  * Get data object by id
4822
4875
  * @param {string} id data id
@@ -5542,48 +5595,41 @@ var colorizePattern = function (pattern, color, id) {
5542
5595
  ys = $$.getValuesAsIdKeyed(targets);
5543
5596
 
5544
5597
  if (dataGroups.length > 0) {
5545
- (function () {
5546
- var hasValue = $$["has" + (isMin ? "Negative" : "Positive") + "ValueInTargets"](targets);
5547
-
5548
- for (var _loop = function (j, _idsInGroup) {
5549
- // Determine baseId
5550
- _idsInGroup = _idsInGroup.filter(v => ids.indexOf(v) >= 0);
5551
-
5552
- if (_idsInGroup.length === 0) {
5553
- idsInGroup = _idsInGroup;
5554
- return "continue";
5555
- }
5598
+ var hasValue = $$["has" + (isMin ? "Negative" : "Positive") + "ValueInTargets"](targets);
5599
+ dataGroups.forEach(function (groupIds) {
5600
+ // Determine baseId
5601
+ var idsInGroup = groupIds.filter(function (v) {
5602
+ return ids.indexOf(v) >= 0;
5603
+ });
5556
5604
 
5557
- var baseId = _idsInGroup[0];
5558
- var baseAxisId = axis.getId(baseId); // Initialize base value. Set to 0 if not match with the condition
5605
+ if (idsInGroup.length) {
5606
+ var baseId = idsInGroup[0],
5607
+ baseAxisId = axis.getId(baseId);
5559
5608
 
5609
+ // Initialize base value. Set to 0 if not match with the condition
5560
5610
  if (hasValue && ys[baseId]) {
5561
- ys[baseId] = ys[baseId].map(v => (isMin ? v < 0 : v > 0) ? v : 0);
5562
- }
5563
-
5564
- for (let k = 1, id; id = _idsInGroup[k]; k++) {
5565
- if (!ys[id]) {
5566
- continue;
5567
- }
5568
-
5569
- const axisId = axis.getId(id);
5570
- ys[id].forEach((v, i) => {
5571
- const val = +v;
5572
- const meetCondition = isMin ? val > 0 : val < 0;
5573
-
5574
- if (axisId === baseAxisId && !(hasValue && meetCondition)) {
5575
- ys[baseId][i] += val;
5576
- }
5611
+ ys[baseId] = ys[baseId].map(function (v) {
5612
+ return (isMin ? v < 0 : v > 0) ? v : 0;
5577
5613
  });
5578
5614
  }
5579
5615
 
5580
- idsInGroup = _idsInGroup;
5581
- }, j = 0, idsInGroup; idsInGroup = dataGroups[j]; j++) {
5582
- var _ret = _loop(j, idsInGroup);
5583
-
5584
- if (_ret === "continue") continue;
5616
+ idsInGroup.filter(function (v, i) {
5617
+ return i > 0;
5618
+ }).forEach(function (id) {
5619
+ if (ys[id]) {
5620
+ var axisId = axis.getId(id);
5621
+ ys[id].forEach(function (v, i) {
5622
+ var val = +v,
5623
+ meetCondition = isMin ? val > 0 : val < 0;
5624
+
5625
+ if (axisId === baseAxisId && !(hasValue && meetCondition)) {
5626
+ ys[baseId][i] += val;
5627
+ }
5628
+ });
5629
+ }
5630
+ });
5585
5631
  }
5586
- })();
5632
+ });
5587
5633
  }
5588
5634
 
5589
5635
  return getMinMax(type, Object.keys(ys).map(function (key) {
@@ -5702,9 +5748,10 @@ var colorizePattern = function (pattern, color, id) {
5702
5748
  ["bottom", "top"].forEach(function (v, i) {
5703
5749
  padding[v] += $$.convertPixelToScale("y", lengths[i], domainLength);
5704
5750
  });
5705
- } // if padding is set, the domain will be updated relative the current domain value
5706
- // ex) $$.height=300, padding.top=150, domainLength=4 --> domain=6
5751
+ }
5707
5752
 
5753
+ padding = $$.getResettedPadding(padding); // if padding is set, the domain will be updated relative the current domain value
5754
+ // ex) $$.height=300, padding.top=150, domainLength=4 --> domain=6
5708
5755
 
5709
5756
  var p = config[pfx + "_padding"];
5710
5757
 
@@ -5768,7 +5815,7 @@ var colorizePattern = function (pattern, color, id) {
5768
5815
  var maxDataCount = $$.getMaxDataCount();
5769
5816
  defaultValue = maxDataCount > 1 ? diff / (maxDataCount - 1) / 2 : .5;
5770
5817
  } else {
5771
- defaultValue = diff * .01;
5818
+ defaultValue = $$.getResettedPadding(diff * .01);
5772
5819
  }
5773
5820
 
5774
5821
  var _ref = isNumber(padding) ? {
@@ -6596,8 +6643,9 @@ function getFormat($$, typeValue, v) {
6596
6643
  return browser_doc.createElementNS(external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.namespaces.svg, "hasValidPointType" in $$ && $$.hasValidPointType(point) ? point : "use");
6597
6644
  }).attr("class", config_classes.legendItemPoint).style("fill", getColor).style("pointer-events", "none").attr("href", function (data, idx, selection) {
6598
6645
  var node = selection[idx],
6599
- nodeName = node.nodeName.toLowerCase();
6600
- return nodeName === "use" ? "#" + state.datetimeId + "-point-" + data : undefined;
6646
+ nodeName = node.nodeName.toLowerCase(),
6647
+ id = $$.getTargetSelectorSuffix(data);
6648
+ return nodeName === "use" ? "#" + state.datetimeId + "-point" + id : undefined;
6601
6649
  });
6602
6650
  } else {
6603
6651
  l.append("line").attr("class", config_classes.legendItemTile).style("stroke", getColor).style("pointer-events", "none").attr("x1", isLegendRightOrInset ? x1ForLegendTile : pos).attr("y1", isLegendRightOrInset ? pos : yForLegendTile).attr("x2", isLegendRightOrInset ? x2ForLegendTile : pos).attr("y2", isLegendRightOrInset ? pos : yForLegendTile).attr("stroke-width", config.legend_item_tile_height);
@@ -6700,8 +6748,9 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
6700
6748
  main = $el.main;
6701
6749
  state.redrawing = !0;
6702
6750
  var targetsToShow = $$.filterTargetsToShow($$.data.targets),
6703
- initializing = options.initializing,
6704
- flow = options.flow,
6751
+ _options = options,
6752
+ flow = _options.flow,
6753
+ initializing = _options.initializing,
6705
6754
  wth = $$.getWithOption(options),
6706
6755
  duration = wth.Transition ? config.transition_duration : 0,
6707
6756
  durationForExit = wth.TransitionForExit ? duration : 0,
@@ -6907,6 +6956,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
6907
6956
  redrawWithoutRescale: function redrawWithoutRescale() {
6908
6957
  this.redraw({
6909
6958
  withY: !1,
6959
+ withLegend: !0,
6910
6960
  withSubchart: !1,
6911
6961
  withEventRect: !1,
6912
6962
  withTransitionForAxis: !1
@@ -7077,15 +7127,16 @@ function getScale(type, min, max) {
7077
7127
  if (hasAxis) {
7078
7128
  var _scale$x,
7079
7129
  isRotated = config.axis_rotated,
7130
+ resettedPadding = $$.getResettedPadding(1),
7080
7131
  min = {
7081
- x: isRotated ? 1 : 0,
7132
+ x: isRotated ? resettedPadding : 0,
7082
7133
  y: isRotated ? 0 : height,
7083
7134
  subX: isRotated ? 1 : 0,
7084
7135
  subY: isRotated ? 0 : height2
7085
7136
  },
7086
7137
  max = {
7087
7138
  x: isRotated ? height : width,
7088
- y: isRotated ? width : 1,
7139
+ y: isRotated ? width : resettedPadding,
7089
7140
  subX: isRotated ? height : width,
7090
7141
  subY: isRotated ? width2 : 1
7091
7142
  },
@@ -7218,6 +7269,20 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7218
7269
 
7219
7270
  return shape;
7220
7271
  },
7272
+
7273
+ /**
7274
+ * Get shape's indices according it's position
7275
+ *
7276
+ * From the below example, indices will be:
7277
+ * ==> {data1: 0, data2: 0, data3: 1, data4: 1, __max__: 1}
7278
+ *
7279
+ * data1 data3 data1 data3
7280
+ * data2 data4 data2 data4
7281
+ * -------------------------
7282
+ * 0 1
7283
+ * @param {Function} typeFilter Chart type filter function
7284
+ * @returns {object} Indices object with its position
7285
+ */
7221
7286
  getShapeIndices: function getShapeIndices(typeFilter) {
7222
7287
  var $$ = this,
7223
7288
  config = $$.config,
@@ -7263,12 +7328,30 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7263
7328
  /**
7264
7329
  * Get indices value based on data ID value
7265
7330
  * @param {object} indices Indices object
7266
- * @param {string} id Data id value
7331
+ * @param {object} d Data row
7332
+ * @param {string} caller Caller function name (Used only for 'sparkline' plugin)
7267
7333
  * @returns {object} Indices object
7268
7334
  * @private
7269
7335
  */
7270
- getIndices: function getIndices(indices, id) {
7271
- var xs = this.config.data_xs;
7336
+ getIndices: function getIndices(indices, d) {
7337
+ // eslint-disable-line
7338
+ var $$ = this,
7339
+ _$$$config = $$.config,
7340
+ xs = _$$$config.data_xs,
7341
+ removeNull = _$$$config.bar_indices_removeNull,
7342
+ id = d.id,
7343
+ index = d.index;
7344
+
7345
+ if ($$.isBarType(id) && removeNull) {
7346
+ var ind = {}; // redefine bar indices order
7347
+
7348
+ $$.getAllValuesOnIndex(index, !0).forEach(function (v, i) {
7349
+ ind[v.id] = i;
7350
+ ind.__max__ = i;
7351
+ });
7352
+ return ind;
7353
+ }
7354
+
7272
7355
  return notEmpty(xs) ? indices[xs[id]] : indices;
7273
7356
  },
7274
7357
 
@@ -7298,7 +7381,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7298
7381
  halfWidth = isObjectType(offset) && (offset._$total.length ? offset._$total.reduce(sum) / 2 : 0);
7299
7382
 
7300
7383
  return function (d) {
7301
- var ind = $$.getIndices(indices, d.id, "getShapeX"),
7384
+ var ind = $$.getIndices(indices, d, "getShapeX"),
7302
7385
  index = d.id in ind ? ind[d.id] : 0,
7303
7386
  targetsNum = (ind.__max__ || 0) + 1,
7304
7387
  x = 0;
@@ -7341,6 +7424,9 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7341
7424
  value = $$.getRatio("index", d, !0);
7342
7425
  } else if ($$.isBubbleZType(d)) {
7343
7426
  value = $$.getBubbleZData(d.value, "y");
7427
+ } else if ($$.isBarRangeType(d)) {
7428
+ // TODO use range.getEnd() like method
7429
+ value = value[1];
7344
7430
  }
7345
7431
 
7346
7432
  return $$.getYScaleById(d.id, isSub)(value);
@@ -7413,9 +7499,15 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7413
7499
  var id = d.id,
7414
7500
  value = d.value,
7415
7501
  x = d.x,
7416
- ind = $$.getIndices(indices, id),
7417
- scale = $$.getYScaleById(id, isSub),
7418
- y0 = scale($$.getShapeYMin(id)),
7502
+ ind = $$.getIndices(indices, d),
7503
+ scale = $$.getYScaleById(id, isSub);
7504
+
7505
+ if ($$.isBarRangeType(d)) {
7506
+ // TODO use range.getStart()
7507
+ return scale(value[0]);
7508
+ }
7509
+
7510
+ var y0 = scale($$.getShapeYMin(id)),
7419
7511
  dataXAsNumber = +x,
7420
7512
  offset = y0;
7421
7513
  shapeOffsetTargets.filter(function (t) {
@@ -7424,7 +7516,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7424
7516
  var tid = t.id,
7425
7517
  rowValueMapByXValue = t.rowValueMapByXValue,
7426
7518
  rowValues = t.rowValues,
7427
- tvalues = t.values;
7519
+ tvalues = t.values; // for same stacked group (ind[tid] === ind[id])
7428
7520
 
7429
7521
  if (ind[tid] === ind[id] && indexMapByTargetId[tid] < indexMapByTargetId[id]) {
7430
7522
  var _row,
@@ -7554,6 +7646,22 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7554
7646
  type = config.spline_interpolation_type,
7555
7647
  interpolation = $$.isInterpolationType(type) ? type : "cardinal";
7556
7648
  return $$.isSplineType(d) ? interpolation : $$.isStepType(d) ? config.line_step_type : "linear";
7649
+ },
7650
+ isWithinBar: function isWithinBar(that) {
7651
+ var mouse = getPointer(this.state.event, that),
7652
+ list = getRectSegList(that),
7653
+ _list = list,
7654
+ seg0 = _list[0],
7655
+ seg1 = _list[1],
7656
+ x = Math.min(seg0.x, seg1.x),
7657
+ y = Math.min(seg0.y, seg1.y),
7658
+ offset = this.config.bar_sensitivity,
7659
+ _that$getBBox = that.getBBox(),
7660
+ width = _that$getBBox.width,
7661
+ height = _that$getBBox.height,
7662
+ isWithin = x - offset < mouse[0] && mouse[0] < x + width + offset && y - offset < mouse[1] && mouse[1] < y + height + offset;
7663
+
7664
+ return isWithin;
7557
7665
  }
7558
7666
  });
7559
7667
  ;// CONCATENATED MODULE: ./src/ChartInternal/internals/size.ts
@@ -7770,6 +7878,31 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7770
7878
  }
7771
7879
  },
7772
7880
 
7881
+ /**
7882
+ * Get resetted padding values when 'padding=false' option is set
7883
+ * https://github.com/naver/billboard.js/issues/2367
7884
+ * @param {number|object} v Padding values to be resetted
7885
+ * @returns {number|object} Padding value
7886
+ * @private
7887
+ */
7888
+ getResettedPadding: function getResettedPadding(v) {
7889
+ var $$ = this,
7890
+ config = $$.config,
7891
+ isNum = isNumber(v),
7892
+ p = isNum ? 0 : {};
7893
+
7894
+ if (config.padding === !1) {
7895
+ isNum || Object.keys(v).forEach(function (key) {
7896
+ // when data.lables=true, do not reset top padding
7897
+ p[key] = !isEmpty(config.data_labels) && config.data_labels !== !1 && key === "top" ? v[key] : 0;
7898
+ });
7899
+ } else {
7900
+ p = v;
7901
+ }
7902
+
7903
+ return p;
7904
+ },
7905
+
7773
7906
  /**
7774
7907
  * Update size values
7775
7908
  * @param {boolean} isInit If is called at initialization
@@ -7808,7 +7941,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7808
7941
  right: hasArc ? 0 : $$.getCurrentPaddingRight(!0),
7809
7942
  bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
7810
7943
  left: hasArc ? 0 : $$.getCurrentPaddingLeft()
7811
- }; // for subchart
7944
+ };
7945
+ state.margin = $$.getResettedPadding(state.margin); // for subchart
7812
7946
 
7813
7947
  state.margin2 = isRotated ? {
7814
7948
  top: state.margin.top,
@@ -7931,7 +8065,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7931
8065
  }
7932
8066
 
7933
8067
  return config.axis_rotated ? isEndAnchor ? "end" : "start" : "middle";
7934
- }).style("fill", $$.updateTextColor.bind($$)).style("fill-opacity", "0").each(function (d, i, j) {
8068
+ }).style("fill", $$.updateTextColor.bind($$)).style("fill-opacity", "0").each(function (d, i, texts) {
7935
8069
  var node = (0,external_commonjs_d3_selection_commonjs2_d3_selection_amd_d3_selection_root_d3_.select)(this),
7936
8070
  value = d.value;
7937
8071
 
@@ -7945,7 +8079,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7945
8079
  }
7946
8080
  }
7947
8081
 
7948
- value = $$.dataLabelFormat(d.id)(value, d.id, i, j);
8082
+ value = $$.dataLabelFormat(d.id)(value, d.id, i, texts);
7949
8083
 
7950
8084
  if (isNumber(value)) {
7951
8085
  this.textContent = value;
@@ -8147,9 +8281,11 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
8147
8281
  isRotated = config.axis_rotated,
8148
8282
  xPos = points[0][0];
8149
8283
 
8150
- if ($$.hasType("candlestick")) {
8284
+ if ($$.isCandlestickType(d)) {
8151
8285
  if (isRotated) {
8152
- xPos = $$.getCandlestickData(d)._isUp ? points[2][2] + 4 : points[2][1] - 4;
8286
+ var _$$$getCandlestickDat;
8287
+
8288
+ xPos = (_$$$getCandlestickDat = $$.getCandlestickData(d)) != null && _$$$getCandlestickDat._isUp ? points[2][2] + 4 : points[2][1] - 4;
8153
8289
  } else {
8154
8290
  xPos += (points[1][0] - xPos) / 2;
8155
8291
  }
@@ -8641,6 +8777,11 @@ function getTextPos(pos, width) {
8641
8777
  volume = _map3[4];
8642
8778
 
8643
8779
  value = "<b>Open:</b> " + open + " <b>High:</b> " + _high + " <b>Low:</b> " + _low + " <b>Close:</b> " + close + (volume ? " <b>Volume:</b> " + volume : "");
8780
+ } else if ($$.isBarRangeType(row)) {
8781
+ var _row$value = row.value,
8782
+ start = _row$value[0],
8783
+ end = _row$value[1];
8784
+ value = valueFormat(start) + " ~ " + valueFormat(end);
8644
8785
  }
8645
8786
 
8646
8787
  if (value !== undefined) {
@@ -9407,7 +9548,15 @@ var ChartInternal = /*#__PURE__*/function () {
9407
9548
  $el = $$.$el;
9408
9549
  checkModuleImport($$);
9409
9550
  state.hasAxis = !$$.hasArcType();
9410
- state.hasRadar = !state.hasAxis && $$.hasType("radar");
9551
+ state.hasRadar = !state.hasAxis && $$.hasType("radar"); // when 'padding=false' is set, disable axes and subchart. Because they are useless.
9552
+
9553
+ if (config.padding === !1) {
9554
+ config.axis_x_show = !1;
9555
+ config.axis_y_show = !1;
9556
+ config.axis_y2_show = !1;
9557
+ config.subchart_show = !1;
9558
+ }
9559
+
9411
9560
  $$.initParams();
9412
9561
  var bindto = {
9413
9562
  element: config.bindto,
@@ -9503,7 +9652,8 @@ var ChartInternal = /*#__PURE__*/function () {
9503
9652
  state.isLegendInset = config.legend_position === "inset";
9504
9653
  state.isLegendTop = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "top-right";
9505
9654
  state.isLegendLeft = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "bottom-left";
9506
- state.rotatedPaddingRight = isRotated && !config.axis_x_show ? 0 : 30;
9655
+ state.rotatedPadding.top = $$.getResettedPadding(state.rotatedPadding.top);
9656
+ state.rotatedPadding.right = isRotated && !config.axis_x_show ? 0 : 30;
9507
9657
  state.inputType = convertInputType(config.interaction_inputType_mouse, config.interaction_inputType_touch);
9508
9658
  };
9509
9659
 
@@ -13402,7 +13552,7 @@ var Axis_Axis = /*#__PURE__*/function () {
13402
13552
  }
13403
13553
 
13404
13554
  isYAxis || this.updateXAxisTickValues(targetsToShow, axis);
13405
- var dummy = chart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0px").style("left", "0px");
13555
+ var dummy = chart.append("svg").style("visibility", "hidden").style("position", "fixed").style("top", "0").style("left", "0");
13406
13556
  axis.create(dummy);
13407
13557
  dummy.selectAll("text").each(function (d, i) {
13408
13558
  var currentTextWidth = this.getBoundingClientRect().width;
@@ -13698,13 +13848,15 @@ var Axis_Axis = /*#__PURE__*/function () {
13698
13848
  ["subX", "x", "y", "y2"].forEach(function (type) {
13699
13849
  var axis = $el.axis[type],
13700
13850
  id = type === "subX" ? "x" : type,
13701
- toCull = config["axis_" + id + "_tick_culling"]; // subchart x axis should be aligned with x axis culling
13851
+ cullingOptionPrefix = "axis_" + id + "_tick_culling",
13852
+ toCull = config[cullingOptionPrefix]; // subchart x axis should be aligned with x axis culling
13702
13853
 
13703
13854
  if (axis && toCull) {
13704
- var tickText = axis.selectAll(".tick text"),
13705
- tickValues = sortValue(tickText.data()),
13855
+ var tickNodes = axis.selectAll(".tick"),
13856
+ tickValues = sortValue(tickNodes.data()),
13706
13857
  tickSize = tickValues.length,
13707
- cullingMax = config["axis_" + id + "_tick_culling_max"],
13858
+ cullingMax = config[cullingOptionPrefix + "_max"],
13859
+ lines = config[cullingOptionPrefix + "_lines"],
13708
13860
  intervalForCulling;
13709
13861
 
13710
13862
  if (tickSize) {
@@ -13715,11 +13867,13 @@ var Axis_Axis = /*#__PURE__*/function () {
13715
13867
  }
13716
13868
  }
13717
13869
 
13718
- tickText.each(function (d) {
13719
- this.style.display = tickValues.indexOf(d) % intervalForCulling ? "none" : null;
13870
+ tickNodes.each(function (d) {
13871
+ if (tickValues.indexOf(d) % intervalForCulling) {
13872
+ (lines ? this.querySelector("text") : this).style.display = "none";
13873
+ }
13720
13874
  });
13721
13875
  } else {
13722
- tickText.style("display", null);
13876
+ tickNodes.style("display", null);
13723
13877
  } // set/unset x_axis_tick_clippath
13724
13878
 
13725
13879
 
@@ -15530,15 +15684,16 @@ function smoothLines(el, type) {
15530
15684
  axis_x_tick_format: undefined,
15531
15685
 
15532
15686
  /**
15533
- * Setting for culling ticks.<br><br>
15534
- * If true is set, the ticks will be culled, then only limitted tick text will be shown. This option does not hide the tick lines. If false is set, all of ticks will be shown.<br><br>
15535
- * We can change the number of ticks to be shown by axis.x.tick.culling.max.
15687
+ * Setting for culling ticks.
15688
+ * - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
15689
+ * This option does not hide the tick lines by default, if want to hide tick lines, set `axis.x.tick.culling.lines=false`.
15690
+ * - `false`: all of ticks will be shown.<br><br>
15691
+ * The number of ticks to be shown can be chaned by `axis.x.tick.culling.max`.
15536
15692
  * @name axis․x․tick․culling
15537
15693
  * @memberof Options
15538
15694
  * @type {boolean}
15539
15695
  * @default
15540
- * - true for indexed axis and timeseries axis
15541
- * - false for category axis
15696
+ * `true` for indexed axis and timeseries axis, `false` for category axis
15542
15697
  * @example
15543
15698
  * axis: {
15544
15699
  * x: {
@@ -15569,6 +15724,25 @@ function smoothLines(el, type) {
15569
15724
  */
15570
15725
  axis_x_tick_culling_max: 10,
15571
15726
 
15727
+ /**
15728
+ * Control visibility of tick lines within culling option, along with tick text.
15729
+ * @name axis․x․tick․culling․lines
15730
+ * @memberof Options
15731
+ * @type {boolean}
15732
+ * @default true
15733
+ * @example
15734
+ * axis: {
15735
+ * x: {
15736
+ * tick: {
15737
+ * culling: {
15738
+ * lines: false,
15739
+ * }
15740
+ * }
15741
+ * }
15742
+ * }
15743
+ */
15744
+ axis_x_tick_culling_lines: !0,
15745
+
15572
15746
  /**
15573
15747
  * The number of x axis ticks to show.<br><br>
15574
15748
  * This option hides tick lines together with tick text. If this option is used on timeseries axis, the ticks position will be determined precisely and not nicely positioned (e.g. it will have rough second value).
@@ -15652,8 +15826,8 @@ function smoothLines(el, type) {
15652
15826
 
15653
15827
  /**
15654
15828
  * Fit x axis ticks.
15655
- * - **true**: ticks will be positioned nicely to have same intervals.
15656
- * - **false**: ticks will be positioned according to x value of the data points.
15829
+ * - **true**: ticks will be shown according to x value of the data points.
15830
+ * - **false**: ticks will be shown as to have same intervals.
15657
15831
  * @name axis․x․tick․fit
15658
15832
  * @memberof Options
15659
15833
  * @type {boolean}
@@ -16242,9 +16416,11 @@ function smoothLines(el, type) {
16242
16416
  axis_y_tick_format: undefined,
16243
16417
 
16244
16418
  /**
16245
- * Setting for culling ticks.<br><br>
16246
- * If true is set, the ticks will be culled, then only limitted tick text will be shown. This option does not hide the tick lines. If false is set, all of ticks will be shown.<br><br>
16247
- * We can change the number of ticks to be shown by axis.y.tick.culling.max.
16419
+ * Setting for culling ticks.
16420
+ * - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
16421
+ * This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y.tick.culling.lines=false`.
16422
+ * - `false`: all of ticks will be shown.<br><br>
16423
+ * The number of ticks to be shown can be chaned by `axis.y.tick.culling.max`.
16248
16424
  * @name axis․y․tick․culling
16249
16425
  * @memberof Options
16250
16426
  * @type {boolean}
@@ -16279,6 +16455,25 @@ function smoothLines(el, type) {
16279
16455
  */
16280
16456
  axis_y_tick_culling_max: 5,
16281
16457
 
16458
+ /**
16459
+ * Control visibility of tick lines within culling option, along with tick text.
16460
+ * @name axis․y․tick․culling․lines
16461
+ * @memberof Options
16462
+ * @type {boolean}
16463
+ * @default true
16464
+ * @example
16465
+ * axis: {
16466
+ * y: {
16467
+ * tick: {
16468
+ * culling: {
16469
+ * lines: false,
16470
+ * }
16471
+ * }
16472
+ * }
16473
+ * }
16474
+ */
16475
+ axis_y_tick_culling_lines: !0,
16476
+
16282
16477
  /**
16283
16478
  * Show y axis outer tick.
16284
16479
  * @name axis․y․tick․outer
@@ -16722,9 +16917,11 @@ function smoothLines(el, type) {
16722
16917
  axis_y2_tick_format: undefined,
16723
16918
 
16724
16919
  /**
16725
- * Setting for culling ticks.<br><br>
16726
- * If true is set, the ticks will be culled, then only limitted tick text will be shown. This option does not hide the tick lines. If false is set, all of ticks will be shown.<br><br>
16727
- * We can change the number of ticks to be shown by axis.y.tick.culling.max.
16920
+ * Setting for culling ticks.
16921
+ * - `true`: the ticks will be culled, then only limited tick text will be shown.<br>
16922
+ * This option does not hide the tick lines by default, if want to hide tick lines, set `axis.y2.tick.culling.lines=false`.
16923
+ * - `false`: all of ticks will be shown.<br><br>
16924
+ * The number of ticks to be shown can be chaned by `axis.y2.tick.culling.max`.
16728
16925
  * @name axis․y2․tick․culling
16729
16926
  * @memberof Options
16730
16927
  * @type {boolean}
@@ -16759,6 +16956,25 @@ function smoothLines(el, type) {
16759
16956
  */
16760
16957
  axis_y2_tick_culling_max: 5,
16761
16958
 
16959
+ /**
16960
+ * Control visibility of tick lines within culling option, along with tick text.
16961
+ * @name axis․y2․tick․culling․lines
16962
+ * @memberof Options
16963
+ * @type {boolean}
16964
+ * @default true
16965
+ * @example
16966
+ * axis: {
16967
+ * y2: {
16968
+ * tick: {
16969
+ * culling: {
16970
+ * lines: false,
16971
+ * }
16972
+ * }
16973
+ * }
16974
+ * }
16975
+ */
16976
+ axis_y2_tick_culling_lines: !0,
16977
+
16762
16978
  /**
16763
16979
  * Show or hide y2 axis outer tick.
16764
16980
  * @name axis․y2․tick․outer
@@ -17002,9 +17218,9 @@ function smoothLines(el, type) {
17002
17218
  ;// CONCATENATED MODULE: ./src/config/Options/axis/axis.ts
17003
17219
 
17004
17220
 
17005
- function axis_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
17221
+ function axis_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
17006
17222
 
17007
- function axis_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { axis_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { axis_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
17223
+ function axis_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? axis_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : axis_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
17008
17224
 
17009
17225
  /**
17010
17226
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -17576,11 +17792,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17576
17792
 
17577
17793
  if (title) {
17578
17794
  var text = $$.$el.arcs.append("text").attr("class", config_classes[hasGauge ? "chartArcsGaugeTitle" : "chartArcsTitle"]).style("text-anchor", "middle");
17579
-
17580
- if (hasGauge) {
17581
- text.attr("dy", "-0.3em").style("font-size", "27px");
17582
- }
17583
-
17795
+ hasGauge && text.attr("dy", "-0.3em");
17584
17796
  setTextValue(text, title, hasGauge ? undefined : [-.6, 1.35], !0);
17585
17797
  }
17586
17798
  },
@@ -17804,6 +18016,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
17804
18016
  return;
17805
18017
  }
17806
18018
 
18019
+ state.event = event;
17807
18020
  var eventArc = getEventArc(event),
17808
18021
  datum = eventArc.datum(),
17809
18022
  updated = (_datum = datum) != null && _datum.data && datum.data.id ? $$.updateAngle(datum) : null,
@@ -18041,9 +18254,16 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18041
18254
 
18042
18255
  /* harmony default export */ var bar = ({
18043
18256
  initBar: function initBar() {
18044
- var $el = this.$el;
18257
+ var $el = this.$el,
18258
+ config = this.config,
18259
+ clip = this.state.clip;
18045
18260
  $el.bar = $el.main.select("." + config_classes.chart) // should positioned at the beginning of the shape node to not overlap others
18046
- .insert("g", ":first-child").attr("class", config_classes.chartBars);
18261
+ .insert("g", ":first-child").attr("class", config_classes.chartBars); // set clip-path attribute when condition meet
18262
+ // https://github.com/naver/billboard.js/issues/2421
18263
+
18264
+ if (config.clipPath === !1 && (config.bar_radius || config.bar_radius_ratio)) {
18265
+ $el.bar.attr("clip-path", clip.pathXAxis.replace(/#[^)]*/, "#" + clip.id));
18266
+ }
18047
18267
  },
18048
18268
  updateTargetsForBar: function updateTargetsForBar(targets) {
18049
18269
  var $$ = this,
@@ -18060,8 +18280,8 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18060
18280
 
18061
18281
  var mainBarUpdate = $$.$el.main.select("." + config_classes.chartBars).selectAll("." + config_classes.chartBar).data( // remove
18062
18282
  targets.filter(function (v) {
18063
- return !v.values.every(function (d) {
18064
- return !isNumber(d.value);
18283
+ return v.values.some(function (d) {
18284
+ return isNumber(d.value) || $$.isBarRangeType(d);
18065
18285
  });
18066
18286
  })).attr("class", function (d) {
18067
18287
  return classChartBar(d) + classFocus(d);
@@ -18099,7 +18319,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18099
18319
 
18100
18320
  /**
18101
18321
  * Redraw function
18102
- * @param {Function} drawFn Retuned functino from .generateDrawCandlestick()
18322
+ * @param {Function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
18103
18323
  * @param {boolean} withTransition With or without transition
18104
18324
  * @param {boolean} isSub Subchart draw
18105
18325
  * @returns {Array}
@@ -18114,15 +18334,35 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18114
18334
  bar = _ref.bar;
18115
18335
 
18116
18336
  return [$$.$T(bar, withTransition, getRandom()).attr("d", function (d) {
18117
- return isNumber(d.value) && drawFn(d);
18337
+ return (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d);
18118
18338
  }).style("fill", this.color).style("opacity", null)];
18119
18339
  },
18340
+
18341
+ /**
18342
+ * Generate draw function
18343
+ * @param {object} barIndices data order within x axis.
18344
+ * barIndices ==> {data1: 0, data2: 0, data3: 1, data4: 1, __max__: 1}
18345
+ *
18346
+ * When gropus given as:
18347
+ * groups: [
18348
+ * ["data1", "data2"],
18349
+ * ["data3", "data4"]
18350
+ * ],
18351
+ *
18352
+ * Will be rendered as:
18353
+ * data1 data3 data1 data3
18354
+ * data2 data4 data2 data4
18355
+ * -------------------------
18356
+ * 0 1
18357
+ * @param {boolean} isSub If is for subchart
18358
+ * @returns {Function}
18359
+ * @private
18360
+ */
18120
18361
  generateDrawBar: function generateDrawBar(barIndices, isSub) {
18121
18362
  var $$ = this,
18122
18363
  config = $$.config,
18123
18364
  getPoints = $$.generateGetBarPoints(barIndices, isSub),
18124
18365
  isRotated = config.axis_rotated,
18125
- isGrouped = config.data_groups.length,
18126
18366
  barRadius = config.bar_radius,
18127
18367
  barRadiusRatio = config.bar_radius_ratio,
18128
18368
  getRadius = isNumber(barRadius) && barRadius > 0 ? function () {
@@ -18137,9 +18377,12 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18137
18377
  indexY = +!indexX,
18138
18378
  isNegative = d.value < 0,
18139
18379
  pathRadius = ["", ""],
18140
- radius = 0; // switch points if axis is rotated, not applicable for sub chart
18380
+ radius = 0,
18381
+ isGrouped = $$.isGrouped(d.id),
18382
+ hasRadius = d.value !== 0 && getRadius,
18383
+ isRadiusData = hasRadius && isGrouped ? $$.isStackingRadiusData(d) : !1; // switch points if axis is rotated, not applicable for sub chart
18141
18384
 
18142
- if (getRadius && !isGrouped) {
18385
+ if (hasRadius && (!isGrouped || isRadiusData)) {
18143
18386
  var index = isRotated ? indexY : indexX,
18144
18387
  barW = points[2][index] - points[0][index];
18145
18388
  radius = getRadius(barW);
@@ -18155,6 +18398,43 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18155
18398
  return "M" + points[0][indexX] + "," + points[0][indexY] + path + "z";
18156
18399
  };
18157
18400
  },
18401
+
18402
+ /**
18403
+ * Determine if given stacking bar data is radius type
18404
+ * @param {Object} d Data row
18405
+ * @returns {boolean}
18406
+ */
18407
+ isStackingRadiusData: function isStackingRadiusData(d) {
18408
+ var $$ = this,
18409
+ config = $$.config,
18410
+ data = $$.data,
18411
+ id = d.id,
18412
+ index = d.index,
18413
+ value = d.value,
18414
+ keys = config.data_groups.find(function (v) {
18415
+ return v.indexOf(id) > -1;
18416
+ }),
18417
+ sortedList = $$.orderTargets($$.filterTargetsToShow(data.targets.filter($$.isBarType, $$))).filter(function (v) {
18418
+ return keys.indexOf(v.id) > -1;
18419
+ }),
18420
+ sortedIds = sortedList.map(function (v) {
18421
+ return v.values.filter(function (v2) {
18422
+ return v2.index === index && (value > 0 ? v2.value > 0 : v2.value < 0);
18423
+ })[0];
18424
+ }).filter(Boolean).map(function (v) {
18425
+ return v.id;
18426
+ });
18427
+ // If the given id stays in the last position, then radius should be applied.
18428
+ return value !== 0 && sortedIds.indexOf(id) === sortedIds.length - 1;
18429
+ },
18430
+
18431
+ /**
18432
+ * Generate bar coordinate points data
18433
+ * @param {object} barIndices Data order within x axis.
18434
+ * @param {boolean} isSub If is for subchart
18435
+ * @returns {Array} Array of coordinate points
18436
+ * @private
18437
+ */
18158
18438
  generateGetBarPoints: function generateGetBarPoints(barIndices, isSub) {
18159
18439
  var $$ = this,
18160
18440
  config = $$.config,
@@ -18177,35 +18457,22 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18177
18457
  posY = y0;
18178
18458
  }
18179
18459
 
18180
- posY -= y0 - offset;
18460
+ if (!$$.isBarRangeType(d)) {
18461
+ posY -= y0 - offset;
18462
+ }
18463
+
18181
18464
  var startPosX = posX + width; // 4 points that make a bar
18182
18465
 
18183
18466
  return [[posX, offset], [posX, posY], [startPosX, posY], [startPosX, offset]];
18184
18467
  };
18185
- },
18186
- isWithinBar: function isWithinBar(that) {
18187
- var mouse = getPointer(this.state.event, that),
18188
- list = getRectSegList(that),
18189
- _list = list,
18190
- seg0 = _list[0],
18191
- seg1 = _list[1],
18192
- x = Math.min(seg0.x, seg1.x),
18193
- y = Math.min(seg0.y, seg1.y),
18194
- offset = this.config.bar_sensitivity,
18195
- _that$getBBox = that.getBBox(),
18196
- width = _that$getBBox.width,
18197
- height = _that$getBBox.height,
18198
- isWithin = x - offset < mouse[0] && mouse[0] < x + width + offset && y - offset < mouse[1] && mouse[1] < y + height + offset;
18199
-
18200
- return isWithin;
18201
18468
  }
18202
18469
  });
18203
18470
  ;// CONCATENATED MODULE: ./src/ChartInternal/shape/candlestick.ts
18204
18471
 
18205
18472
 
18206
- function candlestick_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
18473
+ function candlestick_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
18207
18474
 
18208
- function candlestick_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { candlestick_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { candlestick_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
18475
+ function candlestick_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? candlestick_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : candlestick_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
18209
18476
 
18210
18477
  /**
18211
18478
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -19714,6 +19981,7 @@ var cacheKey = KEY.radarPoints;
19714
19981
  return d && Object.keys(d).length === 1 ? d.index : undefined;
19715
19982
  },
19716
19983
  hide = function (event) {
19984
+ state.event = event;
19717
19985
  var index = getIndex(event),
19718
19986
  noIndex = isUndefined(index);
19719
19987
 
@@ -19965,10 +20233,10 @@ var cacheKey = KEY.radarPoints;
19965
20233
  * @memberof Options
19966
20234
  * @type {object}
19967
20235
  * @property {object} bar Bar object
20236
+ * @property {number} [bar.indices.removeNull=false] Remove nullish data on bar indices positions.
19968
20237
  * @property {number} [bar.label.threshold=0] Set threshold ratio to show/hide labels.
19969
20238
  * @property {number} [bar.padding=0] The padding pixel value between each bar.
19970
20239
  * @property {number} [bar.radius] Set the radius of bar edge in pixel.
19971
- * - **NOTE:** Works only for non-stacked bar
19972
20240
  * @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
19973
20241
  * @property {number} [bar.sensitivity=2] The senstivity offset value for interaction boundary.
19974
20242
  * @property {number} [bar.width] Change the width of bar chart.
@@ -19981,15 +20249,21 @@ var cacheKey = KEY.radarPoints;
19981
20249
  * @property {number} [bar.width.dataname.ratio=0.6] Change the width of bar chart by ratio.
19982
20250
  * @property {number} [bar.width.dataname.max] The maximum width value for ratio.
19983
20251
  * @property {boolean} [bar.zerobased=true] Set if min or max value will be 0 on bar chart.
20252
+ * @see [Demo: bar indices](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarIndices)
19984
20253
  * @see [Demo: bar padding](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarPadding)
19985
20254
  * @see [Demo: bar radius](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarRadius)
19986
20255
  * @see [Demo: bar width](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidth)
19987
20256
  * @see [Demo: bar width variant](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarWidthVariant)
19988
20257
  * @example
19989
20258
  * bar: {
20259
+ * // remove nullish data on bar indices postions
20260
+ * indices: {
20261
+ * removeNull: true
20262
+ * },
20263
+ *
19990
20264
  * padding: 1,
19991
20265
  *
19992
- * // the 'radius' option can be used only for non-stacking bars
20266
+ * // bar radius
19993
20267
  * radius: 10,
19994
20268
  * // or
19995
20269
  * radius: {
@@ -20026,6 +20300,7 @@ var cacheKey = KEY.radarPoints;
20026
20300
  * }
20027
20301
  */
20028
20302
  bar_label_threshold: 0,
20303
+ bar_indices_removeNull: !1,
20029
20304
  bar_padding: 0,
20030
20305
  bar_radius: undefined,
20031
20306
  bar_radius_ratio: undefined,
@@ -21429,9 +21704,9 @@ extend(zoom, {
21429
21704
  ;// CONCATENATED MODULE: ./src/ChartInternal/internals/selection.ts
21430
21705
 
21431
21706
 
21432
- function selection_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
21707
+ function selection_ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
21433
21708
 
21434
- function selection_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { selection_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { selection_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
21709
+ function selection_objectSpread(target) { for (var i = 1, source; i < arguments.length; i++) { source = null != arguments[i] ? arguments[i] : {}; i % 2 ? selection_ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : selection_ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
21435
21710
 
21436
21711
  /**
21437
21712
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -22653,7 +22928,7 @@ var _defaults = {},
22653
22928
  * bb.version; // "1.0.0"
22654
22929
  * @memberof bb
22655
22930
  */
22656
- version: "3.1.5",
22931
+ version: "3.3.0-next.1",
22657
22932
 
22658
22933
  /**
22659
22934
  * Generate chart
@@ -22787,7 +23062,7 @@ var _defaults = {},
22787
23062
  };
22788
23063
  /**
22789
23064
  * @namespace bb
22790
- * @version 3.1.5
23065
+ * @version 3.3.0-next.1
22791
23066
  */
22792
23067
  ;// CONCATENATED MODULE: ./src/index.ts
22793
23068
  /**