billboard.js 3.12.4 → 3.13.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 (68) hide show
  1. package/README.md +10 -3
  2. package/dist/billboard.css +167 -118
  3. package/dist/billboard.js +213 -90
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +10 -10
  6. package/dist/billboard.pkgd.js +1212 -1504
  7. package/dist/billboard.pkgd.min.js +15 -15
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +5 -12
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +7 -13
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +2 -2
  12. package/dist/plugin/billboardjs-plugin-stanford.js +9 -21
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +7 -13
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +5 -5
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +7 -13
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +597 -628
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -5
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +759 -953
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +6 -6
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +840 -1105
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +12 -12
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +759 -953
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +7 -7
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +832 -1092
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +7 -7
  28. package/dist/theme/dark.css +220 -154
  29. package/dist/theme/dark.min.css +1 -1
  30. package/dist/theme/datalab.css +221 -157
  31. package/dist/theme/datalab.min.css +1 -1
  32. package/dist/theme/graph.css +223 -158
  33. package/dist/theme/graph.min.css +1 -1
  34. package/dist/theme/insight.css +212 -149
  35. package/dist/theme/insight.min.css +1 -1
  36. package/dist/theme/modern.css +223 -159
  37. package/dist/theme/modern.min.css +1 -1
  38. package/dist-esm/billboard.js +249 -73
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  42. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  44. package/package.json +28 -42
  45. package/src/Chart/api/show.ts +1 -1
  46. package/src/ChartInternal/ChartInternal.ts +1 -1
  47. package/src/ChartInternal/data/data.ts +11 -0
  48. package/src/ChartInternal/interactions/zoom.ts +12 -1
  49. package/src/ChartInternal/internals/legend.ts +1 -1
  50. package/src/ChartInternal/internals/scale.ts +13 -5
  51. package/src/ChartInternal/shape/line.ts +170 -41
  52. package/src/ChartInternal/shape/shape.ts +8 -5
  53. package/src/config/Options/axis/y2.ts +13 -0
  54. package/src/config/Options/common/legend.ts +3 -2
  55. package/src/config/Options/data/axis.ts +6 -2
  56. package/src/config/Options/data/data.ts +7 -4
  57. package/src/config/Options/shape/bar.ts +22 -6
  58. package/src/config/const.ts +10 -4
  59. package/src/config/resolver/shape.ts +4 -0
  60. package/src/index.esm.ts +1 -0
  61. package/src/module/browser.ts +1 -1
  62. package/src/module/util.ts +2 -2
  63. package/src/module/worker.ts +1 -1
  64. package/types/bb.d.ts +1 -0
  65. package/types/index.d.ts +1 -0
  66. package/types/options.d.ts +6 -6
  67. package/types/options.shape.d.ts +10 -1
  68. package/types/types.d.ts +1 -0
