billboard.js 3.2.2 → 3.3.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/dist/billboard.css +1 -1
  2. package/dist/billboard.js +230 -68
  3. package/dist/billboard.min.css +1 -1
  4. package/dist/billboard.min.js +2 -2
  5. package/dist/billboard.pkgd.js +3196 -1856
  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 +10 -9
  10. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-stanford.js +10 -9
  12. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-tableview.js +12 -11
  14. package/dist/plugin/billboardjs-plugin-tableview.min.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-textoverlap.js +10 -9
  16. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  17. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.js +2976 -1798
  18. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.js +2985 -1806
  19. package/dist/plugin/pkgd/billboardjs-plugin-stanford.js +2986 -1807
  20. package/dist/plugin/pkgd/billboardjs-plugin-tableview.js +3045 -1866
  21. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.js +3045 -1866
  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 +198 -55
  29. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  30. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  31. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  32. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  33. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  34. package/package.json +29 -29
  35. package/src/ChartInternal/ChartInternal.ts +10 -1
  36. package/src/ChartInternal/data/convert.ts +1 -1
  37. package/src/ChartInternal/data/data.ts +27 -10
  38. package/src/ChartInternal/internals/domain.ts +4 -2
  39. package/src/ChartInternal/internals/scale.ts +3 -2
  40. package/src/ChartInternal/internals/size.ts +32 -1
  41. package/src/ChartInternal/internals/text.ts +2 -2
  42. package/src/ChartInternal/internals/tooltip.ts +4 -0
  43. package/src/ChartInternal/shape/bar.ts +78 -33
  44. package/src/ChartInternal/shape/shape.ts +33 -2
  45. package/src/Plugin/tableview/index.ts +1 -1
  46. package/src/config/Options/axis/x.ts +2 -2
  47. package/src/config/Options/common/main.ts +11 -1
  48. package/src/config/Options/data/data.ts +22 -0
  49. package/src/config/Options/shape/bar.ts +1 -2
  50. package/src/module/util.ts +16 -15
  51. package/types/options.d.ts +8 -1
  52. package/types/types.d.ts +4 -4
@@ -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.2
8
+ * @version 3.3.0-next.1
9
9
  */
10
10
  /*-- Chart --*/
11
11
  .bb svg {
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.2
8
+ * @version 3.3.0-next.1
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
  /**
@@ -1685,12 +1686,21 @@ var Store = /*#__PURE__*/function () {
1685
1686
  * @name padding
1686
1687
  * @memberof Options
1687
1688
  * @type {object}
1688
- * @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.
1689
1694
  * @property {number} [padding.top] padding on the top of chart
1690
1695
  * @property {number} [padding.right] padding on the right of chart
1691
1696
  * @property {number} [padding.bottom] padding on the bottom of chart
1692
1697
  * @property {number} [padding.left] padding on the left of chart
1698
+ * @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.Padding)
1693
1699
  * @example
1700
+ * // remove padding completely.
1701
+ * padding: false,
1702
+ *
1703
+ * // or specify padding value for each side
1694
1704
  * padding: {
1695
1705
  * top: 20,
1696
1706
  * right: 20,
@@ -1698,6 +1708,7 @@ var Store = /*#__PURE__*/function () {
1698
1708
  * left: 20
1699
1709
  * }
1700
1710
  */
1711
+ padding: !0,
1701
1712
  padding_left: undefined,
1702
1713
  padding_right: undefined,
1703
1714
  padding_top: undefined,
@@ -2556,6 +2567,18 @@ var Store = /*#__PURE__*/function () {
2556
2567
  * ]
2557
2568
  * }
2558
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
+ *
2559
2582
  * // for 'range' types('area-line-range' or 'area-spline-range'), data should contain:
2560
2583
  * // - an array of [high, mid, low] data following the order
2561
2584
  * // - or an object with 'high', 'mid' and 'low' key value
@@ -2632,6 +2655,16 @@ var Store = /*#__PURE__*/function () {
2632
2655
  * ]
2633
2656
  * }
