billboard.js 3.14.3 → 3.15.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 (54) hide show
  1. package/README.md +4 -2
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +155 -102
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +10 -10
  6. package/dist/billboard.pkgd.js +1367 -1014
  7. package/dist/billboard.pkgd.min.js +14 -14
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +2 -2
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  12. package/dist/plugin/billboardjs-plugin-stanford.js +2 -2
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +3 -3
  14. package/dist/plugin/billboardjs-plugin-tableview.js +2 -2
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +3 -3
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +9 -9
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +3 -3
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +1204 -914
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +5 -5
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +1205 -915
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +7 -7
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +1206 -916
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +14 -14
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +1207 -917
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +8 -8
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +1215 -918
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +6 -6
  28. package/dist/theme/dark.css +1 -1
  29. package/dist/theme/dark.min.css +1 -1
  30. package/dist/theme/datalab.css +1 -1
  31. package/dist/theme/datalab.min.css +1 -1
  32. package/dist/theme/graph.css +1 -1
  33. package/dist/theme/graph.min.css +1 -1
  34. package/dist/theme/insight.css +1 -1
  35. package/dist/theme/insight.min.css +1 -1
  36. package/dist/theme/modern.css +1 -1
  37. package/dist/theme/modern.min.css +1 -1
  38. package/dist-esm/billboard.js +555 -482
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +4 -4
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +15 -88
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +13 -86
  42. package/dist-esm/plugin/billboardjs-plugin-tableview.js +10 -83
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +7 -70
  44. package/package.json +28 -28
  45. package/src/Chart/api/chart.ts +2 -0
  46. package/src/Chart/api/regions.ts +2 -2
  47. package/src/ChartInternal/Axis/Axis.ts +68 -60
  48. package/src/ChartInternal/ChartInternal.ts +9 -4
  49. package/src/ChartInternal/interactions/interaction.ts +1 -1
  50. package/src/ChartInternal/internals/region.ts +69 -56
  51. package/src/config/Options/axis/y2.ts +13 -0
  52. package/src/config/Options/common/main.ts +32 -11
  53. package/types/options.d.ts +3 -1
  54. package/types/types.d.ts +0 -14
package/README.md CHANGED
@@ -6,8 +6,8 @@
6
6
  [![Latest Version][badge-latest]][link-version] [![Next version][badge-next]][link-version] [![bb][badge-@billboard.js/react]][link-@billboard.js/react]<br>
7
7
  [![semantic-release][badge-semantic-release]][link-semantic-release] ![React][badge-react]
8
8
 
9
- ![CI Status][badge-ci-status] [![Coverage Status][badge-coverage]][link-coverage] [![Known Vulnerabilities][badge-snyk]][link-snyk]
10
- [![download][badge-download]][link-download] [![jsDelivr][badge-jsDelivr]][link-jsDelivr] [![gzip size][badge-gzip-size]][link-gzip-size]
9
+ [![download][badge-download]][link-download] [![download][badge-download-weekly]][link-download] [![jsDelivr][badge-jsDelivr]][link-jsDelivr] [![jsDelivr][badge-jsDelivr-weekly]][link-jsDelivr]<br>
10
+ ![CI Status][badge-ci-status] [![Coverage Status][badge-coverage]][link-coverage] [![Known Vulnerabilities][badge-snyk]][link-snyk] [![gzip size][badge-gzip-size]][link-gzip-size]
11
11
 