package/dist/billboard.js CHANGED
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.12.4
8
+ * @version 3.13.0-next.2
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -191,6 +191,7 @@ __webpack_require__.d(resolver_shape_namespaceObject, {
191
191
  areaSpline: function() { return areaSpline; },
192
192
  areaSplineRange: function() { return areaSplineRange; },
193
193
  areaStep: function() { return areaStep; },
194
+ areaStepRange: function() { return areaStepRange; },
194
195
  bar: function() { return resolver_shape_bar; },
195
196
  bubble: function() { return resolver_shape_bubble; },
196
197
  candlestick: function() { return resolver_shape_candlestick; },
@@ -564,7 +565,8 @@ const $ZOOM = {
564
565
  * - rectangle
565
566
  * @property {boolean} [legend.format] Set formatter function for legend text.
566
567
  * The argument:<br>
567
- * - `id`: legend text value. When `data.names` is specified, will pass from it, otherwise will pass data id.
568
+ * - `id`: Legend text value. When `data.names` is specified, will pass from it, otherwise will pass data id.
569
+ * - `dataId`: When `data.names` specified, will pass the original data id. Otherwise will be undefined.
568
570
  * @property {boolean} [legend.tooltip=false] Show full legend text value using system tooltip(via `<title>` element).
569
571
  * @property {boolean} [legend.usePoint=false] Whether to use custom points in legend.
570
572
  * @see [Demo: format](https://naver.github.io/billboard.js/demo/#Legend.LegendFormat)
@@ -630,7 +632,7 @@ const $ZOOM = {
630
632
  * r: 10
631
633
  * }
632
634
  * },
633
- * format: function(id) {
635
+ * format: function(id, dataId) {
634
636
  * // set ellipsis string when length is > 5
635
637
  * // to get full legend value, combine with 'legend.tooltip=true'
636
638
  * if (id.length > 5) {
@@ -1428,6 +1430,7 @@ const $ZOOM = {
1428
1430
  * - area-spline
1429
1431
  * - area-spline-range
1430
1432
  * - area-step
1433
+ * - area-step-range
1431
1434
  * - bar
1432
1435
  * - bubble
1433
1436
  * - candlestick
@@ -1459,6 +1462,7 @@ const $ZOOM = {
1459
1462
  * areaSpline,
1460
1463
  * areaSplineRange,
1461
1464
  * areaStep,
1465
+ * areaStepRange,
1462
1466
  * bar,
1463
1467
  * bubble,
1464
1468
  * candlestick,
@@ -1507,6 +1511,7 @@ const $ZOOM = {
1507
1511
  * areaSpline,
1508
1512
  * areaSplineRange,
1509
1513
  * areaStep,
1514
+ * areaStepRange,
1510
1515
  * bar,
1511
1516
  * bubble,
1512
1517
  * candlestick,
@@ -1898,7 +1903,7 @@ const $ZOOM = {
1898
1903
  data_onhidden: void 0,
1899
1904
  /**
1900
1905
  * Set a callback for minimum data
1901
- * - **NOTE:** For 'area-line-range' and 'area-spline-range', `mid` data will be taken for the comparison
1906
+ * - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
1902
1907
  * @name data․onmin
1903
1908
  * @memberof Options
1904
1909
  * @type {Function}
@@ -1913,7 +1918,7 @@ const $ZOOM = {
1913
1918
  data_onmin: void 0,
1914
1919
  /**
1915
1920
  * Set a callback for maximum data
1916
- * - **NOTE:** For 'area-line-range' and 'area-spline-range', `mid` data will be taken for the comparison
1921
+ * - **NOTE:** For 'area-line-range', 'area-step-range' and 'area-spline-range', `mid` data will be taken for the comparison
1917
1922
  * @name data․onmax
1918
1923
  * @memberof Options
1919
1924
  * @type {Function}
@@ -2016,7 +2021,7 @@ const $ZOOM = {
2016
2021
  * type: "bar"
2017
2022
  * }
2018
2023
  *
2019
- * // for 'range' types('area-line-range' or 'area-spline-range'), data should contain:
2024
+ * // for 'range' types('area-line-range' or 'area-step-range' or 'area-spline-range'), data should contain:
2020
2025
  * // - an array of [high, mid, low] data following the order
2021
2026
  * // - or an object with 'high', 'mid' and 'low' key value
2022
2027
  * data: {
@@ -2101,7 +2106,7 @@ const $ZOOM = {
2101
2106
  * type: "bar"
2102
2107
  * }
2103
2108
  *
2104
- * // for 'range' types('area-line-range' or 'area-spline-range'), data should contain:
2109
+ * // for 'range' types('area-line-range' or 'area-step-range' or 'area-spline-range'), data should contain:
2105
2110
  * // - an array of [high, mid, low] data following the order
2106
2111
  * // - or an object with 'high', 'mid' and 'low' key value
2107
2112
  * data: {
@@ -2486,10 +2491,10 @@ function getCssRules(styleSheets) {
2486
2491
  return rules;
2487
2492
  }
2488
2493
  function getScrollPosition(node) {
2489
- var _a, _b, _c, _d;
2494
+ var _a, _b, _c, _d, _e, _f;
2490
2495
  return {
2491
- x: ((_b = (_a = win.pageXOffset) != null ? _a : win.scrollX) != null ? _b : 0) + node.scrollLeft,
2492
- y: ((_d = (_c = win.pageYOffset) != null ? _c : win.scrollY) != null ? _d : 0) + node.scrollTop
2496
+ x: ((_b = (_a = win.pageXOffset) != null ? _a : win.scrollX) != null ? _b : 0) + ((_c = node.scrollLeft) != null ? _c : 0),
2497
+ y: ((_e = (_d = win.pageYOffset) != null ? _d : win.scrollY) != null ? _e : 0) + ((_f = node.scrollTop) != null ? _f : 0)
2493
2498
  };
2494
2499
  }
2495
2500
  function getTranslation(node) {
@@ -2688,10 +2693,7 @@ var Options_spreadValues = (a, b) => {
2688
2693
  }
2689
2694
  return a;
2690
2695
  };
2691
- var __publicField = (obj, key, value) => {
2692
- Options_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2693
- return value;
2694
- };
2696
+ var __publicField = (obj, key, value) => Options_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2695
2697
 
2696
2698
 
2697
2699
 
@@ -2972,10 +2974,7 @@ class Store {
2972
2974
  ;// CONCATENATED MODULE: ./src/module/Cache.ts
2973
2975
  var Cache_defProp = Object.defineProperty;
2974
2976
  var Cache_defNormalProp = (obj, key, value) => key in obj ? Cache_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2975
- var Cache_publicField = (obj, key, value) => {
2976
- Cache_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2977
- return value;
2978
- };
2977
+ var Cache_publicField = (obj, key, value) => Cache_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
2979
2978
 
2980
2979
  const KEY = {
2981
2980
  bubbleBaseLength: "$baseLength",
@@ -3070,6 +3069,7 @@ const TYPE = {
3070
3069
  AREA_SPLINE: "area-spline",
3071
3070
  AREA_SPLINE_RANGE: "area-spline-range",
3072
3071
  AREA_STEP: "area-step",
3072
+ AREA_STEP_RANGE: "area-step-range",
3073
3073
  BAR: "bar",
3074
3074
  BUBBLE: "bubble",
3075
3075
  CANDLESTICK: "candlestick",
@@ -3091,6 +3091,7 @@ const TYPE_METHOD_NEEDED = {
3091
3091
  AREA_SPLINE: "initArea",
3092
3092
  AREA_SPLINE_RANGE: "initArea",
3093
3093
  AREA_STEP: "initArea",
3094
+ AREA_STEP_RANGE: "initArea",
3094
3095
  BAR: "initBar",
3095
3096
  BUBBLE: "initCircle",
3096
3097
  CANDLESTICK: "initCandlestick",
@@ -3112,11 +3113,13 @@ const TYPE_BY_CATEGORY = {
3112
3113
  TYPE.AREA_SPLINE,
3113
3114
  TYPE.AREA_SPLINE_RANGE,
3114
3115
  TYPE.AREA_LINE_RANGE,
3115
- TYPE.AREA_STEP
3116
+ TYPE.AREA_STEP,
3117
+ TYPE.AREA_STEP_RANGE
3116
3118
  ],
3117
3119
  AreaRange: [
3118
3120
  TYPE.AREA_SPLINE_RANGE,
3119
- TYPE.AREA_LINE_RANGE
3121
+ TYPE.AREA_LINE_RANGE,
3122
+ TYPE.AREA_STEP_RANGE
3120
3123
  ],
3121
3124
  Arc: [
3122
3125
  TYPE.PIE,
@@ -3133,11 +3136,13 @@ const TYPE_BY_CATEGORY = {
3133
3136
  TYPE.AREA_SPLINE_RANGE,
3134
3137
  TYPE.AREA_LINE_RANGE,
3135
3138
  TYPE.STEP,
3136
- TYPE.AREA_STEP
3139
+ TYPE.AREA_STEP,
3140
+ TYPE.AREA_STEP_RANGE
3137
3141
  ],
3138
3142
  Step: [
3139
3143
  TYPE.STEP,
3140
- TYPE.AREA_STEP
3144
+ TYPE.AREA_STEP,
3145
+ TYPE.AREA_STEP_RANGE
3141
3146
  ],
3142
3147
  Spline: [
3143
3148
  TYPE.SPLINE,
@@ -4079,10 +4084,20 @@ function getDataKeyForJson(keysParam, config) {
4079
4084
  const dataLabels = this.config.data_labels;
4080
4085
  return isBoolean(dataLabels) && dataLabels || isObjectType(dataLabels) && notEmpty(dataLabels);
4081
4086
  },
4087
+ /**
4088
+ * Determine if has null value
4089
+ * @param {Array} targets Data array to be evaluated
4090
+ * @returns {boolean}
4091
+ * @private
4092
+ */
4093
+ hasNullDataValue(targets) {
4094
+ return targets.some(({ value }) => value === null);
4095
+ },
4082
4096
  /**
4083
4097
  * Get data index from the event coodinates
4084
4098
  * @param {Event} event Event object
4085
4099
  * @returns {number}
4100
+ * @private
4086
4101
  */
4087
4102
  getDataIndexFromEvent(event) {
4088
4103
  const $$ = this;
@@ -5472,7 +5487,7 @@ function getFormattedText(id, formatted = true) {
5472
5487
  const { config } = this;
5473
5488
  let text = (_a = config.data_names[id]) != null ? _a : id;
5474
5489
  if (formatted && isFunction(config.legend_format)) {
5475
- text = config.legend_format(text);
5490
+ text = config.legend_format(text, id !== text ? id : void 0);
5476
5491
  }
5477
5492
  return text;
5478
5493
  }
@@ -6266,7 +6281,7 @@ var external_commonjs_d3_transition_commonjs2_d3_transition_amd_d3_transition_ro
6266
6281
  ;// CONCATENATED MODULE: ./src/ChartInternal/internals/scale.ts
6267
6282
 
6268
6283
 
6269
- function getScale(type = "linear", min = 0, max = 1) {
6284
+ function getScale(type = "linear", min, max) {
6270
6285
  const scale = {
6271
6286
  linear: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleLinear,
6272
6287
  log: external_commonjs_d3_scale_commonjs2_d3_scale_amd_d3_scale_root_d3_.scaleSymlog,
@@ -6276,7 +6291,7 @@ function getScale(type = "linear", min = 0, max = 1) {
6276
6291
  }[type]();
6277
6292
  scale.type = type;
6278
6293
  /_?log/.test(type) && scale.clamp(true);
6279
- return scale.range([min, max]);
6294
+ return scale.range([min != null ? min : 0, max != null ? max : 1]);
6280
6295
  }
6281
6296
  /* harmony default export */ var scale = ({
6282
6297
  /**
@@ -8375,7 +8390,7 @@ function getGroupedDataPointsFn(d) {
8375
8390
  getBarW(type, axis, targetsNum) {
8376
8391
  var _a, _b, _c, _d, _e;
8377
8392
  const $$ = this;
8378
- const { config, org, scale } = $$;
8393
+ const { config, org, scale, state } = $$;
8379
8394
  const maxDataCount = $$.getMaxDataCount();
8380
8395
  const isGrouped = type === "bar" && ((_a = config.data_groups) == null ? void 0 : _a.length);
8381
8396
  const configName = `${type}_width`;
@@ -8396,7 +8411,7 @@ function getGroupedDataPointsFn(d) {
8396
8411
  const width = id ? config[configName][id] : config[configName];
8397
8412
  const ratio = id ? width.ratio : config[`${configName}_ratio`];
8398
8413
  const max = id ? width.max : config[`${configName}_max`];
8399
- const w = isNumber(width) ? width : targetsNum ? tickInterval * ratio / targetsNum : 0;
8414
+ const w = isNumber(width) ? width : isFunction(width) ? width.call($$, state.width, targetsNum, maxDataCount) : targetsNum ? tickInterval * ratio / targetsNum : 0;
8400
8415
  return max && w > max ? max : w;
8401
8416
  };
8402
8417
  let result = getWidth();
@@ -8441,7 +8456,7 @@ function getGroupedDataPointsFn(d) {
8441
8456
  if (!$$.isTargetToShow(d.id)) {
8442
8457
  isWithin = false;
8443
8458
  } else if ((_a = $$.hasValidPointType) == null ? void 0 : _a.call($$, that.nodeName)) {
8444
- isWithin = $$.isStepType(d) ? $$.isWithinStep(that, $$.getYScaleById(d.id)(d.value)) : $$.isWithinCircle(
8459
+ isWithin = $$.isStepType(d) ? $$.isWithinStep(that, $$.getYScaleById(d.id)($$.getBaseValue(d))) : $$.isWithinCircle(
8445
8460
  that,
8446
8461
  $$.isBubbleType(d) ? $$.pointSelectR(d) * 1.5 : 0
8447
8462
  );
@@ -8501,10 +8516,7 @@ function getGroupedDataPointsFn(d) {
8501
8516
  ;// CONCATENATED MODULE: ./src/ChartInternal/ChartInternal.ts
8502
8517
  var ChartInternal_defProp = Object.defineProperty;
8503
8518
  var ChartInternal_defNormalProp = (obj, key, value) => key in obj ? ChartInternal_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8504
- var ChartInternal_publicField = (obj, key, value) => {
8505
- ChartInternal_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8506
- return value;
8507
- };
8519
+ var ChartInternal_publicField = (obj, key, value) => ChartInternal_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
8508
8520
 
8509
8521
 
8510
8522
 
@@ -8791,7 +8803,7 @@ class ChartInternal {
8791
8803
  if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_a = $$.hasLegendDefsPoint) == null ? void 0 : _a.call($$))) {
8792
8804
  $el.defs = $el.svg.append("defs");
8793
8805
  if (hasAxis) {
8794
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
8806
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
8795
8807
  $$.appendClip($el.defs, state.clip[v]);
8796
8808
  });
8797
8809
  }
@@ -10044,9 +10056,10 @@ function showHide(show, targetIdsValue, options) {
10044
10056
  callFn($$.config.data_onshown, this, hiddenIds);
10045
10057
  }
10046
10058
  $$.$T(targets).style("opacity", opacity, "important").call(endall, () => {
10059
+ var _a;
10047
10060
  if (!show && hiddenIds.length === 0) {
10048
10061
  targets.style("display", "none");
10049
- callFn($$.config.data_onhidden, this, targetIds);
10062
+ callFn((_a = $$.config) == null ? void 0 : _a.data_onhidden, this, targetIds);
10050
10063
  }
10051
10064
  targets.style("opacity", opacity);
10052
10065
  });
@@ -10257,10 +10270,7 @@ const tooltip_tooltip = {
10257
10270
  ;// CONCATENATED MODULE: ./src/Chart/Chart.ts
10258
10271
  var Chart_defProp = Object.defineProperty;
10259
10272
  var Chart_defNormalProp = (obj, key, value) => key in obj ? Chart_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10260
- var Chart_publicField = (obj, key, value) => {
10261
- Chart_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
10262
- return value;
10263
- };
10273
+ var Chart_publicField = (obj, key, value) => Chart_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
10264
10274
 
10265
10275
 
10266
10276
 
@@ -10993,6 +11003,7 @@ extend(zoom, {
10993
11003
 
10994
11004
 
10995
11005
 
11006
+
10996
11007
  /* harmony default export */ var interactions_zoom = ({
10997
11008
  /**
10998
11009
  * Initialize zoom.
@@ -11202,8 +11213,12 @@ extend(zoom, {
11202
11213
  */
11203
11214
  bindZoomOnEventRect() {
11204
11215
  const $$ = this;
11205
- const { config, $el: { eventRect } } = $$;
11216
+ const { config, $el: { eventRect, svg } } = $$;
11206
11217
  const behaviour = config.zoom_type === "drag" ? $$.zoomBehaviour : $$.zoom;
11218
+ if (win.GestureEvent && /^((?!chrome|android|mobile).)*safari/i.test(navigator.userAgent)) {
11219
+ svg.on("wheel", () => {
11220
+ });
11221
+ }
11207
11222
  eventRect == null ? void 0 : eventRect.call(behaviour).on("dblclick.zoom", null);
11208
11223
  },
11209
11224
  /**
@@ -12594,10 +12609,7 @@ var external_commonjs_d3_axis_commonjs2_d3_axis_amd_d3_axis_root_d3_ = __webpack
12594
12609
  ;// CONCATENATED MODULE: ./src/ChartInternal/Axis/AxisRendererHelper.ts
12595
12610
  var AxisRendererHelper_defProp = Object.defineProperty;
12596
12611
  var AxisRendererHelper_defNormalProp = (obj, key, value) => key in obj ? AxisRendererHelper_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12597
- var AxisRendererHelper_publicField = (obj, key, value) => {
12598
- AxisRendererHelper_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
12599
- return value;
12600
- };
12612
+ var AxisRendererHelper_publicField = (obj, key, value) => AxisRendererHelper_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
12601
12613
 
12602
12614
 
12603
12615
  class AxisRendererHelper {
@@ -12721,10 +12733,7 @@ class AxisRendererHelper {
12721
12733
  ;// CONCATENATED MODULE: ./src/ChartInternal/Axis/AxisRenderer.ts
12722
12734
  var AxisRenderer_defProp = Object.defineProperty;
12723
12735
  var AxisRenderer_defNormalProp = (obj, key, value) => key in obj ? AxisRenderer_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12724
- var AxisRenderer_publicField = (obj, key, value) => {
12725
- AxisRenderer_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
12726
- return value;
12727
- };
12736
+ var AxisRenderer_publicField = (obj, key, value) => AxisRenderer_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
12728
12737
 
12729
12738
 
12730
12739
 
@@ -13094,10 +13103,7 @@ class AxisRenderer {
13094
13103
  ;// CONCATENATED MODULE: ./src/ChartInternal/Axis/Axis.ts
13095
13104
  var Axis_defProp = Object.defineProperty;
13096
13105
  var Axis_defNormalProp = (obj, key, value) => key in obj ? Axis_defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13097
- var Axis_publicField = (obj, key, value) => {
13098
- Axis_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13099
- return value;
13100
- };
13106
+ var Axis_publicField = (obj, key, value) => Axis_defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
13101
13107
 
13102
13108
 
13103
13109
 
@@ -16406,6 +16412,18 @@ function smoothLines(el, type) {
16406
16412
 
16407
16413
  ;// CONCATENATED MODULE: ./src/config/Options/axis/y2.ts
16408
16414
  /* harmony default export */ var y2 = ({
16415
+ /**
16416
+ * Set clip-path attribute for y2 axis element
16417
+ * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
16418
+ * @name axis․y2․clipPath
16419
+ * @memberof Options
16420
+ * @type {boolean}
16421
+ * @default true
16422
+ * @example
16423
+ * // don't set 'clip-path' attribute
16424
+ * clipPath: false
16425
+ */
16426
+ axis_y2_clipPath: true,
16409
16427
  /**
16410
16428
  * Show or hide y2 axis.
16411
16429
  * - **NOTE**:
@@ -17086,8 +17104,12 @@ var axis_spreadValues = (a, b) => {
17086
17104
  * - The object type should be as:
17087
17105
  * - start {number}: Start data point number. If not set, the start will be the first data point.
17088
17106
  * - [end] {number}: End data point number. If not set, the end will be the last data point.
17089
- * - [style.dasharray="2 2"] {object}: The first number specifies a distance for the filled area, and the second a distance for the unfilled area.
17090
- * - **NOTE:** Currently this option supports only line chart and dashed style. If this option specified, the line will be dashed only in the regions.
17107
+ * - [style.dasharray="2 2"] {string}: The first number specifies a distance for the filled area, and the second a distance for the unfilled area.
17108
+ * - **NOTE:**
17109
+ * - Supports only line type.
17110
+ * - `start` and `end` values should be in the exact x value range.
17111
+ * - Dashes will be applied using `stroke-dasharray` css property when data doesn't contain nullish value(or nullish value with `line.connectNull=true` set).
17112
+ * - Dashes will be applied via path command when data contains nullish value.
17091
17113
  * @name data․regions
17092
17114
  * @memberof Options
17093
17115
  * @type {object}
@@ -18936,6 +18958,37 @@ function updateRatio(data) {
18936
18958
 
18937
18959
 
18938
18960
 
18961
+ function getStrokeDashArray(start, end, pattern, isLastX = false) {
18962
+ const dash = start ? [start, 0] : pattern;
18963
+ for (let i = start ? start : pattern.reduce((a, c) => a + c); i <= end; ) {
18964
+ pattern.forEach((v) => {
18965
+ if (i + v <= end) {
18966
+ dash.push(v);
18967
+ }
18968
+ i += v;
18969
+ });
18970
+ }
18971
+ dash.length % 2 !== 0 && dash.push(isLastX ? pattern[1] : 0);
18972
+ return {
18973
+ dash: dash.join(" "),
18974
+ length: dash.reduce((a, b) => a + b, 0)
18975
+ };
18976
+ }
18977
+ function getRegions(d, _regions, isTimeSeries) {
18978
+ const $$ = this;
18979
+ const regions = [];
18980
+ const dasharray = "2 2";
18981
+ if (isDefined(_regions)) {
18982
+ const getValue = (v, def) => isUndefined(v) ? def : isTimeSeries ? parseDate.call($$, v) : v;
18983
+ for (let i = 0, reg; reg = _regions[i]; i++) {
18984
+ const start = getValue(reg.start, d[0].x);
18985
+ const end = getValue(reg.end, d[d.length - 1].x);
18986
+ const style = reg.style || { dasharray };
18987
+ regions[i] = { start, end, style };
18988
+ }
18989
+ }
18990
+ return regions;
18991
+ }
18939
18992
  /* harmony default export */ var line = ({
18940
18993
  initLine() {
18941
18994
  const { $el } = this;
@@ -18980,6 +19033,7 @@ function updateRatio(data) {
18980
19033
  * @param {boolean} withTransition With or without transition
18981
19034
  * @param {boolean} isSub Subchart draw
18982
19035
  * @returns {Array}
19036
+ * @private
18983
19037
  */
18984
19038
  redrawLine(drawFn, withTransition, isSub = false) {
18985
19039
  const $$ = this;
@@ -19056,26 +19110,27 @@ function updateRatio(data) {
19056
19110
  return path || "M 0 0";
19057
19111
  };
19058
19112
  },
19113
+ /**
19114
+ * Set regions dasharray and get path
19115
+ * @param {Array} d Data object
19116
+ * @param {Function} x x scale function
19117
+ * @param {Function} y y scale function
19118
+ * @param {object} _regions regions to be set
19119
+ * @returns {stirng} Path string
19120
+ * @private
19121
+ */
19059
19122
  lineWithRegions(d, x, y, _regions) {
19060
19123
  const $$ = this;
19061
19124
  const { config } = $$;
19062
19125
  const isRotated = config.axis_rotated;
19063
19126
  const isTimeSeries = $$.axis.isTimeSeries();
19064
- const regions = [];
19065
19127
  const dasharray = "2 2";
19128
+ const regions = getRegions.bind($$)(d, _regions, isTimeSeries);
19129
+ const hasNullDataValue = $$.hasNullDataValue(d);
19066
19130
  let xp;
19067
19131
  let yp;
19068
19132
  let diff;
19069
19133
  let diffx2;
19070
- if (isDefined(_regions)) {
19071
- const getValue = (v, def) => isUndefined(v) ? def : isTimeSeries ? parseDate.call($$, v) : v;
19072
- for (let i = 0, reg; reg = _regions[i]; i++) {
19073
- const start = getValue(reg.start, d[0].x);
19074
- const end = getValue(reg.end, d[d.length - 1].x);
19075
- const style = reg.style || { dasharray };
19076
- regions[i] = { start, end, style };
19077
- }
19078
- }
19079
19134
  const xValue = isRotated ? (dt) => y(dt.value) : (dt) => x(dt.x);
19080
19135
  const yValue = isRotated ? (dt) => x(dt.x) : (dt) => y(dt.value);
19081
19136
  const generateM = (points) => `M${points[0][0]},${points[0][1]}L${points[1][0]},${points[1][1]}`;
@@ -19087,17 +19142,36 @@ function updateRatio(data) {
19087
19142
  const points = isRotated ? [[y(yp(k)), x(xv0)], [y(yp(k + diff)), x(xv1)]] : [[x(xv0), y(yp(k))], [x(xv1), y(yp(k + diff))]];
19088
19143
  return generateM(points);
19089
19144
  } : (d0, d1, k, otherDiff) => {
19090
- const points = isRotated ? [[y(yp(k), true), x(xp(k))], [
19091
- y(yp(k + otherDiff), true),
19092
- x(xp(k + otherDiff))
19093
- ]] : [[x(xp(k), true), y(yp(k))], [
19094
- x(xp(k + otherDiff), true),
19095
- y(yp(k + otherDiff))
19096
- ]];
19145
+ const x0 = x(d1.x, !isRotated);
19146
+ const y0 = y(d1.value, isRotated);
19147
+ const gap = k + otherDiff;
19148
+ const xValue2 = x(xp(k), !isRotated);
19149
+ const yValue2 = y(yp(k), isRotated);
19150
+ let xDiff = x(xp(gap), !isRotated);
19151
+ let yDiff = y(yp(gap), isRotated);
19152
+ if (xDiff > x0) {
19153
+ xDiff = x0;
19154
+ }
19155
+ if (d0.value > d1.value && (isRotated ? yDiff < y0 : yDiff > y0)) {
19156
+ yDiff = y0;
19157
+ }
19158
+ const points = [
19159
+ [xValue2, yValue2],
19160
+ [xDiff, yDiff]
19161
+ ];
19162
+ isRotated && points.forEach((v) => v.reverse());
19097
19163
  return generateM(points);
19098
19164
  };
19099
19165
  const axisType = { x: $$.axis.getAxisType("x"), y: $$.axis.getAxisType("y") };
19100
19166
  let path = "";
19167
+ const target = $$.$el.line.filter(({ id }) => id === d[0].id);
19168
+ const tempNode = target.clone().style("display", "none");
19169
+ const getLength = (node, path2) => node.attr("d", path2).node().getTotalLength();
19170
+ const dashArray = {
19171
+ dash: [],
19172
+ lastLength: 0
19173
+ };
19174
+ let isLastX = false;
19101
19175
  for (let i = 0, data; data = d[i]; i++) {
19102
19176
  const prevData = d[i - 1];
19103
19177
  const hasPrevData = prevData && isValue(prevData.value);
@@ -19108,26 +19182,61 @@ function updateRatio(data) {
19108
19182
  if (isUndefined(regions) || !style || !hasPrevData) {
19109
19183
  path += `${i && hasPrevData ? "L" : "M"}${xValue(data)},${yValue(data)}`;
19110
19184
  } else if (hasPrevData) {
19111
- try {
19112
- style = style.dasharray.split(" ");
19113
- } catch (e) {
19114
- style = dasharray.split(" ");
19115
- }
19185
+ style = ((style == null ? void 0 : style.dasharray) || dasharray).split(" ").map(Number);
19116
19186
  xp = getScale(axisType.x, prevData.x, data.x);
19117
19187
  yp = getScale(axisType.y, prevData.value, data.value);
19118
- const dx = x(data.x) - x(prevData.x);
19119
- const dy = y(data.value) - y(prevData.value);
19120
- const dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
19121
- diff = style[0] / dd;
19122
- diffx2 = diff * style[1];
19123
- for (let j = diff; j <= 1; j += diffx2) {
19124
- path += sWithRegion(prevData, data, j, diff);
19125
- if (j + diffx2 >= 1) {
19126
- path += sWithRegion(prevData, data, 1, 0);
19188
+ if (hasNullDataValue) {
19189
+ const dx = x(data.x) - x(prevData.x);
19190
+ const dy = y(data.value) - y(prevData.value);
19191
+ const dd = Math.sqrt(Math.pow(dx, 2) + Math.pow(dy, 2));
19192
+ diff = style[0] / dd;
19193
+ diffx2 = diff * style[1];
19194
+ for (let j = diff; j <= 1; j += diffx2) {
19195
+ path += sWithRegion(prevData, data, j, diff);
19196
+ if (j + diffx2 >= 1) {
19197
+ path += sWithRegion(prevData, data, 1, 0);
19198
+ }
19199
+ }
19200
+ } else {
19201
+ let points = [];
19202
+ isLastX = data.x === d[d.length - 1].x;
19203
+ if (isTimeSeries) {
19204
+ const x0 = +prevData.x;
19205
+ const xv0 = new Date(x0);
19206
+ const xv1 = new Date(x0 + (+data.x - x0));
19207
+ points = [
19208
+ [x(xv0), y(yp(0))],
19209
+ // M
19210
+ [x(xv1), y(yp(1))]
19211
+ // L
19212
+ ];
19213
+ } else {
19214
+ points = [
19215
+ [x(xp(0)), y(yp(0))],
19216
+ // M
19217
+ [x(xp(1)), y(yp(1))]
19218
+ // L
19219
+ ];
19127
19220
  }
19221
+ isRotated && points.forEach((v) => v.reverse());
19222
+ const startLength = getLength(tempNode, path);
19223
+ const endLength = getLength(tempNode, path += `L${points[1].join(",")}`);
19224
+ const strokeDashArray = getStrokeDashArray(
19225
+ startLength - dashArray.lastLength,
19226
+ endLength - dashArray.lastLength,
19227
+ style,
19228
+ isLastX
19229
+ );
19230
+ dashArray.lastLength += strokeDashArray.length;
19231
+ dashArray.dash.push(strokeDashArray.dash);
19128
19232
  }
19129
19233
  }
19130
19234
  }
19235
+ if (dashArray.dash.length) {
19236
+ !isLastX && dashArray.dash.push(getLength(tempNode, path));
19237
+ tempNode.remove();
19238
+ target.attr("stroke-dasharray", dashArray.dash.join(" "));
19239
+ }
19131
19240
  return path;
19132
19241
  },
19133
19242
  isWithinRegions(withinX, withinRegions) {
@@ -20432,14 +20541,19 @@ ${percentValue}%`;
20432
20541
  * @property {number} [bar.radius] Set the radius of bar edge in pixel.
20433
20542
  * @property {number} [bar.radius.ratio] Set the radius ratio of bar edge in relative the bar's width.
20434
20543
  * @property {number} [bar.sensitivity=2] The senstivity offset value for interaction boundary.
20435
- * @property {number} [bar.width] Change the width of bar chart.
20544
+ * @property {number|Function|object} [bar.width] Change the width of bar chart.
20436
20545
  * @property {number} [bar.width.ratio=0.6] Change the width of bar chart by ratio.
20546
+ * - **NOTE:** Criteria for ratio.
20547
+ * - When x ticks count is same with the data count, the baseline for ratio is the minimum interval value of x ticks.
20548
+ * - ex. when timeseries x values are: [2024-01-01, 2024-02-01, 2024-03-01], the minimum interval will be `2024-02-01 ~ 2024-03-01`
20549
+ * - if the minimum interval is 30px, then ratio=1 means 30px.
20550
+ * - When x ticks count is lower than the data count, the baseline will be calculated as `chart width / data count`.
20551
+ * - ex. when chart width is 500, data count is 5, then ratio=1 means 100px.
20437
20552
  * @property {number} [bar.width.max] The maximum width value for ratio.
20438
20553
  * @property {number} [bar.width.dataname] Change the width of bar for indicated dataset only.
20439
- * - **NOTE:**
20440
- * - Works only for non-stacked bar
20441
- * - Bars are centered accoding its total width value
20442
20554
  * @property {number} [bar.width.dataname.ratio=0.6] Change the width of bar chart by ratio.
20555
+ * - **NOTE:**
20556
+ * - Works only for non-stacked bar
20443
20557
  * @property {number} [bar.width.dataname.max] The maximum width value for ratio.
20444
20558
  * @property {boolean} [bar.zerobased=true] Set if min or max value will be 0 on bar chart.
20445
20559
  * @see [Demo: bar front](https://naver.github.io/billboard.js/demo/#BarChartOptions.BarFront)
@@ -20507,7 +20621,15 @@ ${percentValue}%`;
20507
20621
  *
20508
20622
  * width: 10,
20509
20623
  *
20510
- * // or
20624
+ * // or specify width callback. The callback will receive width, targetsNum, maxDataCount as arguments.
20625
+ * // - width: chart area width
20626
+ * // - targetsNum: number of targets
20627
+ * // - maxDataCount: maximum data count among targets
20628
+ * width: function(width, targetsNum, maxDataCount) {
20629
+ * return width / (targetsNum * maxDataCount);
20630
+ * }
20631
+ *
20632
+ * // or specify ratio & max
20511
20633
  * width: {
20512
20634
  * ratio: 0.2,
20513
20635
  * max: 20
@@ -21488,6 +21610,7 @@ function extendArc(module, option) {
21488
21610
  }
21489
21611
  let resolver_shape_area = () => (extendLine(shape_area, [Options_shape_area]), (resolver_shape_area = () => TYPE.AREA)());
21490
21612
  let areaLineRange = () => (extendLine(shape_area, [Options_shape_area]), (areaLineRange = () => TYPE.AREA_LINE_RANGE)());
21613
+ let areaStepRange = () => (extendLine(shape_area, [Options_shape_area]), (areaStepRange = () => TYPE.AREA_STEP_RANGE)());
21491
21614
  let areaSpline = () => (extendLine(shape_area, [Options_shape_area, spline]), (areaSpline = () => TYPE.AREA_SPLINE)());
21492
21615
  let areaSplineRange = () => (extendLine(shape_area, [Options_shape_area, spline]), (areaSplineRange = () => TYPE.AREA_SPLINE_RANGE)());
21493
21616
  let areaStep = () => (extendLine(shape_area, [Options_shape_area]), (areaStep = () => TYPE.AREA_STEP)());
@@ -21530,7 +21653,7 @@ const bb = {
21530
21653
  * bb.version; // "1.0.0"
21531
21654
  * @memberof bb
21532
21655
  */
21533
- version: "3.12.4",
21656
+ version: "3.13.0-next.2",
21534
21657
  /**
21535
21658
  * Generate chart
21536
21659
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when:
@@ -5,5 +5,5 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.12.4
8
+ * @version 3.13.0-next.2
9
9
  */.bb svg{font:10px sans-serif;-webkit-tap-highlight-color:rgba(0,0,0,0)}.bb path,.bb line{fill:none;stroke:#000}.bb text,.bb .bb-button{-webkit-user-select:none;-moz-user-select:none;user-select:none}.bb-legend-item-tile,.bb-xgrid-focus,.bb-ygrid-focus,.bb-ygrid{shape-rendering:crispEdges}.bb-chart-arcs .bb-needle,.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-chart-funnels path{stroke-width:0}.bb-chart-funnels+.bb-chart-texts text{font-size:13px;fill:#fff}.bb-axis{shape-rendering:crispEdges}.bb-axis .bb-axis-x-tooltip,.bb-axis .bb-axis-y-tooltip,.bb-axis .bb-axis-y2-tooltip{font-size:1em;fill:#fff;white-space:nowrap}.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:gray;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-target.bb-focused,.bb-circles.bb-focused{opacity:1}.bb-target.bb-focused path.bb-line,.bb-target.bb-focused path.bb-step,.bb-circles.bb-focused path.bb-line,.bb-circles.bb-focused path.bb-step{stroke-width:2px}.bb-target.bb-defocused,.bb-circles.bb-defocused{opacity:.3!important}.bb-target.bb-defocused .text-overlapping,.bb-circles.bb-defocused .text-overlapping{opacity:.05!important}.bb-region{fill:#4682b4}.bb-region rect{fill-opacity:.1}.bb-zoom-brush,.bb-brush .extent{fill-opacity:.1}.bb-legend-item{font-size:12px;user-select:none}.bb-legend-item-hidden{opacity:.15}.bb-legend-background{opacity:.75;fill:#fff;stroke:#d3d3d3;stroke-width:1}.bb-title{font:14px sans-serif}.bb-chart-treemaps rect{stroke:#fff;stroke-width:1px}.bb-tooltip-container{z-index:10;user-select:none}.bb-tooltip{border-collapse:collapse;border-spacing:0;background-color:#fff;empty-cells:show;opacity:.9;box-shadow:7px 7px 12px -9px #777;white-space:nowrap}.bb-tooltip tr{border:1px solid #CCC}.bb-tooltip th{background-color:#aaa;font-size:14px;padding:2px 5px;text-align:left;color:#fff}.bb-tooltip td{font-size:13px;padding:3px 6px;background-color:#fff;border-left:1px dotted #999}.bb-tooltip td>span,.bb-tooltip td>svg{display:inline-block;width:10px;height:10px;margin-right:6px}.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-arcs .bb-levels circle{fill:none;stroke:#848282;stroke-width:.5px}.bb-chart-arcs .bb-levels text{fill:#848282}.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{font-size:1.15em;cursor:default}.bb-chart-radars .bb-shapes polygon{fill-opacity:.2;stroke-width:1px}.bb-button{position:absolute;top:10px;right:10px}.bb-button .bb-zoom-reset{font-size:11px;border:solid 1px #ccc;background-color:#fff;padding:5px;border-radius:5px;cursor:pointer}