2634
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
+ *
2635
2668
  * // for 'range' types('area-line-range' or 'area-spline-range'), data should contain:
2636
2669
  * // - an array of [high, mid, low] data following the order
2637
2670
  * // - or an object with 'high', 'mid' and 'low' key value
@@ -3248,9 +3281,9 @@ var Store = /*#__PURE__*/function () {
3248
3281
  ;// CONCATENATED MODULE: ./src/config/Options/Options.ts
3249
3282
 
3250
3283
 
3251
- 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; }
3252
3285
 
3253
- 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; }
3254
3287
 
3255
3288
  /**
3256
3289
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -4425,6 +4458,7 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4425
4458
 
4426
4459
  /**
4427
4460
  * Sort targets data
4461
+ * Note: For stacked bar, will sort from the total sum of data series, not for each stacked bar
4428
4462
  * @param {Array} targetsValue Target value
4429
4463
  * @returns {Array}
4430
4464
  * @private
@@ -4461,8 +4495,8 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4461
4495
  };
4462
4496
 
4463
4497
  fn = function (t1, t2) {
4464
- var t1Sum = t1.values.reduce(reducer, 0),
4465
- 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;
4466
4500
  return isArc ? orderAsc ? t1Sum - t2Sum : t2Sum - t1Sum : orderAsc ? t2Sum - t1Sum : t1Sum - t2Sum;
4467
4501
  };
4468
4502
  } else if (isFunction(order)) {
@@ -4576,19 +4610,20 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4576
4610
  }),
4577
4611
  minDist = config.point_sensitivity,
4578
4612
  closest;
4579
- // find mouseovering bar
4613
+ // find mouseovering bar/candlestick
4614
+ // https://github.com/naver/billboard.js/issues/2434
4580
4615
  data.filter(function (v) {
4581
- return $$.isBarType(v.id);
4616
+ return $$.isBarType(v.id) || $$.isCandlestickType(v.id);
4582
4617
  }).forEach(function (v) {
4583
- 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";
4584
4619
 
4585
- if (!closest && $$.isWithinBar(shape)) {
4620
+ if (!closest && $$.isWithinBar(main.select(selector).node())) {
4586
4621
  closest = v;
4587
4622
  }
4588
- }); // find closest point from non-bar
4623
+ }); // find closest point from non-bar/candlestick
4589
4624
 
4590
4625
  data.filter(function (v) {
4591
- return !$$.isBarType(v.id);
4626
+ return !$$.isBarType(v.id) && !$$.isCandlestickType(v.id);
4592
4627
  }).forEach(function (v) {
4593
4628
  var d = $$.dist(v, pos);
4594
4629
 
@@ -4821,6 +4856,20 @@ var external_commonjs_d3_dsv_commonjs2_d3_dsv_amd_d3_dsv_root_d3_ = __webpack_re
4821
4856
  return $$.isBubbleType(d) && (isObject(d.value) && ("z" in d.value || "y" in d.value) || isArray(d.value) && d.value.length === 2);
4822
4857
  },
4823
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
+
4824
4873
  /**
4825
4874
  * Get data object by id
4826
4875
  * @param {string} id data id
@@ -5699,9 +5748,10 @@ var colorizePattern = function (pattern, color, id) {
5699
5748
  ["bottom", "top"].forEach(function (v, i) {
5700
5749
  padding[v] += $$.convertPixelToScale("y", lengths[i], domainLength);
5701
5750
  });
5702
- } // if padding is set, the domain will be updated relative the current domain value
5703
- // ex) $$.height=300, padding.top=150, domainLength=4 --> domain=6
5751
+ }
5704
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
5705
5755
 
5706
5756
  var p = config[pfx + "_padding"];
5707
5757
 
@@ -5765,7 +5815,7 @@ var colorizePattern = function (pattern, color, id) {
5765
5815
  var maxDataCount = $$.getMaxDataCount();
5766
5816
  defaultValue = maxDataCount > 1 ? diff / (maxDataCount - 1) / 2 : .5;
5767
5817
  } else {
5768
- defaultValue = diff * .01;
5818
+ defaultValue = $$.getResettedPadding(diff * .01);
5769
5819
  }
5770
5820
 
5771
5821
  var _ref = isNumber(padding) ? {
@@ -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
  },
@@ -7341,6 +7392,9 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7341
7392
  value = $$.getRatio("index", d, !0);
7342
7393
  } else if ($$.isBubbleZType(d)) {
7343
7394
  value = $$.getBubbleZData(d.value, "y");
7395
+ } else if ($$.isBarRangeType(d)) {
7396
+ // TODO use range.getEnd() like method
7397
+ value = value[1];
7344
7398
  }
7345
7399
 
7346
7400
  return $$.getYScaleById(d.id, isSub)(value);
@@ -7414,8 +7468,14 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7414
7468
  value = d.value,
7415
7469
  x = d.x,
7416
7470
  ind = $$.getIndices(indices, id),
7417
- scale = $$.getYScaleById(id, isSub),
7418
- y0 = scale($$.getShapeYMin(id)),
7471
+ scale = $$.getYScaleById(id, isSub);
7472
+
7473
+ if ($$.isBarRangeType(d)) {
7474
+ // TODO use range.getStart()
7475
+ return scale(value[0]);
7476
+ }
7477
+
7478
+ var y0 = scale($$.getShapeYMin(id)),
7419
7479
  dataXAsNumber = +x,
7420
7480
  offset = y0;
7421
7481
  shapeOffsetTargets.filter(function (t) {
@@ -7424,7 +7484,7 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7424
7484
  var tid = t.id,
7425
7485
  rowValueMapByXValue = t.rowValueMapByXValue,
7426
7486
  rowValues = t.rowValues,
7427
- tvalues = t.values;
7487
+ tvalues = t.values; // for same stacked group (ind[tid] === ind[id])
7428
7488
 
7429
7489
  if (ind[tid] === ind[id] && indexMapByTargetId[tid] < indexMapByTargetId[id]) {
7430
7490
  var _row,
@@ -7554,6 +7614,22 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7554
7614
  type = config.spline_interpolation_type,
7555
7615
  interpolation = $$.isInterpolationType(type) ? type : "cardinal";
7556
7616
  return $$.isSplineType(d) ? interpolation : $$.isStepType(d) ? config.line_step_type : "linear";
7617
+ },
7618
+ isWithinBar: function isWithinBar(that) {
7619
+ var mouse = getPointer(this.state.event, that),
7620
+ list = getRectSegList(that),
7621
+ _list = list,
7622
+ seg0 = _list[0],
7623
+ seg1 = _list[1],
7624
+ x = Math.min(seg0.x, seg1.x),
7625
+ y = Math.min(seg0.y, seg1.y),
7626
+ offset = this.config.bar_sensitivity,
7627
+ _that$getBBox = that.getBBox(),
7628
+ width = _that$getBBox.width,
7629
+ height = _that$getBBox.height,
7630
+ isWithin = x - offset < mouse[0] && mouse[0] < x + width + offset && y - offset < mouse[1] && mouse[1] < y + height + offset;
7631
+
7632
+ return isWithin;
7557
7633
  }
7558
7634
  });
7559
7635
  ;// CONCATENATED MODULE: ./src/ChartInternal/internals/size.ts
@@ -7770,6 +7846,31 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7770
7846
  }
7771
7847
  },
7772
7848
 
7849
+ /**
7850
+ * Get resetted padding values when 'padding=false' option is set
7851
+ * https://github.com/naver/billboard.js/issues/2367
7852
+ * @param {number|object} v Padding values to be resetted
7853
+ * @returns {number|object} Padding value
7854
+ * @private
7855
+ */
7856
+ getResettedPadding: function getResettedPadding(v) {
7857
+ var $$ = this,
7858
+ config = $$.config,
7859
+ isNum = isNumber(v),
7860
+ p = isNum ? 0 : {};
7861
+
7862
+ if (config.padding === !1) {
7863
+ isNum || Object.keys(v).forEach(function (key) {
7864
+ // when data.lables=true, do not reset top padding
7865
+ p[key] = !isEmpty(config.data_labels) && config.data_labels !== !1 && key === "top" ? v[key] : 0;
7866
+ });
7867
+ } else {
7868
+ p = v;
7869
+ }
7870
+
7871
+ return p;
7872
+ },
7873
+
7773
7874
  /**
7774
7875
  * Update size values
7775
7876
  * @param {boolean} isInit If is called at initialization
@@ -7808,7 +7909,8 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
7808
7909
  right: hasArc ? 0 : $$.getCurrentPaddingRight(!0),
7809
7910
  bottom: xAxisHeight + subchartHeight + legendHeightForBottom + $$.getCurrentPaddingBottom(),
7810
7911
  left: hasArc ? 0 : $$.getCurrentPaddingLeft()
7811
- }; // for subchart
7912
+ };
7913
+ state.margin = $$.getResettedPadding(state.margin); // for subchart
7812
7914
 
7813
7915
  state.margin2 = isRotated ? {
7814
7916
  top: state.margin.top,
@@ -8147,9 +8249,11 @@ var external_commonjs_d3_shape_commonjs2_d3_shape_amd_d3_shape_root_d3_ = __webp
8147
8249
  isRotated = config.axis_rotated,
8148
8250
  xPos = points[0][0];
8149
8251
 
8150
- if ($$.hasType("candlestick")) {
8252
+ if ($$.isCandlestickType(d)) {
8151
8253
  if (isRotated) {
8152
- xPos = $$.getCandlestickData(d)._isUp ? points[2][2] + 4 : points[2][1] - 4;
8254
+ var _$$$getCandlestickDat;
8255
+
8256
+ xPos = (_$$$getCandlestickDat = $$.getCandlestickData(d)) != null && _$$$getCandlestickDat._isUp ? points[2][2] + 4 : points[2][1] - 4;
8153
8257
  } else {
8154
8258
  xPos += (points[1][0] - xPos) / 2;
8155
8259
  }
@@ -8641,6 +8745,11 @@ function getTextPos(pos, width) {
8641
8745
  volume = _map3[4];
8642
8746
 
8643
8747
  value = "<b>Open:</b> " + open + " <b>High:</b> " + _high + " <b>Low:</b> " + _low + " <b>Close:</b> " + close + (volume ? " <b>Volume:</b> " + volume : "");
8748
+ } else if ($$.isBarRangeType(row)) {
8749
+ var _row$value = row.value,
8750
+ start = _row$value[0],
8751
+ end = _row$value[1];
8752
+ value = valueFormat(start) + " ~ " + valueFormat(end);
8644
8753
  }
8645
8754
 
8646
8755
  if (value !== undefined) {
@@ -9407,7 +9516,15 @@ var ChartInternal = /*#__PURE__*/function () {
9407
9516
  $el = $$.$el;
9408
9517
  checkModuleImport($$);
9409
9518
  state.hasAxis = !$$.hasArcType();
9410
- state.hasRadar = !state.hasAxis && $$.hasType("radar");
9519
+ state.hasRadar = !state.hasAxis && $$.hasType("radar"); // when 'padding=false' is set, disable axes and subchart. Because they are useless.
9520
+
9521
+ if (config.padding === !1) {
9522
+ config.axis_x_show = !1;
9523
+ config.axis_y_show = !1;
9524
+ config.axis_y2_show = !1;
9525
+ config.subchart_show = !1;
9526
+ }
9527
+
9411
9528
  $$.initParams();
9412
9529
  var bindto = {
9413
9530
  element: config.bindto,
@@ -9503,7 +9620,8 @@ var ChartInternal = /*#__PURE__*/function () {
9503
9620
  state.isLegendInset = config.legend_position === "inset";
9504
9621
  state.isLegendTop = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "top-right";
9505
9622
  state.isLegendLeft = config.legend_inset_anchor === "top-left" || config.legend_inset_anchor === "bottom-left";
9506
- state.rotatedPaddingRight = isRotated && !config.axis_x_show ? 0 : 30;
9623
+ state.rotatedPadding.top = $$.getResettedPadding(state.rotatedPadding.top);
9624
+ state.rotatedPadding.right = isRotated && !config.axis_x_show ? 0 : 30;
9507
9625
  state.inputType = convertInputType(config.interaction_inputType_mouse, config.interaction_inputType_touch);
9508
9626
  };
9509
9627
 
@@ -15652,8 +15770,8 @@ function smoothLines(el, type) {
15652
15770
 
15653
15771
  /**
15654
15772
  * 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.
15773
+ * - **true**: ticks will be shown according to x value of the data points.
15774
+ * - **false**: ticks will be shown as to have same intervals.
15657
15775
  * @name axis․x․tick․fit
15658
15776
  * @memberof Options
15659
15777
  * @type {boolean}
@@ -17002,9 +17120,9 @@ function smoothLines(el, type) {
17002
17120
  ;// CONCATENATED MODULE: ./src/config/Options/axis/axis.ts
17003
17121
 
17004
17122
 
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; }
17123
+ 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
17124
 
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; }
17125
+ 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
17126
 
17009
17127
  /**
17010
17128
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -18063,8 +18181,8 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18063
18181
 
18064
18182
  var mainBarUpdate = $$.$el.main.select("." + config_classes.chartBars).selectAll("." + config_classes.chartBar).data( // remove
18065
18183
  targets.filter(function (v) {
18066
- return !v.values.every(function (d) {
18067
- return !isNumber(d.value);
18184
+ return v.values.some(function (d) {
18185
+ return isNumber(d.value) || $$.isBarRangeType(d);
18068
18186
  });
18069
18187
  })).attr("class", function (d) {
18070
18188
  return classChartBar(d) + classFocus(d);
@@ -18102,7 +18220,7 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18102
18220
 
18103
18221
  /**
18104
18222
  * Redraw function
18105
- * @param {Function} drawFn Retuned functino from .generateDrawCandlestick()
18223
+ * @param {Function} drawFn Retuned function from .getDrawShape() => .generateDrawBar()
18106
18224
  * @param {boolean} withTransition With or without transition
18107
18225
  * @param {boolean} isSub Subchart draw
18108
18226
  * @returns {Array}
@@ -18117,15 +18235,35 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18117
18235
  bar = _ref.bar;
18118
18236
 
18119
18237
  return [$$.$T(bar, withTransition, getRandom()).attr("d", function (d) {
18120
- return isNumber(d.value) && drawFn(d);
18238
+ return (isNumber(d.value) || $$.isBarRangeType(d)) && drawFn(d);
18121
18239
  }).style("fill", this.color).style("opacity", null)];
18122
18240
  },
18241
+
18242
+ /**
18243
+ * Generate draw function
18244
+ * @param {object} barIndices data order within x axis.
18245
+ * barIndices ==> {data1: 0, data2: 0, data3: 1, data4: 1, __max__: 1}
18246
+ *
18247
+ * When gropus given as:
18248
+ * groups: [
18249
+ * ["data1", "data2"],
18250
+ * ["data3", "data4"]
18251
+ * ],
18252
+ *
18253
+ * Will be rendered as:
18254
+ * data1 data3 data1 data3
18255
+ * data2 data4 data2 data4
18256
+ * -------------------------
18257
+ * 0 1
18258
+ * @param {boolean} isSub If is for subchart
18259
+ * @returns {Function}
18260
+ * @private
18261
+ */
18123
18262
  generateDrawBar: function generateDrawBar(barIndices, isSub) {
18124
18263
  var $$ = this,
18125
18264
  config = $$.config,
18126
18265
  getPoints = $$.generateGetBarPoints(barIndices, isSub),
18127
18266
  isRotated = config.axis_rotated,
18128
- isGrouped = config.data_groups.length,
18129
18267
  barRadius = config.bar_radius,
18130
18268
  barRadiusRatio = config.bar_radius_ratio,
18131
18269
  getRadius = isNumber(barRadius) && barRadius > 0 ? function () {
@@ -18140,9 +18278,10 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18140
18278
  indexY = +!indexX,
18141
18279
  isNegative = d.value < 0,
18142
18280
  pathRadius = ["", ""],
18143
- radius = 0; // switch points if axis is rotated, not applicable for sub chart
18281
+ radius = 0,
18282
+ isRadiusData = $$.isGrouped(d.id) ? $$.isStackingRadiusData(d) : !1; // switch points if axis is rotated, not applicable for sub chart
18144
18283
 
18145
- if (d.value !== 0 && getRadius && !isGrouped) {
18284
+ if (d.value !== 0 && getRadius && (!$$.isGrouped(d.id) || isRadiusData)) {
18146
18285
  var index = isRotated ? indexY : indexX,
18147
18286
  barW = points[2][index] - points[0][index];
18148
18287
  radius = getRadius(barW);
@@ -18158,6 +18297,43 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18158
18297
  return "M" + points[0][indexX] + "," + points[0][indexY] + path + "z";
18159
18298
  };
18160
18299
  },
18300
+
18301
+ /**
18302
+ * Determine if given stacking bar data is radius type
18303
+ * @param {Object} d Data row
18304
+ * @returns {boolean}
18305
+ */
18306
+ isStackingRadiusData: function isStackingRadiusData(d) {
18307
+ var $$ = this,
18308
+ config = $$.config,
18309
+ data = $$.data,
18310
+ id = d.id,
18311
+ index = d.index,
18312
+ value = d.value,
18313
+ keys = config.data_groups.find(function (v) {
18314
+ return v.indexOf(id) > -1;
18315
+ }),
18316
+ sortedList = $$.orderTargets($$.filterTargetsToShow(data.targets.filter($$.isBarType, $$))).filter(function (v) {
18317
+ return keys.indexOf(v.id) > -1;
18318
+ }),
18319
+ sortedIds = sortedList.map(function (v) {
18320
+ return v.values.filter(function (v2) {
18321
+ return v2.index === index && (value > 0 ? v2.value > 0 : v2.value < 0);
18322
+ })[0];
18323
+ }).filter(Boolean).map(function (v) {
18324
+ return v.id;
18325
+ });
18326
+ // If the given id stays in the last position, then radius should be applied.
18327
+ return value !== 0 && sortedIds.indexOf(id) === sortedIds.length - 1;
18328
+ },
18329
+
18330
+ /**
18331
+ * Generate bar coordinate points data
18332
+ * @param {object} barIndices Data order within x axis.
18333
+ * @param {boolean} isSub If is for subchart
18334
+ * @returns {Array} Array of coordinate points
18335
+ * @private
18336
+ */
18161
18337
  generateGetBarPoints: function generateGetBarPoints(barIndices, isSub) {
18162
18338
  var $$ = this,
18163
18339
  config = $$.config,
@@ -18180,35 +18356,22 @@ var external_commonjs_d3_interpolate_commonjs2_d3_interpolate_amd_d3_interpolate
18180
18356
  posY = y0;
18181
18357
  }
18182
18358
 
18183
- posY -= y0 - offset;
18359
+ if (!$$.isBarRangeType(d)) {
18360
+ posY -= y0 - offset;
18361
+ }
18362
+
18184
18363
  var startPosX = posX + width; // 4 points that make a bar
18185
18364
 
18186
18365
  return [[posX, offset], [posX, posY], [startPosX, posY], [startPosX, offset]];
18187
18366
  };
18188
- },
18189
- isWithinBar: function isWithinBar(that) {
18190
- var mouse = getPointer(this.state.event, that),
18191
- list = getRectSegList(that),
18192
- _list = list,
18193
- seg0 = _list[0],
18194
- seg1 = _list[1],
18195
- x = Math.min(seg0.x, seg1.x),
18196
- y = Math.min(seg0.y, seg1.y),
18197
- offset = this.config.bar_sensitivity,
18198
- _that$getBBox = that.getBBox(),
18199
- width = _that$getBBox.width,
18200
- height = _that$getBBox.height,
18201
- isWithin = x - offset < mouse[0] && mouse[0] < x + width + offset && y - offset < mouse[1] && mouse[1] < y + height + offset;
18202
-
18203
- return isWithin;
18204
18367
  }
18205
18368
  });
18206
18369
  ;// CONCATENATED MODULE: ./src/ChartInternal/shape/candlestick.ts
18207
18370
 
18208
18371
 
18209
- 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; }
18372
+ 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; }
18210
18373
 