12
12
  billboard.js is a re-usable, easy interface JavaScript chart library, based on [D3.js](https://d3js.org/).
13
13
  > The name "billboard" comes from the famous `billboard chart` which everybody knows.<br>
@@ -288,7 +288,9 @@ THE SOFTWARE.
288
288
 
289
289
  <!-- badges -->
290
290
  [badge-download]: https://img.shields.io/npm/dm/billboard.js.svg?style=flat
291
+ [badge-download-weekly]: https://img.shields.io/npm/dw/billboard.js
291
292
  [badge-jsDelivr]: https://data.jsdelivr.com/v1/package/npm/billboard.js/badge?style=rounded
293
+ [badge-jsDelivr-weekly]: https://img.shields.io/jsdelivr/npm/hw/billboard.js
292
294
  [badge-ci-status]: https://github.com/naver/billboard.js/workflows/CI/badge.svg
293
295
  [badge-coverage]: https://coveralls.io/repos/github/naver/billboard.js/badge.svg?branch=master&v1
294
296
  [badge-snyk]: https://snyk.io/test/github/naver/billboard.js/badge.svg?targetFile=package.json
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.14.3
8
+ * @version 3.15.0-next.2
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.14.3
8
+ * @version 3.15.0-next.2
9
9
  */
10
10
  (function webpackUniversalModuleDefinition(root, factory) {
11
11
  if(typeof exports === 'object' && typeof module === 'object')
@@ -827,6 +827,7 @@ const $ZOOM = {
827
827
  * - **NOTE:** Available options
828
828
  * - true: Enables automatic resize.
829
829
  * - false: Disables automatic resize.
830
+ * - "parent": Enables automatic resize when the parent node is resized.
830
831
  * - "viewBox": Enables automatic resize, and size will be fixed based on the viewbox.
831
832
  * @property {boolean|number} [resize.timer=true] Set resize timer option.
832
833
  * - **NOTE:** Available options
@@ -834,11 +835,15 @@ const $ZOOM = {
834
835
  * - true: `setTimeout()`
835
836
  * - false: `requestIdleCallback()`
836
837
  * - Given number(delay in ms) value, resize function will be triggered using `setTimeout()` with given delay.
837
- * @see [Demo](https://naver.github.io/billboard.js/demo/#ChartOptions.resizeViewBox)
838
+ * @see [Demo: resize "parent"](https://naver.github.io/billboard.js/demo/#ChartOptions.resizeParent)
839
+ * @see [Demo: resize "viewBox"](https://naver.github.io/billboard.js/demo/#ChartOptions.resizeViewBox)
838
840
  * @example
839
841
  * resize: {
840
842
  * auto: false,
841
843
  *
844
+ * // set resize based on parent node width value
845
+ * auto: "parent",
846
+ *
842
847
  * // set resize based on viewBox value
843
848
  * auto: "viewBox",
844
849
  *
@@ -1047,17 +1052,32 @@ const $ZOOM = {
1047
1052
  render: {},
1048
1053
  /**
1049
1054
  * Show rectangles inside the chart.<br><br>
1050
- * This option accepts array including object that has axis, start, end and class.
1051
- * The keys start, end and class are optional.
1052
- * axis must be x, y or y2. start and end should be the value where regions start and end.
1053
- * If not specified, the edge values will be used.
1054
- * If timeseries x axis, date string, Date object and unixtime integer can be used.
1055
- * If class is set, the region element will have it as class.
1055
+ * - **NOTE:**<br>
1056
+ * - axis must be x, y or y2. start and end should be the value where regions start and end.
1057
+ * - If not specified, the edge values will be used.
1058
+ * - If timeseries x axis, date string, Date object and unixtime integer can be used.
1059
+ * - If category x axis, category name can be used for start and end.
1060
+ * - If class is set, the region element will have it as class.
1061
+ *
1062
+ * This option accept array of object with below values:
1063
+ * - `axis {string}`: 'x', 'y', or 'y2'
1064
+ * - `[start] {number|Date|string}`: Start position of the region. If not set, the start will be the edge of the chart.
1065
+ * - `[end] {number|Date|string}`: End position of the region. If not set, the end will be the edge of the chart.
1066
+ * - `[class] {string}`: Class value to apply to the region.
1067
+ * - `[label] {object}` Lable text option.
1068
+ * - `text {string}`: Text value.
1069
+ * - `x {number}`: x Position.
1070
+ * - `y {number}`: y Position.
1071
+ * - `center {string}`: Align label at the center. Allowed values are 'x', 'y', 'xy'.
1072
+ * - `color {string}`: Color string.
1073
+ * - `rotated (boolean)`: Whether rotate label or not.
1056
1074
  * @name regions
1057
1075
  * @memberof Options
1058
1076
  * @type {Array}
1059
1077
  * @default []
1060
- * @see [Demo](https://naver.github.io/billboard.js/demo/#Region.RegionLabel)
1078
+ * @see [Demo: Regions](https://naver.github.io/billboard.js/demo/#Region.Region)
1079
+ * @see [Demo: Regions Timeseries](https://naver.github.io/billboard.js/demo/#Region.RegionWithTimeseries)
1080
+ * @see [Demo: Regions Label](https://naver.github.io/billboard.js/demo/#Region.RegionLabel)
1061
1081
  * @example
1062
1082
  * regions: [
1063
1083
  * {
@@ -1069,6 +1089,7 @@ const $ZOOM = {
1069
1089
  * text: "Region Text",
1070
1090
  * x: 5, // position relative of the initial x coordinate
1071
1091
  * y: 5, // position relative of the initial y coordinate
1092
+ * center: "xy", // center text label in both direction.
1072
1093
  * color: "red", // color string
1073
1094
  * rotated: true // make text to show in vertical or horizontal
1074
1095
  * }
@@ -4701,7 +4722,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
4701
4722
  * @param {Array} mouse x and y coordinate value
4702
4723
  */
4703
4724
  dispatchEvent(type, index, mouse) {
4704
- var _a, _b;
4725
+ var _a, _b, _c;
4705
4726
  const $$ = this;
4706
4727
  const {
4707
4728
  config,
@@ -4714,7 +4735,7 @@ var external_commonjs_d3_drag_commonjs2_d3_drag_amd_d3_drag_root_d3_ = __webpack
4714
4735
  },
4715
4736
  $el: { eventRect, funnel, radar, svg, treemap }
4716
4737
  } = $$;
4717
- let element = (_b = (hasFunnel || hasTreemap) && eventReceiver.rect || hasRadar && radar.axes.select(`.${$AXIS.axis}-${index} text`) || (eventRect || ((_a = $$.getArcElementByIdOrIndex) == null ? void 0 : _a.call($$, index)))) == null ? void 0 : _b.node();
4738
+ let element = (_c = (_b = (hasFunnel || hasTreemap) && eventReceiver.rect || hasRadar && radar.axes.select(`.${$AXIS.axis}-${index} text`) || (eventRect || ((_a = $$.getArcElementByIdOrIndex) == null ? void 0 : _a.call($$, index)))) == null ? void 0 : _b.node) == null ? void 0 : _c.call(_b);
4718
4739
  if (element) {
4719
4740
  const isMultipleX = $$.isMultipleX();
4720
4741
  const isRotated = config.axis_rotated;
@@ -8935,7 +8956,7 @@ class ChartInternal {
8935
8956
  if (hasAxis || hasColorPatterns || hasPolar || hasTreemap || labelsBGColor || ((_a = $$.hasLegendDefsPoint) == null ? void 0 : _a.call($$))) {
8936
8957
  $el.defs = $el.svg.append("defs");
8937
8958
  if (hasAxis) {
8938
- ["id", "idXAxis", "idYAxis", "idGrid"].forEach((v) => {
8959
+ ["id", "idXAxis", "idYAxis", "idY2Axis", "idGrid"].forEach((v) => {
8939
8960
  $$.appendClip($el.defs, state.clip[v]);
8940
8961
  });
8941
8962
  }
@@ -9176,11 +9197,11 @@ class ChartInternal {
9176
9197
  }
9177
9198
  bindResize() {
9178
9199
  const $$ = this;
9179
- const { config, state } = $$;
9200
+ const { $el, config, state } = $$;
9180
9201
  const resizeFunction = generateResize(config.resize_timer);
9181
9202
  const list = [];
9182
9203
  list.push(() => callFn(config.onresize, $$.api));
9183
- if (config.resize_auto === true) {
9204
+ if (/^(true|parent)$/.test(config.resize_auto)) {
9184
9205
  list.push(() => {
9185
9206
  state.resizing = true;
9186
9207
  if (config.legend_show) {
@@ -9196,7 +9217,11 @@ class ChartInternal {
9196
9217
  });
9197
9218
  list.forEach((v) => resizeFunction.add(v));
9198
9219
  $$.resizeFunction = resizeFunction;
9199
- win.addEventListener("resize", $$.resizeFunction = resizeFunction);
9220
+ if (config.resize_auto === "parent") {
9221
+ ($$.resizeFunction.resizeObserver = new ResizeObserver($$.resizeFunction.bind($$))).observe($el.chart.node().parentNode);
9222
+ } else {
9223
+ win.addEventListener("resize", $$.resizeFunction);
9224
+ }
9200
9225
  }
9201
9226
  /**
9202
9227
  * Call plugin hook
@@ -9351,6 +9376,7 @@ function loadConfig(config) {
9351
9376
  * chart.destroy();
9352
9377
  */
9353
9378
  destroy() {
9379
+ var _a;
9354
9380
  const $$ = this.internal;
9355
9381
  const { $el: { chart, style, svg } } = $$;
9356
9382
  if (notEmpty($$)) {
@@ -9359,6 +9385,7 @@ function loadConfig(config) {
9359
9385
  $$.unbindAllEvents();
9360
9386
  svg.select("*").interrupt();
9361
9387
  $$.resizeFunction.clear();
9388
+ (_a = $$.resizeFunction.resizeObserver) == null ? void 0 : _a.disconnect();
9362
9389
  win.removeEventListener("resize", $$.resizeFunction);
9363
9390
  chart.classed("bb", false).style("position", null).selectChildren().remove();
9364
9391
  style && style.parentNode.removeChild(style);
@@ -12592,7 +12619,7 @@ extend(regions, {
12592
12619
  * @function regions․add
12593
12620
  * @instance
12594
12621
  * @memberof Chart
12595
- * @param {Array|object} regions New region will be added. The format of this argument is the same as regions and it's possible to give an Object if only one region will be added.
12622
+ * @param {Array|object} regions New region will be added. The format of this argument is the same as [regions](./Options.html#.regions) and it's possible to give an Object if only one region will be added.
12596
12623
  * @returns {Array} regions
12597
12624
  * @example
12598
12625
  * // Add a new region
@@ -13330,12 +13357,10 @@ class Axis_Axis {
13330
13357
  init() {
13331
13358
  const $$ = this.owner;
13332
13359
  const { config, $el: { main, axis }, state: { clip } } = $$;
13333
- const isRotated = config.axis_rotated;
13334
13360
  const target = ["x", "y"];
13335
13361
  config.axis_y2_show && target.push("y2");
13336
13362
  target.forEach((v) => {
13337
13363
  const classAxis = this.getAxisClassName(v);
13338
- const classLabel = $AXIS[`axis${v.toUpperCase()}Label`];
13339
13364
  axis[v] = main.append("g").attr("class", classAxis).attr("clip-path", () => {
13340
13365
  let res = null;
13341
13366
  if (v === "x") {
@@ -13345,10 +13370,8 @@ class Axis_Axis {
13345
13370
  }
13346
13371
  return res;
13347
13372
  }).attr("transform", $$.getTranslate(v)).style("visibility", config[`axis_${v}_show`] ? null : "hidden");
13348
- axis[v].append("text").attr("class", classLabel).attr("transform", ["rotate(-90)", null][v === "x" ? +!isRotated : +isRotated]).style("text-anchor", () => this.textAnchorForAxisLabel(v));
13349
13373
  this.generateAxes(v);
13350
13374
  });
13351
- config.axis_tooltip && this.setAxisTooltip();
13352
13375
  }
13353
13376
  /**
13354
13377
  * Set axis orient according option value
@@ -13624,17 +13647,6 @@ class Axis_Axis {
13624
13647
  }
13625
13648
  return x;
13626
13649
  }
13627
- dxForAxisLabel(id) {
13628
- const $$ = this.owner;
13629
- const position = this.getAxisLabelPosition(id);
13630
- let dx = position.isBottom ? "0.5em" : "0";
13631
- if (this.isHorizontal($$, id !== "x")) {
13632
- dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0";
13633
- } else if (position.isTop) {
13634
- dx = "-0.5em";
13635
- }
13636
- return dx;
13637
- }
13638
13650
  textAnchorForAxisLabel(id) {
13639
13651
  const $$ = this.owner;
13640
13652
  const position = this.getAxisLabelPosition(id);
@@ -13646,6 +13658,17 @@ class Axis_Axis {
13646
13658
  }
13647
13659
  return anchor;
13648
13660
  }
13661
+ dxForAxisLabel(id) {
13662
+ const $$ = this.owner;
13663
+ const position = this.getAxisLabelPosition(id);
13664
+ let dx = position.isBottom ? "0.5em" : "0";
13665
+ if (this.isHorizontal($$, id !== "x")) {
13666
+ dx = position.isLeft ? "0.5em" : position.isRight ? "-0.5em" : "0";
13667
+ } else if (position.isTop) {
13668
+ dx = "-0.5em";
13669
+ }
13670
+ return dx;
13671
+ }
13649
13672
  dyForAxisLabel(id) {
13650
13673
  const $$ = this.owner;
13651
13674
  const { config } = $$;
@@ -13812,17 +13835,26 @@ class Axis_Axis {
13812
13835
  }
13813
13836
  return maxOverflow + tickOffset;
13814
13837
  }
13838
+ /**
13839
+ * Update axis label text
13840
+ * @param {boolean} withTransition Weather update with transition
13841
+ * @private
13842
+ */
13815
13843
  updateLabels(withTransition) {
13816
13844
  const $$ = this.owner;
13817
- const { $el: { main }, $T } = $$;
13818
- const labels = {
13819
- x: main.select(`.${$AXIS.axisX} .${$AXIS.axisXLabel}`),
13820
- y: main.select(`.${$AXIS.axisY} .${$AXIS.axisYLabel}`),
13821
- y2: main.select(`.${$AXIS.axisY2} .${$AXIS.axisY2Label}`)
13822
- };
13823
- Object.keys(labels).filter((id) => !labels[id].empty()).forEach((v) => {
13824
- const node = labels[v];
13825
- $T(node, withTransition).attr("x", () => this.xForAxisLabel(v)).attr("dx", () => this.dxForAxisLabel(v)).attr("dy", () => this.dyForAxisLabel(v)).text(() => this.getLabelText(v));
13845
+ const { config, $el: { main }, $T } = $$;
13846
+ const isRotated = config.axis_rotated;
13847
+ ["x", "y", "y2"].forEach((id) => {
13848
+ const text = this.getLabelText(id);
13849
+ const selector = `axis${capitalize(id)}`;
13850
+ const classLabel = $AXIS[`${selector}Label`];
13851
+ if (text) {
13852
+ let axisLabel = main.select(`text.${classLabel}`);
13853
+ if (axisLabel.empty()) {
13854
+ axisLabel = main.select(`g.${$AXIS[selector]}`).insert("text", ":first-child").attr("class", classLabel).attr("transform", ["rotate(-90)", null][id === "x" ? +!isRotated : +isRotated]).style("text-anchor", () => this.textAnchorForAxisLabel(id));
13855
+ }
13856
+ $T(axisLabel, withTransition).attr("x", () => this.xForAxisLabel(id)).attr("dx", () => this.dxForAxisLabel(id)).attr("dy", () => this.dyForAxisLabel(id)).text(text);
13857
+ }
13826
13858
  });
13827
13859
  }
13828
13860
  /**
@@ -13883,7 +13915,7 @@ class Axis_Axis {
13883
13915
  }
13884
13916
  redraw(transitions, isHidden, isInit) {
13885
13917
  const $$ = this.owner;
13886
- const { config, $el } = $$;
13918
+ const { config, state, $el } = $$;
13887
13919
  const opacity = isHidden ? "0" : null;
13888
13920
  ["x", "y", "y2", "subX"].forEach((id) => {
13889
13921
  const axis = this[id];
@@ -13897,6 +13929,7 @@ class Axis_Axis {
13897
13929
  }
13898
13930
  });
13899
13931
  this.updateAxes();
13932
+ !state.rendered && config.axis_tooltip && this.setAxisTooltip();
13900
13933
  }
13901
13934
  /**
13902
13935
  * Redraw axis
@@ -14025,15 +14058,17 @@ class Axis_Axis {
14025
14058
  );
14026
14059
  ["x", "y", "y2"].forEach((v) => {
14027
14060
  var _a2, _b, _c;
14028
- axisTooltip[v] = (_a2 = axis[v]) == null ? void 0 : _a2.append("text").classed($AXIS[`axis${v.toUpperCase()}Tooltip`], true).attr("filter", $$.updateTextBGColor({ id: v }, bgColor));
14029
- if (isRotated) {
14030
- const pos = v === "x" ? "x" : "y";
14031
- const val = v === "y" ? "1.15em" : v === "x" ? "-0.3em" : "-0.4em";
14032
- (_b = axisTooltip[v]) == null ? void 0 : _b.attr(pos, val).attr(`d${v === "x" ? "y" : "x"}`, v === "x" ? "0.4em" : "-1.3em").style("text-anchor", v === "x" ? "end" : null);
14033
- } else {
14034
- const pos = v === "x" ? "y" : "x";
14035
- const val = v === "x" ? "1.15em" : `${v === "y" ? "-" : ""}0.4em`;
14036
- (_c = axisTooltip[v]) == null ? void 0 : _c.attr(pos, val).attr(`d${v === "x" ? "x" : "y"}`, v === "x" ? "-1em" : "0.3em").style("text-anchor", v === "y" ? "end" : null);
14061
+ if (isString(bgColor) || bgColor[v]) {
14062
+ axisTooltip[v] = (_a2 = axis[v]) == null ? void 0 : _a2.append("text").classed($AXIS[`axis${v.toUpperCase()}Tooltip`], true).attr("filter", $$.updateTextBGColor({ id: v }, bgColor));
14063
+ if (isRotated) {
14064
+ const pos = v === "x" ? "x" : "y";
14065
+ const val = v === "y" ? "1.15em" : v === "x" ? "-0.3em" : "-0.4em";
14066
+ (_b = axisTooltip[v]) == null ? void 0 : _b.attr(pos, val).attr(`d${v === "x" ? "y" : "x"}`, v === "x" ? "0.4em" : "-1.3em").style("text-anchor", v === "x" ? "end" : null);
14067
+ } else {
14068
+ const pos = v === "x" ? "y" : "x";
14069
+ const val = v === "x" ? "1.15em" : `${v === "y" ? "-" : ""}0.4em`;
14070
+ (_c = axisTooltip[v]) == null ? void 0 : _c.attr(pos, val).attr(`d${v === "x" ? "x" : "y"}`, v === "x" ? "-1em" : "0.3em").style("text-anchor", v === "y" ? "end" : null);
14071
+ }
14037
14072
  }
14038
14073
  });
14039
14074
  }
@@ -15171,22 +15206,31 @@ function smoothLines(el, type) {
15171
15206
  redrawRegion(withTransition) {
15172
15207
  const $$ = this;
15173
15208
  const { $el: { region }, $T } = $$;
15209
+ const regionX = $$.regionX.bind($$);
15210
+ const regionY = $$.regionY.bind($$);
15211
+ const attr = ["width", "height"];
15174
15212
  let regions = region.list.select("rect");
15175
15213
  let label = region.list.selectAll("text");
15176
- regions = $T(regions, withTransition).attr("x", $$.regionX.bind($$)).attr("y", $$.regionY.bind($$)).attr("width", $$.regionWidth.bind($$)).attr("height", $$.regionHeight.bind($$));
15177
- label = $T(label, withTransition).attr("transform", (d) => {
15214
+ regions = $T(regions, withTransition).attr("x", regionX).attr("y", regionY).attr("width", $$.regionWidth.bind($$)).attr("height", $$.regionHeight.bind($$));
15215
+ label = $T(label, withTransition).text((d) => {
15178
15216
  var _a;
15179
- const { x = 0, y = 0, rotated = false } = (_a = d.label) != null ? _a : {};
15180
- return `translate(${$$.regionX.bind($$)(d) + x}, ${$$.regionY.bind($$)(d) + y})${rotated ? ` rotate(-90)` : ``}`;
15181
- }).attr("text-anchor", (d) => {
15217
+ return (_a = d.label) == null ? void 0 : _a.text;
15218
+ }).attr("transform", ({ label: label2 }) => label2.rotated ? ` rotate(-90)` : null).attr("transform", function(d) {
15182
15219
  var _a;
15183
- return ((_a = d.label) == null ? void 0 : _a.rotated) ? "end" : null;
15184
- }).attr("dy", "1em").style("fill", (d) => {
15185
- var _a, _b;
15186
- return (_b = (_a = d.label) == null ? void 0 : _a.color) != null ? _b : null;
15187
- }).text((d) => {
15220
+ const { x = 0, y = 0, center = false, rotated = false } = (_a = d.label) != null ? _a : {};
15221
+ const rect = this.previousElementSibling;
15222
+ const pos = { x: 0, y: 0 };
15223
+ if (isString(center)) {
15224
+ ["x", "y"].forEach((v, i) => {
15225
+ if (center.indexOf(v) > -1) {
15226
+ pos[v] = (+rect.getAttribute(attr[i]) - getBoundingRect(this)[attr[i]]) / 2;
15227
+ }
15228
+ });
15229
+ }
15230
+ return `translate(${regionX(d) + pos.x + x}, ${regionY(d) + pos.y + y})${rotated ? ` rotate(-90)` : ``}`;
15231
+ }).attr("text-anchor", ({ label: label2 }) => (label2 == null ? void 0 : label2.rotated) ? "end" : null).attr("dy", "1em").style("fill", ({ label: label2 }) => {
15188
15232
  var _a;
15189
- return (_a = d.label) == null ? void 0 : _a.text;
15233
+ return (_a = label2 == null ? void 0 : label2.color) != null ? _a : null;
15190
15234
  });
15191
15235
  return [
15192
15236
  regions.style("fill-opacity", (d) => isValue(d.opacity) ? d.opacity : null).on("end", function() {
@@ -15195,62 +15239,59 @@ function smoothLines(el, type) {
15195
15239
  label.style("opacity", null)
15196
15240
  ];
15197
15241
  },
15198
- getRegionXY(type, d) {
15199
- const $$ = this;
15200
- const { config, scale } = $$;
15201
- const isRotated = config.axis_rotated;
15202
- const isX = type === "x";
15203
- let key = "start";
15204
- let currScale;
15205
- let pos = 0;
15206
- if (d.axis === "y" || d.axis === "y2") {
15207
- if (!isX) {
15208
- key = "end";
15209
- }
15210
- if ((isX ? isRotated : !isRotated) && key in d) {
15211
- currScale = scale[d.axis];
15212
- pos = currScale(d[key]);
15213
- }
15214
- } else if ((isX ? !isRotated : isRotated) && key in d) {
15215
- currScale = scale.zoom || scale.x;
15216
- pos = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key]);
15217
- }
15218
- return pos;
15219
- },
15220
15242
  regionX(d) {
15221
- return this.getRegionXY("x", d);
15243
+ return this.getRegionSize("x", d);
15222
15244
  },
15223
15245
  regionY(d) {
15224
- return this.getRegionXY("y", d);
15246
+ return this.getRegionSize("y", d);
15247
+ },
15248
+ regionWidth(d) {
15249
+ return this.getRegionSize("width", d);
15225
15250
  },
15251
+ regionHeight(d) {
15252
+ return this.getRegionSize("height", d);
15253
+ },
15254
+ /**
15255
+ * Get Region size according start/end position
15256
+ * @param {string} type Type string
15257
+ * @param {ojbect} d Data object
15258
+ * @returns {number}
15259
+ * @private
15260
+ */
15226
15261
  getRegionSize(type, d) {
15227
15262
  const $$ = this;
15228
15263
  const { config, scale, state } = $$;
15229
15264
  const isRotated = config.axis_rotated;
15230
- const isWidth = type === "width";
15231
- const start = $$[isWidth ? "regionX" : "regionY"](d);
15265
+ const isAxisType = /(x|y|y2)/.test(type);
15266
+ const isType = isAxisType ? type === "x" : type === "width";
15267
+ const start = !isAxisType && $$[isType ? "regionX" : "regionY"](d);
15268
+ let key = isAxisType ? "start" : "end";
15269
+ let pos = isAxisType ? 0 : state[type];
15232
15270
  let currScale;
15233
- let key = "end";
15234
- let end = state[type];
15235
15271
  if (d.axis === "y" || d.axis === "y2") {
15236
- if (!isWidth) {
15272
+ if (!isAxisType && !isType) {
15237
15273
  key = "start";
15274
+ } else if (isAxisType && !isType) {
15275
+ key = "end";
15238
15276
  }
15239
- if ((isWidth ? isRotated : !isRotated) && key in d) {
15277
+ if ((isType ? isRotated : !isRotated) && key in d) {
15240
15278
  currScale = scale[d.axis];
15241
- end = currScale(d[key]);
15242
15279
  }
15243
- } else if ((isWidth ? !isRotated : isRotated) && key in d) {
15280
+ } else if ((isType ? !isRotated : isRotated) && key in d) {
15244
15281
  currScale = scale.zoom || scale.x;
15245
- end = currScale($$.axis.isTimeSeries() ? parseDate.call($$, d[key]) : d[key]);
15246
15282
  }
15247
- return end < start ? 0 : end - start;
15248
- },
15249
- regionWidth(d) {
15250
- return this.getRegionSize("width", d);
15251
- },
15252
- regionHeight(d) {
15253
- return this.getRegionSize("height", d);
15283
+ if (currScale) {
15284
+ let offset = 0;
15285
+ pos = d[key];
15286
+ if ($$.axis.isTimeSeries(d.axis)) {
15287
+ pos = parseDate.call($$, pos);
15288
+ } else if (/(x|width)/.test(type) && $$.axis.isCategorized() && isNaN(pos)) {
15289
+ pos = config.axis_x_categories.indexOf(pos);
15290
+ offset = $$.axis.x.tickOffset() * (key === "start" ? -1 : 1);
15291
+ }
15292
+ pos = currScale(pos) + offset;
15293
+ }
15294
+ return isAxisType ? pos : pos < start ? 0 : pos - start;
15254
15295
  },
15255
15296
  isRegionOnX(d) {
15256
15297
  return !d.axis || d.axis === "x";
@@ -16570,6 +16611,18 @@ function smoothLines(el, type) {
16570
16611
 
16571
16612
  ;// ./src/config/Options/axis/y2.ts
16572
16613
  /* harmony default export */ var y2 = ({
16614
+ /**
16615
+ * Set clip-path attribute for y2 axis element
16616
+ * - **NOTE**: `clip-path` attribute for y2 Axis is set only when `axis.y2.inner` option is true.
16617
+ * @name axis․y2․clipPath
16618
+ * @memberof Options
16619
+ * @type {boolean}
16620
+ * @default true
16621
+ * @example
16622
+ * // don't set 'clip-path' attribute
16623
+ * clipPath: false
16624
+ */
16625
+ axis_y2_clipPath: true,
16573
16626
  /**
16574
16627
  * Show or hide y2 axis.
16575
16628
  * - **NOTE**:
@@ -21863,7 +21916,7 @@ const bb = {
21863
21916
  * bb.version; // "1.0.0"
21864
21917
  * @memberof bb
21865
21918
  */
21866
- version: "3.14.3",
21919
+ version: "3.15.0-next.2",
21867
21920
  /**
21868
21921
  * Generate chart
21869
21922
  * - **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.14.3
8
+ * @version 3.15.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}