18211
- 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; }
18374
+ 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; }
18212
18375
 
18213
18376
  /**
18214
18377
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -19971,7 +20134,6 @@ var cacheKey = KEY.radarPoints;
19971
20134
  * @property {number} [bar.label.threshold=0] Set threshold ratio to show/hide labels.
19972
20135
  * @property {number} [bar.padding=0] The padding pixel value between each bar.
19973
20136
  * @property {number} [bar.radius] Set the radius of bar edge in pixel.
19974
- * - **NOTE:** Works only for non-stacked bar
19975
20137
  * @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
19976
20138
  * @property {number} [bar.sensitivity=2] The senstivity offset value for interaction boundary.
19977
20139
  * @property {number} [bar.width] Change the width of bar chart.
@@ -19992,7 +20154,7 @@ var cacheKey = KEY.radarPoints;
19992
20154
  * bar: {
19993
20155
  * padding: 1,
19994
20156
  *
19995
- * // the 'radius' option can be used only for non-stacking bars
20157
+ * // bar radius
19996
20158
  * radius: 10,
19997
20159
  * // or
19998
20160
  * radius: {
@@ -21432,9 +21594,9 @@ extend(zoom, {
21432
21594
  ;// CONCATENATED MODULE: ./src/ChartInternal/internals/selection.ts
21433
21595
 
21434
21596
 
21435
- 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; }
21597
+ 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; }
21436
21598
 
21437
- 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; }
21599
+ 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; }
21438
21600
 
21439
21601
  /**
21440
21602
  * Copyright (c) 2017 ~ present NAVER Corp.
@@ -22656,7 +22818,7 @@ var _defaults = {},
22656
22818
  * bb.version; // "1.0.0"
22657
22819
  * @memberof bb
22658
22820
  */
22659
- version: "3.2.1",
22821
+ version: "3.2.2",
22660
22822
 
22661
22823
  /**
22662
22824
  * Generate chart
@@ -22790,7 +22952,7 @@ var _defaults = {},
22790
22952
  };
22791
22953
  /**
22792
22954
  * @namespace bb
22793
- * @version 3.2.1
22955
+ * @version 3.2.2
22794
22956
  */
22795
22957
  ;// CONCATENATED MODULE: ./src/index.ts
22796
22958
  /**
@@ -5,5 +5,5 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.2.2
8
+ * @version 3.3.0-next.1
9
9
  */.bb svg{-webkit-tap-highlight-color:rgba(0,0,0,0);font:10px sans-serif}.bb line,.bb path{fill:none;stroke:#000}.bb .bb-button,.bb text{-webkit-user-select:none;-moz-user-select:none;user-select:none}.bb-bars path,.bb-event-rect,.bb-legend-item-tile,.bb-xgrid-focus,.bb-ygrid,.bb-ygrid-focus{shape-rendering:crispEdges}.bb-chart-arc .bb-gauge-value{fill:#000}.bb-chart-arc path{stroke:#fff}.bb-chart-arc rect{stroke:#fff;stroke-width:1}.bb-chart-arc text{fill:#fff;font-size:13px}.bb-axis{shape-rendering:crispEdges}.bb-grid{pointer-events:none}.bb-grid line{stroke:#aaa}.bb-grid text{fill:#aaa}.bb-xgrid,.bb-ygrid{stroke-dasharray:3 3}.bb-text.bb-empty{fill:grey;font-size:2em}.bb-line{stroke-width:1px}.bb-circle._expanded_{stroke-width:1px;stroke:#fff}.bb-selected-circle{fill:#fff;stroke-width:2px}.bb-bar{stroke-width:0}.bb-bar._expanded_{fill-opacity:.75}.bb-candlestick{stroke-width:1px}.bb-candlestick._expanded_{fill-opacity:.75}.bb-circles.bb-focused,.bb-target.bb-focused{opacity:1}.bb-circles.bb-focused path.bb-line,.bb-circles.bb-focused path.bb-step,.bb-target.bb-focused path.bb-line,.bb-target.bb-focused path.bb-step{stroke-width:2px}.bb-circles.bb-defocused,.bb-target.bb-defocused{opacity:.3!important}.bb-circles.bb-defocused .text-overlapping,.bb-target.bb-defocused .text-overlapping{opacity:.05!important}.bb-region{fill:#4682b4}.bb-brush .extent,.bb-region,.bb-zoom-brush{fill-opacity:.1}.bb-legend-item{font-size:12px;user-select:none}.bb-legend-item-hidden{opacity:.15}.bb-legend-background{fill:#fff;stroke:#d3d3d3;stroke-width:1;opacity:.75}.bb-title{font:14px sans-serif}.bb-tooltip-container{user-select:none;z-index:10}.bb-tooltip{background-color:#fff;border-collapse:collapse;border-spacing:0;-webkit-box-shadow:7px 7px 12px -9px #777;-moz-box-shadow:7px 7px 12px -9px #777;box-shadow:7px 7px 12px -9px #777;empty-cells:show;opacity:.9}.bb-tooltip tr{border:1px solid #ccc}.bb-tooltip th{background-color:#aaa;color:#fff;font-size:14px;padding:2px 5px;text-align:left}.bb-tooltip td{background-color:#fff;border-left:1px dotted #999;font-size:13px;padding:3px 6px}.bb-tooltip td>span,.bb-tooltip td>svg{display:inline-block;height:10px;margin-right:6px;width:10px}.bb-tooltip.value{text-align:right}.bb-area{stroke-width:0;opacity:.2}.bb-chart-arcs-title{dominant-baseline:middle;font-size:1.3em}text.bb-chart-arcs-gauge-title{dominant-baseline:middle;font-size:2.7em}.bb-chart-arcs .bb-chart-arcs-background{fill:#e0e0e0;stroke:#fff}.bb-chart-arcs .bb-chart-arcs-gauge-unit{fill:#000;font-size:16px}.bb-chart-arcs .bb-chart-arcs-gauge-max,.bb-chart-arcs .bb-chart-arcs-gauge-min{fill:#777}.bb-chart-radars .bb-levels polygon{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-levels text{fill:#848282}.bb-chart-radars .bb-axis line{stroke:#848282;stroke-width:.5px}.bb-chart-radars .bb-axis text{cursor:default;font-size:1.15em}.bb-chart-radars .bb-shapes polygon{fill-opacity:.2;stroke-width:1px}.bb-button{position:absolute;right:10px;top:10px}.bb-button .bb-zoom-reset{background-color:#fff;border:1px solid #ccc;border-radius:5px;cursor:pointer;font-size:11px;padding:5px}